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

Eric Blake eblake at redhat.com
Tue Nov 19 16:24:52 UTC 2013


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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 621 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20131119/f7f0fbc2/attachment-0001.sig>


More information about the libvir-list mailing list