On 05/28/14 01:28, Eric Blake wrote: > On 05/27/2014 05:24 PM, Eric Blake wrote: >> On 05/27/2014 08:06 AM, Jason J. Herne wrote: >>> From: "Jason J. Herne" <jjherne@xxxxxxxxxx> >>> >>> qemuDomainObjStart is checking the return code from qemuDomainObjRestore for >>> errors even after determining that the return code is 0. This causes the >>> following error message to appear even when the restore was successful. >>> > >> >>> + if (ret > 0) { >>> + VIR_WARN("Ignoring incomplete managed state %s", managed_save); >>> + } else { >>> + VIR_WARN("Unable to restore from managed state %s. " >>> + "Maybe the file is corrupted?", managed_save); >>> + } >>> } >>> + goto cleanup; >> >> This goto is placed wrong; it causes us to skip starting the domain even >> when loading managed state was successful. > > Actually, it looks like we WANT to goto cleanup for ret == 0, and that Indeed. > the real problem is that commit cfc28c66 botched up for being noisy on > success. Maybe the fix we want is: > > diff --git i/src/qemu/qemu_driver.c w/src/qemu/qemu_driver.c > index f008763..86190ff 100644 > --- i/src/qemu/qemu_driver.c > +++ w/src/qemu/qemu_driver.c > @@ -6085,8 +6085,9 @@ qemuDomainObjStart(virConnectPtr conn, > if (ret > 0) { > VIR_WARN("Ignoring incomplete managed state %s", > managed_save); > } else { > - VIR_WARN("Unable to restore from managed state %s. " > - "Maybe the file is corrupted?", managed_save); > + if (ret < 0) > + VIR_WARN("Unable to restore from managed state %s. " > + "Maybe the file is corrupted?", managed_save); > goto cleanup; > } > } 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. 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
Attachment:
signature.asc
Description: OpenPGP digital signature
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list