On 05/28/2014 02:45 AM, Peter Krempa wrote:
> }
But this patch isn't ideal and makes the logic in the code even more entangled.
qemuDomainObjRestore returns 1 on corrupted image that was removed, 0 on sucess
and -1 on other errors. The condition right above that hunk tests success case.
We should connect this failure case condition to the else section of that
condition so that we don't make it even weirder.
Your approach is even more legible; consider this a pre-approved ACK if
you turn it into a formal commit and apply it in time for 1.2.5.
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index c6f0b46..03b5a5e 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -6080,14 +6080,14 @@ qemuDomainObjStart(virConnectPtr conn,
VIR_WARN("Failed to remove the managed state %s",
managed_save);
else
vm->hasManagedSave = false;
- }
- if (ret > 0) {
- VIR_WARN("Ignoring incomplete managed state %s",
managed_save);
- } else {
+ goto cleanup;
+ } else if (ret < 0) {
VIR_WARN("Unable to restore from managed state %s. "
"Maybe the file is corrupted?", managed_save);
goto cleanup;
+ } else {
+ VIR_WARN("Ignoring incomplete managed state %s",
managed_save);
}
}
}
Peter
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org