Re: [libvirt-python 16/18] VIR_DOMAIN_EVENT_ID_DEVICE_REMOVED was added in 1.1.1

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

 



On 11/18/2013 03:44 PM, Doug Goldstein wrote:
> ---
>  libvirt-override.c | 4 ++++
>  1 file changed, 4 insertions(+)

ACK.

> @@ -6404,8 +6406,10 @@ libvirt_virConnectDomainEventRegisterAny(ATTRIBUTE_UNUSED PyObject * self,
>          cb = VIR_DOMAIN_EVENT_CALLBACK(libvirt_virConnectDomainEventPMSuspendDiskCallback);
>          break;
>  #endif /* LIBVIR_CHECK_VERSION(1,0,0) */
> +#if LIBVIR_CHECK_VERSION(1,1,1)
>      case VIR_DOMAIN_EVENT_ID_DEVICE_REMOVED:
>          cb = VIR_DOMAIN_EVENT_CALLBACK(libvirt_virConnectDomainEventDeviceRemovedCallback);
> +#endif /* LIBVIR_CHECK_VERSION(1,1,1) */
>  
>      case VIR_DOMAIN_EVENT_ID_LAST:

Hmm.  VIR_DOMAIN_EVENT_ID_LAST has a floating value - the value that it
has in the libvirt.h we compile against may not match the value that it
has in the remote libvirtd we are connecting to.  More specifically, if
we are compiled against 1.0.0 but talking to a 1.1.1 server, the server
can return an event id that we think is VIR_DOMAIN_EVENT_ID_LAST; what's
more, an 0.10.2 client talking to a 1.1.1 server will see an id that is
larger than VIR_DOMAIN_EVENT_ID_LAST, at which point it just skips the
entire switch statement.

But in the context you didn't show, we correctly treat all unknown
callback ids (whether we think it is VIR_DOMIAN_EVENT_ID_LAST or even
something larger), so this looks correct to me.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

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