[Libvirt-cim] [PATCH] Check libvirt version before compiling ACL library code

Sharad Mishra snmishra at us.ibm.com
Sun Jun 26 17:18:44 UTC 2011


Code looks fine and compiles. Haven't tested it.
Please test and push.

+1

Sharad Mishra
Open Virtualization
Linux Technology Center
IBM

libvirt-cim-bounces at redhat.com wrote on 06/22/2011 11:05:13 AM:

> Chip Vincent <cvincent at linux.vnet.ibm.com>
> Sent by: libvirt-cim-bounces at redhat.com
>
> 06/22/11 11:05 AM
>
> Please respond to
> List for discussion and development of libvirt CIM
<libvirt-cim at redhat.com>
>
> To
>
> libvirt-cim at redhat.com
>
> cc
>
> Subject
>
> [Libvirt-cim] [PATCH] Check libvirt version before compiling ACL library
code
>
> # HG changeset patch
> # User Chip Vincent <cvincent at us.ibm.com>
> # Date 1308765905 14400
> # Node ID 090e8ae2a0c18fad143df826dececb48d4de6b3a
> # Parent  f5c86ef03e64f61bb142f1aeaf448c438b28bd23
> Check libvirt version before compiling ACL library code.
>
> RHEL 5.5 that ships with libvirt 0.6.3. The NWFilter* APIs were created
in
> 0.8.1 so the ACL code should be stubbed when LIBVIR_VERSION_NUMBER >
8000.
> Same thing with using virDomainUpdateDeviceFlags().
>
> Signed-off-by: Chip Vincent <cvincent at us.ibm.com>
>
> diff --git a/libxkutil/acl_parsing.c b/libxkutil/acl_parsing.c
> --- a/libxkutil/acl_parsing.c
> +++ b/libxkutil/acl_parsing.c
> @@ -456,6 +456,7 @@
>          const char *name,
>          struct acl_filter **filter)
>  {
> +#if LIBVIR_VERSION_NUMBER > 8000
>          virNWFilterPtr vfilter = NULL;
>          char *xml = NULL;
>
> @@ -474,6 +475,9 @@
>          get_filter_from_xml(xml, filter);
>
>          return 1;
> +#else
> +        return 0;
> +#endif
>  }
>
>  int get_filter_by_uuid(
> @@ -481,6 +485,7 @@
>          const char *uuid,
>          struct acl_filter **filter)
>  {
> +#if LIBVIR_VERSION_NUMBER > 8000
>          virNWFilterPtr vfilter = NULL;
>          char *xml = NULL;
>
> @@ -499,12 +504,16 @@
>          get_filter_from_xml(xml, filter);
>
>          return 1;
> +#else
> +        return 0;
> +#endif
>  }
>
>  int get_filters(
>          virConnectPtr conn,
>          struct acl_filter **list)
>  {
> +#if LIBVIR_VERSION_NUMBER > 8000
>          int count = 0;
>          char **names = NULL;
>          struct acl_filter *filters = NULL;
> @@ -537,6 +546,9 @@
>          free(names);
>
>          return i;
> +#else
> +        return 0;
> +#endif
>  }
>
>
> diff --git a/src/Virt_AppliedFilterList.c b/src/Virt_AppliedFilterList.c
> --- a/src/Virt_AppliedFilterList.c
> +++ b/src/Virt_AppliedFilterList.c
> @@ -105,6 +105,7 @@
>  static int update_device(virDomainPtr dom,
>                           struct virt_device *dev)
>  {
> +#if LIBVIR_VERSION_NUMBER > 8000
>          char *xml = NULL;
>          int flags = VIR_DOMAIN_DEVICE_MODIFY_CURRENT |
>                      VIR_DOMAIN_DEVICE_MODIFY_CONFIG;
> @@ -132,6 +133,9 @@
>          free(xml);
>
>          return ret;
> +#else
> +        return 0;
> +#endif
>  }
>
>  /* TODO: Port to libxkutil/device_parsing.c */
>
> _______________________________________________
> Libvirt-cim mailing list
> Libvirt-cim at redhat.com
> https://www.redhat.com/mailman/listinfo/libvirt-cim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvirt-cim/attachments/20110626/bffa4f4a/attachment.htm>


More information about the Libvirt-cim mailing list