[PATCH 0 of 2] Fix NULL attributes returned by VSMigrationService.

Get the values for the SystemName and SystemCreationClassName from the host instance and set accordingly.

# HG changeset patch # User Kaitlin Rupert <karupert@us.ibm.com> # Date 1197681878 28800 # Node ID 5339f01a786a287ed6f2c49b47704fd99db6432a # Parent 72b93a4339e1c13080d6a6d80a580a7742c0b851 Fix VSMigrationService NULL key attributes. The SystemCreationClassName and SystemName keys are NULL, these should be set. Signed-off-by: Kaitlin Rupert <karupert@us.ibm.com> diff -r 72b93a4339e1 -r 5339f01a786a src/Virt_VSMigrationService.c --- a/src/Virt_VSMigrationService.c Fri Dec 14 10:37:01 2007 +0100 +++ b/src/Virt_VSMigrationService.c Fri Dec 14 17:24:38 2007 -0800 @@ -36,6 +36,7 @@ #include <libcmpiutil/std_invokemethod.h> #include "Virt_VSMigrationService.h" +#include "Virt_HostSystem.h" #define CIM_JOBSTATE_STARTING 3 #define CIM_JOBSTATE_RUNNING 4 @@ -639,6 +640,12 @@ CMPIStatus get_migration_service(const C { CMPIInstance *inst; CMPIStatus s = {CMPI_RC_OK, NULL}; + CMPIInstance *host = NULL; + const char *val = NULL; + + s = get_host_cs(broker, ref, &host); + if (s.rc != CMPI_RC_OK) + goto out; inst = get_typed_instance(broker, CLASSNAME(ref), @@ -654,8 +661,30 @@ CMPIStatus get_migration_service(const C CMSetProperty(inst, "Name", (CMPIValue *)"MigrationService", CMPI_chars); + if (cu_get_str_prop(host, "Name", &val) != CMPI_RC_OK) { + cu_statusf(broker, &s, + CMPI_RC_ERR_FAILED, + "Unable to get name of HostSystem"); + goto out; + } + + CMSetProperty(inst, "SystemName", + (CMPIValue *)val, CMPI_chars); + + if (cu_get_str_prop(host, "CreationClassName", &val) != CMPI_RC_OK) { + cu_statusf(broker, &s, + CMPI_RC_ERR_FAILED, + "Unable to get creation class of HostSystem"); + goto out; + } + + CMSetProperty(inst, "SystemCreationClassName", + (CMPIValue *)val, CMPI_chars); + + *_inst = inst; + out: return s; }

Kaitlin Rupert wrote:
# HG changeset patch # User Kaitlin Rupert <karupert@us.ibm.com> # Date 1197681878 28800 # Node ID 5339f01a786a287ed6f2c49b47704fd99db6432a # Parent 72b93a4339e1c13080d6a6d80a580a7742c0b851 Fix VSMigrationService NULL key attributes.
The SystemCreationClassName and SystemName keys are NULL, these should be set.
VirtualSystemMigrationSerive and VSMigrationService both need to get the values for these attributes in the same way. It would be possible to lump this bit of code into a function in Virt_HostSystem, but it's unlikely that the implementation specific host provider will offer such a function (since Virt_HostSystem is acting as a placeholder). Thoughts? -- Kaitlin Rupert IBM Linux Technology Center karupert@us.ibm.com

KR> VirtualSystemMigrationSerive and VSMigrationService both need to KR> get the values for these attributes in the same way. It would be KR> possible to lump this bit of code into a function in KR> Virt_HostSystem, but it's unlikely that the implementation KR> specific host provider will offer such a function (since KR> Virt_HostSystem is acting as a placeholder). My plan was never to remove the placeholder, but rather to modify the placeholder with logic to look up and return the proper host system. This would give us a control point for switching between host instrumentation, with the option to keep our fake one if nothing else is available. Adding such a function seems like a good idea to me, and as long as it uses the existing internal logic in HostSystem to get the information, it shouldn't need to change later. Shall I hold off on this set or apply and let you add the generalized function first? Thanks! -- 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 1197770616 28800 # Node ID b94dd9cf174968ecd58eeba26e37fc1a06dbdc4f # Parent 5339f01a786a287ed6f2c49b47704fd99db6432a Add libVirt_HostSystem to VSMigrationService build. Signed-off-by: Kaitlin Rupert <karupert@us.ibm.com> diff -r 5339f01a786a -r b94dd9cf1749 src/Makefile.am --- a/src/Makefile.am Fri Dec 14 17:24:38 2007 -0800 +++ b/src/Makefile.am Sat Dec 15 18:03:36 2007 -0800 @@ -146,4 +146,6 @@ libVirt_ElementSettingData_la_LIBADD = - libVirt_VSMigrationCapabilities_la_SOURCES = Virt_VSMigrationCapabilities.c -libVirt_VSMigrationService_la_SOURCES = Virt_VSMigrationService.c \ No newline at end of file +libVirt_VSMigrationService_la_DEPENDENCIES = libVirt_HostSystem.la +libVirt_VSMigrationService_la_SOURCES = Virt_VSMigrationService.c +libVirt_VSMigrationService_la_LIBADD = -lVirt_HostSystem

Kaitlin Rupert wrote:
# HG changeset patch # User Kaitlin Rupert <karupert@us.ibm.com> # Date 1197770616 28800 # Node ID b94dd9cf174968ecd58eeba26e37fc1a06dbdc4f # Parent 5339f01a786a287ed6f2c49b47704fd99db6432a Add libVirt_HostSystem to VSMigrationService build.
Signed-off-by: Kaitlin Rupert <karupert@us.ibm.com>
diff -r 5339f01a786a -r b94dd9cf1749 src/Makefile.am --- a/src/Makefile.am Fri Dec 14 17:24:38 2007 -0800 +++ b/src/Makefile.am Sat Dec 15 18:03:36 2007 -0800 @@ -146,4 +146,6 @@ libVirt_ElementSettingData_la_LIBADD = -
libVirt_VSMigrationCapabilities_la_SOURCES = Virt_VSMigrationCapabilities.c
-libVirt_VSMigrationService_la_SOURCES = Virt_VSMigrationService.c \ No newline at end of file +libVirt_VSMigrationService_la_DEPENDENCIES = libVirt_HostSystem.la +libVirt_VSMigrationService_la_SOURCES = Virt_VSMigrationService.c +libVirt_VSMigrationService_la_LIBADD = -lVirt_HostSystem
Applying this patch crashes, if "[PATCH 3 of 3] AC no longer needs libVirt_RASD" was applied before. I suppose the reason is that the "\ No newline at end of file" was already fixed by the patch before. -- Regards Heidi Eckhart Software Engineer Linux Technology Center - Open Hypervisor heidieck@linux.vnet.ibm.com ************************************************** IBM Deutschland Entwicklung GmbH Vorsitzender des Aufsichtsrats: Martin Jetter Geschaeftsfuehrung: Herbert Kircher Sitz der Gesellschaft: Boeblingen Registergericht: Amtsgericht Stuttgart, HRB 243294

Kaitlin Rupert wrote:
Get the values for the SystemName and SystemCreationClassName from the host instance and set accordingly.
Besides the minor problem with applying the changes to the makefile, this works perfectly for me. Great work :). +1 -- Regards Heidi Eckhart Software Engineer Linux Technology Center - Open Hypervisor heidieck@linux.vnet.ibm.com ************************************************** IBM Deutschland Entwicklung GmbH Vorsitzender des Aufsichtsrats: Martin Jetter Geschaeftsfuehrung: Herbert Kircher Sitz der Gesellschaft: Boeblingen Registergericht: Amtsgericht Stuttgart, HRB 243294
participants (3)
-
Dan Smith
-
Heidi Eckhart
-
Kaitlin Rupert