[libvirt] [PATCH 3/4] Fix QEMU save/restore with block devices
Daniel P. Berrange
berrange at redhat.com
Thu Apr 22 10:37:17 UTC 2010
On Wed, Apr 21, 2010 at 03:03:43PM -0600, Eric Blake wrote:
> 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)
I didn't want to silence stderr, because I want it to end up in the QEMU
logfile if anything goes wrong. So i really need a way to make dd keep
quiet on success, rather than throwing away stderr
Daniel
--
|: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
More information about the libvir-list
mailing list