On 08/27/2011 07:16 AM, Eric Blake wrote:
Implement the new running/paused overrides for saved state
management.
Unfortunately, for virDomainSaveImageDefineXML, the saved state
updates are write-only - I don't know of any way to expose a way
to query the current run/pause setting of an existing save image
file to the user without adding a new API or modifying the domain
xml of virDomainSaveImageGetXMLDesc to include a new element to
reflect the state bit encoded into the save image. However, I
don't think this is a show-stopper, since the API is designed to
leave the state bit alone unless an explicit flag is used to
change it.
@@ -4150,11 +4177,8 @@ qemuDomainSaveImageDefineXML(virConnectPtr conn, const char
*path,
goto cleanup;
}
- if (lseek(fd, sizeof(header), SEEK_SET) != sizeof(header)) {
- virReportSystemError(errno, _("cannot seek in '%s'"), path);
- goto cleanup;
- }
- if (safewrite(fd, xml, len) != len ||
+ if (safewrite(fd,&header, sizeof(header) != sizeof(header)) ||
+ safewrite(fd, xml, len) != len ||
I need to test this better before posting. A misplaced ), along with
the fact that opening the fd does not leave the fd positioned at 0,
means I need to squash in this:
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 0498054..8682b98 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -4177,7 +4177,11 @@ qemuDomainSaveImageDefineXML(virConnectPtr conn,
const char *path,
goto cleanup;
}
- if (safewrite(fd, &header, sizeof(header) != sizeof(header)) ||
+ if (lseek(fd, 0, SEEK_SET) != 0) {
+ virReportSystemError(errno, _("cannot seek in '%s'"), path);
+ goto cleanup;
+ }
+ if (safewrite(fd, &header, sizeof(header)) != sizeof(header) ||
safewrite(fd, xml, len) != len ||
VIR_CLOSE(fd) < 0) {
virReportSystemError(errno, _("failed to write xml to '%s'"),
path);
--
1.7.4.4
--
Eric Blake eblake(a)redhat.com +1-801-349-2682
Libvirt virtualization library
http://libvirt.org