On 03/10/2011 05:05 AM, Daniel P. Berrange wrote:
On Wed, Mar 09, 2011 at 06:45:46PM -0700, Eric Blake wrote:
> This allows direct saves (no compression, no root-squash NFS) to use
> the more efficient fd: migration, which in turn avoids a race where
> qemu exec: migration can sometimes fail because qemu does a generic
> waitpid() that conflicts with the pclose() used by exec:. Further
> patches will solve compression and root-squash NFS.
>
> * src/qemu/qemu_driver.c (qemudDomainSaveFlag): Use new function
> when there is no compression.
> ---
> src/qemu/qemu_driver.c | 26 +++++++++++++++++++++++---
> 1 files changed, 23 insertions(+), 3 deletions(-)
>
> + /* XXX gross - why don't we reuse the fd already opened earlier */
> + int fd = -1;
> +
> + if (qemuCapsGet(qemuCaps, QEMU_CAPS_MIGRATE_QEMU_FD) &&
> + priv->monConfig->type == VIR_DOMAIN_CHR_TYPE_UNIX)
> + fd = open(path, O_WRONLY);
Ok, so this is the bit which causes a regression on NFS rootsquash,
if the path isn't readable by root.
Nope; no regression - just no fd: migration (it's a graceful fallback to
exec: migration on NFS rootsquash until later patches in the series).
> qemuDomainObjEnterMonitorWithDriver(driver, vm);
> - rc = qemuMonitorMigrateToFile(priv->mon,
> - QEMU_MONITOR_MIGRATE_BACKGROUND,
> - args, path, offset);
> + if (fd >= 0 && lseek(fd, offset, SEEK_SET) == offset) {
> + rc = qemuMonitorMigrateToFd(priv->mon,
> + QEMU_MONITOR_MIGRATE_BACKGROUND,
> + fd);
> + } else {
> + rc = qemuMonitorMigrateToFile(priv->mon,
> + QEMU_MONITOR_MIGRATE_BACKGROUND,
> + args, path, offset);
> + }
> + VIR_FORCE_CLOSE(fd);
Did this patch get ACK? I'm thinking of shuffling things and pushing
this prior to 5/15 (introduction of SCM_RIGHTS); patch 5 and 6 have no
direct influence on one another.
But I'm also annoyed at having to open qemuCaps, and am thinking about
fixing that first.
--
Eric Blake eblake(a)redhat.com +1-801-349-2682
Libvirt virtualization library
http://libvirt.org