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

Chip Vincent cvincent at linux.vnet.ibm.com
Wed Jun 22 18:05:13 UTC 2011


# 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 */




More information about the Libvirt-cim mailing list