[PATCH 0 of 3] #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. Updates: Instead of using gethostname() call, get the instance of the host system and use it's value for the Name attribute.

# HG changeset patch # User Kaitlin Rupert <karupert@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@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:

KR> # HG changeset patch KR> # User Kaitlin Rupert <karupert@us.ibm.com> KR> # Date 1196370791 28800 KR> # Node ID f849a60bc19bfabb37ef2f9184c88d5200cc3ee7 KR> # Parent c478a5b30689a80159588c8f914ac97263694372 KR> Fix issue with VSMC enum. Thanks, applied. KR> + s = get_host_cs(_BROKER, ref, &inst); KR> + if (s.rc != CMPI_RC_OK) KR> + goto out; KR> + KR> + if (cu_get_str_prop(inst, "Name", &hostname) != CMPI_RC_OK) KR> + goto out; It's even cleaner this way, right? :) With the recent API change, you don't even have to free something, which I think is pretty nifty. -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms@us.ibm.com

Dan Smith wrote:
KR> + s = get_host_cs(_BROKER, ref, &inst); KR> + if (s.rc != CMPI_RC_OK) KR> + goto out; KR> + KR> + if (cu_get_str_prop(inst, "Name", &hostname) != CMPI_RC_OK) KR> + goto out;
It's even cleaner this way, right? :)
With the recent API change, you don't even have to free something, which I think is pretty nifty.
Definitely much cleaner, and also the right thing to do. =) -- Kaitlin Rupert IBM Linux Technology Center karupert@us.ibm.com

# HG changeset patch # User Kaitlin Rupert <karupert@us.ibm.com> # Date 1196371960 28800 # Node ID e06948021a3a7eea119332b2fe4d773c0d748ffa # Parent f849a60bc19bfabb37ef2f9184c88d5200cc3ee7 Update VMSC build dependencies. VMSC is now dependant on libVirt_HostSystem.la since it calls get_host_cs(). Add la_DEPENDENCIES and la_LIBADD entries accordingly. Signed-off-by: Kaitlin Rupert <karupert@us.ibm.com> diff -r f849a60bc19b -r e06948021a3a src/Makefile.am --- a/src/Makefile.am Thu Nov 29 13:13:11 2007 -0800 +++ b/src/Makefile.am Thu Nov 29 13:32:40 2007 -0800 @@ -63,7 +63,9 @@ libVirt_VirtualSystemManagementService_l libVirt_VirtualSystemManagementService_la_SOURCES = Virt_VirtualSystemManagementService.c libVirt_VirtualSystemManagementService_la_LIBADD = -lVirt_ComputerSystem -lVirt_ComputerSystemIndication -lVirt_RASD -lVirt_HostSystem +libVirt_VirtualSystemManagementCapabilities_la_DEPENDENCIES = libVirt_HostSystem.la libVirt_VirtualSystemManagementCapabilities_la_SOURCES = Virt_VirtualSystemManagementCapabilities.c +libVirt_VirtualSystemManagementCapabilities_la_LIBADD = -lVirt_HostSystem libVirt_SystemDevice_la_DEPENDENCIES = libVirt_ComputerSystem.la libVirt_Device.la libVirt_SystemDevice_la_SOURCES = Virt_SystemDevice.c

# HG changeset patch # User Kaitlin Rupert <karupert@us.ibm.com> # Date 1196371985 28800 # Node ID 482e5682c55119293991c361bd861b0edca0ab07 # Parent e06948021a3a7eea119332b2fe4d773c0d748ffa 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 e06948021a3a -r 482e5682c551 src/Virt_ElementCapabilities.c --- a/src/Virt_ElementCapabilities.c Thu Nov 29 13:32:40 2007 -0800 +++ b/src/Virt_ElementCapabilities.c Thu Nov 29 13:33:05 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