[PATCH 0 of 2] Fix up VirtualSystemType-related bits

The VirtualSystemType field of a ComputerSystem must match one of the entries in the associated VSMCapabilities object's VirtualSystemTypesSupported field.

# HG changeset patch # User Dan Smith <danms@us.ibm.com> # Date 1205868352 25200 # Node ID 05e2ef48609226150b605477015207d0ae59a758 # Parent 4c26cc6ccb4f239d97ebfadd6f3913b54f52c9cd Fix TypesSupported in VSMC Signed-off-by: Dan Smith <danms@us.ibm.com> diff -r 4c26cc6ccb4f -r 05e2ef486092 src/Virt_VirtualSystemManagementCapabilities.c --- a/src/Virt_VirtualSystemManagementCapabilities.c Mon Mar 17 13:23:15 2008 -0700 +++ b/src/Virt_VirtualSystemManagementCapabilities.c Tue Mar 18 12:25:52 2008 -0700 @@ -93,7 +93,7 @@ static CMPIStatus set_inst_properties(co CMSetArrayElementAt(array, 0, (CMPIValue *)&str, CMPI_string); - CMSetProperty(inst, "TypesSupported", + CMSetProperty(inst, "VirtualSystemTypesSupported", (CMPIValue *)&array, CMPI_stringA); out:

# HG changeset patch # User Dan Smith <danms@us.ibm.com> # Date 1205869429 25200 # Node ID 4fc9937235ebb9b789f411949a78a007339c46e1 # Parent 05e2ef48609226150b605477015207d0ae59a758 Add VirtualSystemType to ComputerSystem Signed-off-by: Dan Smith <danms@us.ibm.com> diff -r 05e2ef486092 -r 4fc9937235eb src/Virt_ComputerSystem.c --- a/src/Virt_ComputerSystem.c Tue Mar 18 12:25:52 2008 -0700 +++ b/src/Virt_ComputerSystem.c Tue Mar 18 12:43:49 2008 -0700 @@ -301,6 +301,35 @@ static int set_other_id_info(const CMPIB return 1; } +static bool set_type(CMPIInstance *instance) +{ + CMPIObjectPath *op; + CMPIStatus s; + char *prefix = NULL; + bool rc = false; + + op = CMGetObjectPath(instance, &s); + if ((s.rc != CMPI_RC_OK) || (op == NULL)) { + CU_DEBUG("Failed to get OP from CS instance to set type"); + goto out; + } + + prefix = class_prefix_name(CLASSNAME(op)); + if (prefix == NULL) { + CU_DEBUG("Unknown prefix for class: %s", CLASSNAME(op)); + goto out; + } + + CMSetProperty(instance, "VirtualSystemType", + prefix, CMPI_chars); + + rc = true; + out: + free(prefix); + + return rc; +} + /* Populate an instance with information from a domain */ static CMPIStatus set_properties(const CMPIBroker *broker, virDomainPtr dom, @@ -337,6 +366,10 @@ static CMPIStatus set_properties(const C if (!set_other_id_info(broker, uuid, prefix, instance)) { /* Print trace error */ + goto out; + } + + if (!set_type(instance)) { goto out; }
participants (2)
-
Dan Smith
-
Jay Gagnon