On Fri, May 20, 2011 at 03:09:42PM +0800, Wen Congyang wrote: > If we do not performe a live migration, the vm is always paused when we go to > doPeer2PeerMigrate2() and doPeer2PeerMigrate3(), because we stop the vm in > qemuMigrationPerform(). So we should check it before setting it offline. The only code which checks for 'if (flags & VIR_MIGRATE_PAUSED)' is the qemuMigrateFinished method. This is called from doPeer2PeerMigrate2 or doPeer2PeerMigrate3. So putting the change 'flags |= VIR_MIGRATED_PAUSED' does not make any difference to peer2peer migration, and for non-peer2peer migration, this will have already been set in libvirt.c. So I'm not seeing what bug is being fixed by this change. The doPeer2PeerMigrate2 and doPeer2PeerMigrate3 methods are intended to be structured (near) identically to the virDomainMigrate2 and virDomainMigrate3 methods in libvirt.c, so I think the code is correct as it already is. > > --- > src/qemu/qemu_migration.c | 9 +++------ > 1 files changed, 3 insertions(+), 6 deletions(-) > > diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c > index ab28416..30167f2 100644 > --- a/src/qemu/qemu_migration.c > +++ b/src/qemu/qemu_migration.c > @@ -1614,9 +1614,6 @@ static int doPeer2PeerMigrate2(struct qemud_driver *driver, > VIR_DOMAIN_XML_UPDATE_CPU))) > return -1; > > - if (virDomainObjGetState(vm, NULL) == VIR_DOMAIN_PAUSED) > - flags |= VIR_MIGRATE_PAUSED; > - > VIR_DEBUG("Prepare2 %p", dconn); > if (flags & VIR_MIGRATE_TUNNELLED) { > /* > @@ -1748,9 +1745,6 @@ static int doPeer2PeerMigrate3(struct qemud_driver *driver, > if (!dom_xml) > goto cleanup; > > - if (virDomainObjGetState(vm, NULL) == VIR_DOMAIN_PAUSED) > - flags |= VIR_MIGRATE_PAUSED; > - > VIR_DEBUG("Prepare3 %p", dconn); > cookiein = cookieout; > cookieinlen = cookieoutlen; > @@ -1985,6 +1979,9 @@ int qemuMigrationPerform(struct qemud_driver *driver, > memset(&priv->jobInfo, 0, sizeof(priv->jobInfo)); > priv->jobInfo.type = VIR_DOMAIN_JOB_UNBOUNDED; > > + if (virDomainObjGetState(vm, NULL) == VIR_DOMAIN_PAUSED) > + flags |= VIR_MIGRATE_PAUSED; > + > resume = virDomainObjGetState(vm, NULL) == VIR_DOMAIN_RUNNING; > if (!(flags & VIR_MIGRATE_LIVE) && > virDomainObjGetState(vm, NULL) == VIR_DOMAIN_RUNNING) { Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :| -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list