[libvirt] [PATCH] qemu: forget free priv->origname when get fail in qemuMigrationPrepareAny

https://bugzilla.redhat.com/show_bug.cgi?id=1181182 When we meet error in qemuMigrationPrepareAny and goto cleanup with rc < 0, we forget clear the priv->origname and this will make this vm migrate fail next time because leave a wrong origname in priv, and will Generate a wrong cookie when do migrate next time. This patch will make priv->origname is NULL when migrate fail in target host. Signed-off-by: Luyao Huang <lhuang@redhat.com> --- src/qemu/qemu_migration.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 77e0b35..a282c43 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -3104,6 +3104,7 @@ qemuMigrationPrepareAny(virQEMUDriverPtr driver, if (ret < 0 && priv) { /* priv is set right after vm is added to the list of domains * and there is no 'goto cleanup;' in the middle of those */ + VIR_FREE(priv->origname); virPortAllocatorRelease(driver->migrationPorts, priv->nbdPort); priv->nbdPort = 0; qemuDomainRemoveInactive(driver, vm); -- 1.8.3.1

On Tue, Jan 13, 2015 at 10:15:52 +0800, Luyao Huang wrote:
https://bugzilla.redhat.com/show_bug.cgi?id=1181182
When we meet error in qemuMigrationPrepareAny and goto cleanup with rc < 0, we forget clear the priv->origname and this will make this vm migrate fail next time because leave a wrong origname in priv, and will Generate a wrong cookie when do migrate next time.
This patch will make priv->origname is NULL when migrate fail in target host.
Signed-off-by: Luyao Huang <lhuang@redhat.com> --- src/qemu/qemu_migration.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 77e0b35..a282c43 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -3104,6 +3104,7 @@ qemuMigrationPrepareAny(virQEMUDriverPtr driver, if (ret < 0 && priv) { /* priv is set right after vm is added to the list of domains * and there is no 'goto cleanup;' in the middle of those */ + VIR_FREE(priv->origname); virPortAllocatorRelease(driver->migrationPorts, priv->nbdPort); priv->nbdPort = 0; qemuDomainRemoveInactive(driver, vm);
ACK, I'll push this patch shortly. Jirka
participants (2)
-
Jiri Denemark
-
Luyao Huang