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@redhat.com wrote on 06/22/2011 11:05:13 AM:

> Chip Vincent <cvincent@linux.vnet.ibm.com>

> Sent by: libvirt-cim-bounces@redhat.com
>

> 06/22/11 11:05 AM
>
> Please respond to
> List for discussion and development of libvirt CIM <libvirt-cim@redhat.com>

>
> To

>
> libvirt-cim@redhat.com

>
> cc

>
> Subject

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

>
> # HG changeset patch
> # User Chip Vincent <cvincent@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@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@redhat.com
> https://www.redhat.com/mailman/listinfo/libvirt-cim