
On Wed, Nov 25, 2009 at 04:40:08PM +0100, Paolo Bonzini wrote:
This patch fixes the bug where paused/running state is not transmitted during migration. As a result, in the QEMU driver for example the machine was always started on the destination end.
In order to do so, I just read the state and if it is appropriate I set the VIR_MIGRATE_PAUSED flag.
* src/libvirt.c (virDomainMigrateVersion1, virDomainMigrateVersion2): Automatically add VIR_MIGRATE_PAUSED when appropriate. * src/xen/xend_internal.c (xenDaemonDomainMigratePerform): Give a nicer error message when migration of paused virtual machines is attempted. --- src/libvirt.c | 12 ++++++++++++ src/xen/xend_internal.c | 9 +++++++++ 2 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/src/libvirt.c b/src/libvirt.c index 2ced604..9d03e13 100644 --- a/src/libvirt.c +++ b/src/libvirt.c @@ -2964,6 +2964,12 @@ virDomainMigrateVersion1 (virDomainPtr domain, char *uri_out = NULL; char *cookie = NULL; int cookielen = 0; + virDomainInfo info; + + virDomainGetInfo (domain, &info); + if (info.state == VIR_DOMAIN_PAUSED) { + flags |= VIR_MIGRATE_PAUSED; + }
There's a non-trivial chance of virDomainGetInfo failing so I think we should check return value here Also, since we now have the state, we might as well also short-circuit shutoff domains if (info.state == VIR_DOMAIN_SHUTOFF) ...cannot migrate inactive domains... Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|