Richard Maciel wrote:
# HG changeset patch
# User Richard Maciel <rmaciel(a)linux.vnet.ibm.com>
# Date 1250185820 10800
# Node ID edde8b4607e96d45d2c784070c84143be4d57fef
# Parent 69ee9e708fe8fb2f5af562fdc412290e30fa41e7
(#3) Add a new OperatingStatus state and map them all to libvirt states
OperatingStatus state added:
STARTED
#2:
Fixed patch submission date
#3:
Previous patches were setting the wrong provider variable (OperationalStatus).
Signed-off-by: Richard Maciel <rmaciel(a)linux.vnet.ibm.com>
diff -r 69ee9e708fe8 -r edde8b4607e9 src/Virt_ComputerSystem.c
--- a/src/Virt_ComputerSystem.c Thu Aug 13 13:51:34 2009 -0300
+++ b/src/Virt_ComputerSystem.c Thu Aug 13 14:50:20 2009 -0300
@@ -187,6 +187,54 @@
}
}
+static uint16_t state_lv_to_cim_oings(const char lv_state, const bool migrating)
+{
+ enum CIM_oping_status {
+ CIM_OPING_STATUS_UNKNOWN = 0,
+ CIM_OPING_STATUS_NOT_AVAILABLE = 1,
+ CIM_OPING_STATUS_SERVICING = 2,
What does SERVICING Mean ?
+ CIM_OPING_STATUS_STARTING = 3,
+ CIM_OPING_STATUS_STOPPING = 4,
Whats the difference between STOPPED and STOPPING ?
+ CIM_OPING_STATUS_STOPPED = 5,
+ CIM_OPING_STATUS_ABORTED = 6,
+ CIM_OPING_STATUS_DORMANT = 7,
+ CIM_OPING_STATUS_COMPLETED = 8,
+ CIM_OPING_STATUS_MIGRATING = 9,
+ CIM_OPING_STATUS_EMIGRATING = 10,
When does the VM go to CIM_OPING_STATUS_EMIGRATING state ?
+ CIM_OPING_STATUS_IMMIGRATING = 11,
When does the VM go to CIM_OPING_STATUS_IMMIGRATING state ?
+ CIM_OPING_STATUS_SNAPSHOTTING = 12,
+ CIM_OPING_STATUS_SHUTTING_DOWN = 13,
+ CIM_OPING_STATUS_IN_TEST = 14,
+ CIM_OPING_STATUS_TRANSITIONING = 15,
Also,CIM_OPING_STATUS_IN_TEST , CIM_OPING_STATUS_TRANSITIONING?
+ CIM_OPING_STATUS_IN_SERVICE = 16,
Which SERVICE does the VM will be in to use the
CIM_OPING_STATUS_IN_SERVICE State ?
+ CIM_OPING_STATUS_STARTED = 32768,
+ };
Not all of these states used as of now in libvirt-cim providers aint ?
+
+
+ if (migrating)
+ return CIM_OPING_STATUS_MIGRATING;
+
+ switch (lv_state) {
+ case VIR_DOMAIN_NOSTATE:
+ case VIR_DOMAIN_SHUTDOWN:
+ case VIR_DOMAIN_SHUTOFF:
+ return CIM_OPING_STATUS_STOPPED;
+
+ case VIR_DOMAIN_CRASHED:
+ return CIM_OPING_STATUS_ABORTED;
+
+ case VIR_DOMAIN_RUNNING:
+ return CIM_OPING_STATUS_STARTED;
+
+ case VIR_DOMAIN_BLOCKED:
+ case VIR_DOMAIN_PAUSED:
+ return CIM_OPING_STATUS_DORMANT;
+
+ default:
+ return CIM_OPING_STATUS_UNKNOWN;
+ }
+}
+
static uint16_t state_lv_to_cim_os(const char lv_state)
{
enum CIM_op_status {
@@ -268,9 +316,11 @@
uint16_t health_state;
uint16_t req_state;
uint16_t op_status;
+ uint16_t oping_status;
CMPIArray *array;
CMPIStatus s;
struct infostore_ctx *infostore = NULL;
+ bool migrating = false;
ret = virDomainGetInfo(dom, &info);
if (ret != 0)
@@ -298,6 +348,14 @@
(CMPIValue *)&array, CMPI_uint16A);
infostore = infostore_open(dom);
+
+ if (infostore != NULL)
+ migrating = infostore_get_bool(infostore, "migrating");
+
+ oping_status = state_lv_to_cim_oings((const int)info.state, migrating);
+ CMSetProperty(instance, "OperatingStatus",
+ (CMPIValue *)&oping_status, CMPI_uint16);
+
if (infostore != NULL)
req_state = (uint16_t)infostore_get_u64(infostore,
"reqstate");
else
_______________________________________________
Libvirt-cim mailing list
Libvirt-cim(a)redhat.com
https://www.redhat.com/mailman/listinfo/libvirt-cim
--
Thanks and Regards,
Deepti B. Kalakeri
IBM Linux Technology Center
deeptik(a)linux.vnet.ibm.com