[libvirt PATCH] qemu_driver: Fix virDomainSaveImageDefineXML

From: Pavel Hrdina <phrdina@redhat.com> Commit 28a06215280b99708ed8dc2d183f62ba7b34ccf8 added support to restore sparse images but changed the boolean that controls if we open the file as read-only or read-write. Editing XML in the save image resulted in following error message: failed to write header to domain save file '/data/images/fedora40.save': Bad file descriptor Signed-off-by: Pavel Hrdina <phrdina@redhat.com> --- src/qemu/qemu_driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 3cf21380ed..056a9e579d 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -5945,7 +5945,7 @@ qemuDomainSaveImageDefineXML(virConnectPtr conn, const char *path, if (qemuSaveImageGetMetadata(driver, NULL, path, &def, &data) < 0) goto cleanup; - fd = qemuSaveImageOpen(driver, path, false, false, NULL, false); + fd = qemuSaveImageOpen(driver, path, false, false, NULL, true); if (fd < 0) goto cleanup; -- 2.49.0

On 3/24/25 13:20, Pavel Hrdina via Devel wrote:
From: Pavel Hrdina <phrdina@redhat.com>
Commit 28a06215280b99708ed8dc2d183f62ba7b34ccf8 added support to restore sparse images but changed the boolean that controls if we open the file as read-only or read-write. Editing XML in the save image resulted in following error message:
failed to write header to domain save file '/data/images/fedora40.save': Bad file descriptor
Signed-off-by: Pavel Hrdina <phrdina@redhat.com> --- src/qemu/qemu_driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
I was about to send the same fix when I noticed you got there first. Thanks for cleaning up after me, and for improving the mapped-ram support! Reviewed-by: Jim Fehlig <jfehlig@suse.com> Regards, Jim
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 3cf21380ed..056a9e579d 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -5945,7 +5945,7 @@ qemuDomainSaveImageDefineXML(virConnectPtr conn, const char *path, if (qemuSaveImageGetMetadata(driver, NULL, path, &def, &data) < 0) goto cleanup;
- fd = qemuSaveImageOpen(driver, path, false, false, NULL, false); + fd = qemuSaveImageOpen(driver, path, false, false, NULL, true);
if (fd < 0) goto cleanup;
participants (2)
-
Jim Fehlig
-
Pavel Hrdina