Re: [libvirt] How to differentiate creation from migration?

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

 



On Wed, Mar 10, 2010 at 04:11:30PM +0100, Daniel Veillard wrote:
> On Wed, Mar 10, 2010 at 11:40:44AM -0300, Richard Maciel wrote:
> > Hi,
> > 
> > I work on a project that makes use of libvirt (called libvirt-cim)
> > and we created an algorithm to detect when a new machine is created.
> > However, I need to filter the ones created by the migration
> > operation.
> > 
> > Does libvirt provides a way to distinguish a machine created by
> > 'migrate' command from a machine created by the 'define' command
> > (virDomainDefineXML API call)?
> 
>   I think that if you register for domain lifetime events then
> you will get this informations as part of the details, but asynchronously
> 
> http://libvirt.org/html/libvirt-libvirt.html#virConnectDomainEventRegister

Yes, this will give you an event

   VIR_DOMAIN_EVENT_STARTED 

with a detail field containing one of the following

    VIR_DOMAIN_EVENT_STARTED_BOOTED = 0,   /* Normal startup from boot */
    VIR_DOMAIN_EVENT_STARTED_MIGRATED = 1, /* Incoming migration from another host */
    VIR_DOMAIN_EVENT_STARTED_RESTORED = 2, /* Restored from a state file */


NB, we do not require that all drivers support the detail field. At this
time, only KVM/QEMU driver will fill in the detail field. Others (Xen, etc)
will always set VIR_DOMAIN_EVENT_STARTED_BOOTED

Regards,
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 :|

--
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]