On 16.12.2014 17:41, Ján Tomko wrote:
It should not be needed in all qemuMigrationSet* functions,
but I changed them all for consistency.
---
src/qemu/qemu_migration.c | 41 ++++++++++++++++++++++++++---------------
1 file changed, 26 insertions(+), 15 deletions(-)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 0acbb57..ed7d6fe 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1662,7 +1662,8 @@ qemuMigrationStartNBDServer(virQEMUDriverPtr driver,
qemuDomainObjExitMonitor(driver, vm);
goto cleanup;
}
- qemuDomainObjExitMonitor(driver, vm);
+ if (qemuDomainObjExitMonitorAlive(driver, vm) < 0)
+ goto cleanup;
}
priv->nbdPort = port;
@@ -1859,7 +1860,7 @@ qemuMigrationDriveMirror(virQEMUDriverPtr driver,
}
-static void
+static int
qemuMigrationStopNBDServer(virQEMUDriverPtr driver,
virDomainObjPtr vm,
qemuMigrationCookiePtr mig)
@@ -1867,22 +1868,23 @@ qemuMigrationStopNBDServer(virQEMUDriverPtr driver,
qemuDomainObjPrivatePtr priv = vm->privateData;
if (!mig->nbd)
- return;
+ return 0;
if (qemuDomainObjEnterMonitorAsync(driver, vm,
QEMU_ASYNC_JOB_MIGRATION_IN) < 0)
- return;
+ return -1;
if (qemuMonitorNBDServerStop(priv->mon) < 0)
VIR_WARN("Unable to stop NBD server");
- qemuDomainObjExitMonitor(driver, vm);
-
virPortAllocatorRelease(driver->migrationPorts, priv->nbdPort);
priv->nbdPort = 0;
+ if (qemuDomainObjExitMonitorAlive(driver, vm) < 0)
+ return -1;
I don't thin it's safe to manipulate priv with unlocked domain.
Otherwise looking good.
+ return 0;
}
Michal