On 11/06/2013 02:06 PM, Michal Privoznik wrote:
Since 86d90b3a (yes, my patch; again) we are supporting NBD storage
migration. However, on error recovery path we got the steps reversed.
The correct order is: return NBD port to the virPortAllocator and then
either unlock the vm or remove it from the driver. Not vice versa.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/qemu/qemu_migration.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 4f35a7a..13d0808 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -2450,13 +2450,14 @@ cleanup:
VIR_FORCE_CLOSE(dataFD[0]);
VIR_FORCE_CLOSE(dataFD[1]);
if (vm) {
- if (ret >= 0 || vm->persistent)
- virObjectUnlock(vm);
- else
- qemuDomainRemoveInactive(driver, vm);
if (ret < 0) {
virPortAllocatorRelease(driver->remotePorts, priv->nbdPort);
priv->nbdPort = 0;
+ } else {
+ if (vm->persistent)
+ virObjectUnlock(vm);
+ else
+ qemuDomainRemoveInactive(driver, vm);
}
}
if (event)
On second thought, this doesn't unlock the VM if (ret < 0) &&
(vm->persistent).