
# HG changeset patch # User Kaitlin Rupert <karupert@us.ibm.com> # Date 1196288110 28800 # Node ID 34d66c74e3801796f89ca51df93ebff3075c6358 # 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. Signed-off-by: Kaitlin Rupert <karupert@us.ibm.com> diff -r c478a5b30689 -r 34d66c74e380 src/Virt_VirtualSystemManagementCapabilities.c --- a/src/Virt_VirtualSystemManagementCapabilities.c Wed Nov 28 11:06:22 2007 -0800 +++ b/src/Virt_VirtualSystemManagementCapabilities.c Wed Nov 28 14:15:10 2007 -0800 @@ -90,19 +90,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 +136,12 @@ static CMPIStatus return_vsm_cap(const C { CMPIStatus s = {CMPI_RC_OK, NULL}; CMPIInstance *inst = NULL; - - s = get_vsm_cap(_BROKER, ref, &inst); + char hostname[256] = {0}; + + if (gethostname(hostname, sizeof(hostname) - 1) != 0) + strcpy(hostname, "unknown"); + + s = get_vsm_cap(_BROKER, ref, hostname, &inst); if (s.rc != CMPI_RC_OK) goto out; diff -r c478a5b30689 -r 34d66c74e380 src/Virt_VirtualSystemManagementCapabilities.h --- a/src/Virt_VirtualSystemManagementCapabilities.h Wed Nov 28 11:06:22 2007 -0800 +++ b/src/Virt_VirtualSystemManagementCapabilities.h Wed Nov 28 14:15:10 2007 -0800 @@ -20,6 +20,7 @@ */ CMPIStatus get_vsm_cap(const CMPIBroker *broker, const CMPIObjectPath *ref, + const char* sys_name, CMPIInstance **inst); /* * Local Variables: