On 04/21/2010 10:56 AM, Daniel P. Berrange wrote:
The save process was relying on use of the shell >> append
operator to ensure the save data was placed after the libvirt
header + XML. This doesn't work for block devices though.
Replace this code with use of 'dd' and its 'seek' parameter.
The qemuMonitorMigateToCommand() monitor API is used for both
save/coredump, and migration via UNIX socket. We can't simply
switch this to use 'dd' since this causes problems with the
migration usage. Thus, create a dedicated qemuMonitorMigateToFile
which can accept an filename + offset, and remove the filename
from the current qemuMonitorMigateToCommand() API
+++ b/src/qemu/qemu_driver.c
@@ -4789,6 +4789,7 @@ static int qemudDomainSaveFlag(virDomainPtr dom, const char *path,
qemuDomainObjPrivatePtr priv;
struct stat sb;
int is_bdev = 0;
+ unsigned long long offset;
Should this be off_t instead of ull?
@@ -1673,7 +1701,8 @@ int
qemuMonitorJSONMigrateToCommand(qemuMonitorPtr mon,
goto cleanup;
}
- if (virAsprintf(&dest, "exec:%s >>%s 2>/dev/null", argstr,
safe_target) < 0) {
+ if (virAsprintf(&dest, "exec:%s | dd of=%s seek=%llub",
+ argstr, safe_target, offset) < 0) {
Don't you still need to silence stderr, particularly since dd writes to
stderr even on success? (2 instances)
--
Eric Blake eblake(a)redhat.com +1-801-349-2682
Libvirt virtualization library
http://libvirt.org