[Libvirt-cim] [PATCH 1 of 3] Fix issue with VSMC enum

Kaitlin Rupert kaitlin at linux.vnet.ibm.com
Thu Nov 29 21:42:29 UTC 2007


# HG changeset patch
# User Kaitlin Rupert <karupert at us.ibm.com>
# Date 1196370791 28800
# Node ID f849a60bc19bfabb37ef2f9184c88d5200cc3ee7
# Parent  c478a5b30689a80159588c8f914ac97263694372
Fix issue with VSMC enum.

This fix makes get_vsm_cap() more generic - it accepts a string to use for the InstanceID. The return_vsm_cap() handles enum'ing the VSMC instances, so this has been updated to get the hostname, which will be used in the InstanceID string.

Updated:  Instead of using gethostname() call, get the instance of the host system and use it's value for the Name attribute.  This update will allow for potiential host instances that don't use the hostname as the value for the Name attribute.

Signed-off-by: Kaitlin Rupert <karupert at us.ibm.com>

diff -r c478a5b30689 -r f849a60bc19b src/Virt_VirtualSystemManagementCapabilities.c
--- a/src/Virt_VirtualSystemManagementCapabilities.c	Wed Nov 28 11:06:22 2007 -0800
+++ b/src/Virt_VirtualSystemManagementCapabilities.c	Thu Nov 29 13:13:11 2007 -0800
@@ -33,6 +33,7 @@
 #include "device_parsing.h"
 
 #include "Virt_VirtualSystemManagementCapabilities.h"
+#include "Virt_HostSystem.h"
 
 const static CMPIBroker *_BROKER;
 
@@ -90,19 +91,12 @@ static CMPIStatus set_inst_properties(co
 
 CMPIStatus get_vsm_cap(const CMPIBroker *broker,
                        const CMPIObjectPath *ref,
+                       const char* sys_name,
                        CMPIInstance **inst)
 {
         CMPIStatus s;
         CMPIObjectPath *op;
         char *classname = NULL;
-        const char *sys_name = NULL;
-        
-        if (cu_get_str_path(ref, "Name", &sys_name) != CMPI_RC_OK) {
-                CMSetStatusWithChars(broker, &s,
-                                     CMPI_RC_ERR_FAILED,
-                                     "Missing key: Name");
-                goto out;
-        }
 
         classname = get_typed_class(CLASSNAME(ref),
                                     "VirtualSystemManagementCapabilities");
@@ -143,8 +137,16 @@ static CMPIStatus return_vsm_cap(const C
 {
         CMPIStatus s = {CMPI_RC_OK, NULL};
         CMPIInstance *inst = NULL;
-        
-        s = get_vsm_cap(_BROKER, ref, &inst);
+        const char *hostname = NULL;
+
+        s = get_host_cs(_BROKER, ref, &inst);
+        if (s.rc != CMPI_RC_OK)
+                goto out;
+
+        if (cu_get_str_prop(inst, "Name", &hostname) != CMPI_RC_OK)
+                goto out;
+
+        s = get_vsm_cap(_BROKER, ref, hostname, &inst);
         if (s.rc != CMPI_RC_OK)
                 goto out;
 
diff -r c478a5b30689 -r f849a60bc19b src/Virt_VirtualSystemManagementCapabilities.h
--- a/src/Virt_VirtualSystemManagementCapabilities.h	Wed Nov 28 11:06:22 2007 -0800
+++ b/src/Virt_VirtualSystemManagementCapabilities.h	Thu Nov 29 13:13:11 2007 -0800
@@ -20,6 +20,7 @@
  */
 CMPIStatus get_vsm_cap(const CMPIBroker *broker,
                        const CMPIObjectPath *ref,
+                       const char* sys_name,
                        CMPIInstance **inst);
 /*
  * Local Variables:




More information about the Libvirt-cim mailing list