Re: PATCH: Inform QEMU "prepare" hook of migration in progress

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Dec 15, 2011 at 01:59:06PM -0700, Eric Blake wrote:
> On 12/15/2011 09:49 AM, Adam Tilghman wrote:
> >> From: Eric Blake <eblake redhat com>
> >> Subject: Re: [libvirt-users] Wanted: method for qemu hook script to know if called for migration
> >> Date: Mon, 25 Jul 2011 14:17:08 -0600
> >>
> >>> As a feature suggestion, it would be nice if that fourth input variable,
> >>> currently "-", was something like "migrate" in this instance.
> >>
> >> Yes, that is probably a bug worth fixing.
> > 
> > I would also find it useful for the QEMU "prepare" hook 
> > to be told whether it's being called in the context of a migration.
> > 
> > (In our case, we use that hook to manage shared DRBD storage, and only permit
> > Primary/Primary mode in the context of a migration.)
> > 
> > The attached 1-line patch supplies the hook with an additional 
> > argument "migration-target" when appropriate.
> > 
> > Submitted as https://bugzilla.redhat.com/show_bug.cgi?id=768054
> > 
> 
> >          hookret = virHookCall(VIR_HOOK_DRIVER_QEMU, vm->def->name,
> > -                    VIR_HOOK_QEMU_OP_PREPARE, VIR_HOOK_SUBOP_BEGIN, NULL, xml);
> > +                    VIR_HOOK_QEMU_OP_PREPARE, VIR_HOOK_SUBOP_BEGIN,  migrateFrom ? "migration-target" : NULL, xml);
> 
> The idea is nice, but I don't think it's quite the right implementation.
>  migrateFrom is non-NULL not only for migration, but also for operations
> like 'virsh restore file' when restoring from a file-based migration
> stream even though we aren't changing hosts.  Rather, we need to thread
> something through the call chain so that we can tell whether this code
> was reached from qemu_migrate.c during an actual migration case.  In
> fact, it might be nice to know when 'virsh restore' was in use,
> separately from migration, separately from a fresh boot, so that we
> provide more than just '-' or 'migration-target' as the fourth hook
> argument.

That information is in fact already passed into qemuProcessStart()
via the virDomainRunningReason parameter, one of whose possible
values is VIR_DOMAIN_RUNNING_MIGRATED


Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]