[PATCH 0 of 2] Fix VSMC enumeration failure.

wbemcli ein http://root:elm3b41@localhost/root/virt:Xen_VirtualSystemManagementCapabilit... This currently returns: "Missing key: Name". This is because get_vsm_cap() is expecting a Name attribute in the ref, which doesn't exist on an enumeration query. This patch set fixes the enum issue in VSMC. Part of this fix is to add a new parameter to get_vsm_cap(). One of the handlers in ElementCapabilities calls get_vsm_cap(), so that function call has been updated as well.

# 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:

KR> - KR> - s = get_vsm_cap(_BROKER, ref, &inst); KR> + char hostname[256] = {0}; KR> + KR> + if (gethostname(hostname, sizeof(hostname) - 1) != 0) KR> + strcpy(hostname, "unknown"); KR> + KR> + s = get_vsm_cap(_BROKER, ref, hostname, &inst); This needs to be a call into the HostSystem provider. Right now, the name of the hostname *is* the hostname, but if we rely on other existing instrumentation for the host system, we might break here. The purpose of Virt_HostSystem was to be a placeholder so we wouldn't need to change several other providers if we changed where we get the host system information from. -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms@us.ibm.com

# HG changeset patch # User Kaitlin Rupert <karupert@us.ibm.com> # Date 1196288115 28800 # Node ID f26172c947953530556edb530dc8a371d2106c3e # Parent 34d66c74e3801796f89ca51df93ebff3075c6358 Update get_vsm_cap() call in ElementCapabilities. The get_vsm_cap() call in VSMC has been changed to include an extra paramater. The calling function in ElementCapabilities already gets the system / hostname, so all that needs to be done is to pass that value to get_vsm_cap(). Signed-off-by: Kaitlin Rupert <karupert@us.ibm.com> diff -r 34d66c74e380 -r f26172c94795 src/Virt_ElementCapabilities.c --- a/src/Virt_ElementCapabilities.c Wed Nov 28 14:15:10 2007 -0800 +++ b/src/Virt_ElementCapabilities.c Wed Nov 28 14:15:15 2007 -0800 @@ -78,7 +78,7 @@ static CMPIStatus sys_to_cap(const CMPIO goto out; } - s = get_vsm_cap(_BROKER, ref, &inst); + s = get_vsm_cap(_BROKER, ref, sys_name, &inst); if (s.rc == CMPI_RC_OK) inst_list_add(list, inst); out:
participants (2)
-
Dan Smith
-
Kaitlin Rupert