# HG changeset patch
# User Dan Smith <danms(a)us.ibm.com>
# Date 1205869429 25200
# Node ID 4fc9937235ebb9b789f411949a78a007339c46e1
# Parent 05e2ef48609226150b605477015207d0ae59a758
Add VirtualSystemType to ComputerSystem
Signed-off-by: Dan Smith <danms(a)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;
}