# HG changeset patch
# User Dan Smith <danms(a)us.ibm.com>
# Date 1216390592 25200
# Node ID 18eab14c82590e3a31ec1fa2f789173061ddca97
# Parent ec88dc805bcdc63d30b866e3e527208fa684e274
Persist RequestedState in infostore
This allows the ComputerSystem object to correctly expose the state last
requested in addition to the actual current state.
Signed-off-by: Dan Smith <danms(a)us.ibm.com>
diff -r ec88dc805bcd -r 18eab14c8259 src/Virt_ComputerSystem.c
--- a/src/Virt_ComputerSystem.c Wed Jul 09 13:48:14 2008 -0700
+++ b/src/Virt_ComputerSystem.c Fri Jul 18 07:16:32 2008 -0700
@@ -237,9 +237,11 @@
int ret;
uint16_t cim_state;
uint16_t health_state;
+ uint16_t req_state;
uint16_t op_status;
CMPIArray *array;
CMPIStatus s;
+ struct infostore_ctx *infostore = NULL;
ret = virDomainGetInfo(dom, &info);
if (ret != 0)
@@ -262,6 +264,17 @@
CMSetProperty(instance, "OperationalStatus",
(CMPIValue *)&array, CMPI_uint16A);
+
+ infostore = infostore_open(dom);
+ if (infostore != NULL)
+ req_state = (uint16_t)infostore_get_u64(infostore,
"reqstate");
+ else
+ req_state = CIM_STATE_UNKNOWN;
+
+ CMSetProperty(instance, "RequestedState",
+ (CMPIValue *)&req_state, CMPI_uint16);
+
+ infostore_close(infostore);
return 1;
}
@@ -809,6 +822,7 @@
virConnectPtr conn = NULL;
virDomainPtr dom = NULL;
virDomainInfo info;
+ struct infostore_ctx *infostore = NULL;
conn = connect_by_classname(_BROKER, CLASSNAME(ref), &s);
if (conn == NULL)
@@ -843,6 +857,12 @@
cu_statusf(_BROKER, &s,
CMPI_RC_ERR_NOT_SUPPORTED,
"State not supported");
+
+ infostore = infostore_open(dom);
+ if (infostore != NULL) {
+ infostore_set_u64(infostore, "reqstate", (uint64_t)state);
+ infostore_close(infostore);
+ }
out:
virDomainFree(dom);
Show replies by date
+
+ infostore = infostore_open(dom);
+ if (infostore != NULL) {
+ infostore_set_u64(infostore, "reqstate", (uint64_t)state);
+ infostore_close(infostore);
+ }
Was going to comment that infostore_close() should go outside the if,
but I'd forgotten that infostore_open() cleanups before the return if
the call fails.
I tested this out and it looks good. +1
--
Kaitlin Rupert
IBM Linux Technology Center
kaitlin(a)linux.vnet.ibm.com