[PATCH 1/6] qemu: fix domain start with corrupted save file
jtomko at redhat.com
Wed Apr 22 16:41:51 UTC 2020
On a Wednesday in 2020, Peter Krempa wrote:
>Commit 21ad56e932 introduced a regression where a VM with a corrupted
>save image file would fail to start on the first attempt. This was
>caused by returning a wrong return code as 'fd' was abused to also hold
>the return code.
>Since it's easy to miss this nuance introduce a 'ret' variable for the
>return code and return it's value in the error section.
>Signed-off-by: Peter Krempa <pkrempa at redhat.com>
> src/qemu/qemu_driver.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
>index dfe0adaad8..9a9361949d 100644
>@@ -6691,6 +6691,7 @@ qemuDomainSaveImageOpen(virQEMUDriverPtr driver,
> bool unlink_corrupt)
> int fd = -1;
>+ int ret = -1;
> virQEMUSaveDataPtr data = NULL;
> virQEMUSaveHeaderPtr header;
> virDomainDefPtr def = NULL;
This does not restore the preservation of -errno from the following
if ((fd = qemuOpenFile(driver, NULL, path, oflags, NULL)) < 0)
that existed before commit 21ad56e932 mentioned above. Thankfully.
Guess it's unlikely that this function would return -ESRCH and confuse
Reviewed-by: Ján Tomko <jtomko at redhat.com>
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 488 bytes
Desc: not available
More information about the libvir-list