# HG changeset patch
# User Dan Smith <danms(a)us.ibm.com>
# Date 1225145383 25200
# Node ID 7bcc5c38cca4093f70ed50601b45c67cf1a0085a
# Parent 10bd66c67a6ad4eebe6a0f8dc81db2b4912d5650
Make ProcRASD properly reflect the number of VCPUs a domain currently has,
instead of just the number that the libvirt XML definition claims. Since
Xen doesn't always honor vcpu add/remove actions, this is required to make
sure we're reflecting the state of the system when a domain is running.
Signed-off-by: Dan Smith <danms(a)us.ibm.com>
diff -r 10bd66c67a6a -r 7bcc5c38cca4 src/Virt_RASD.c
--- a/src/Virt_RASD.c Mon Oct 27 15:06:37 2008 -0700
+++ b/src/Virt_RASD.c Mon Oct 27 15:09:43 2008 -0700
@@ -96,6 +96,7 @@
static CMPIStatus set_proc_rasd_params(const CMPIBroker *broker,
const CMPIObjectPath *ref,
+ struct virt_device *dev,
const char *domain,
CMPIInstance *inst)
{
@@ -105,6 +106,7 @@
struct infostore_ctx *info;
uint32_t weight;
uint64_t limit;
+ uint64_t count;
conn = connect_by_classname(broker, CLASSNAME(ref), &s);
if (conn == NULL)
@@ -117,6 +119,17 @@
"Domain `%s' not found while getting info",
domain);
goto out;
}
+
+ if (domain_online(dom))
+ count = domain_vcpu_count(dom);
+ else
+ count = dev->dev.vcpu.quantity;
+
+ if (count > 0)
+ CMSetProperty(inst,
+ "VirtualQuantity",
+ (CMPIValue *)&count,
+ CMPI_uint64);
info = infostore_open(dom);
if (info == NULL) {
@@ -306,14 +319,7 @@
CMSetProperty(inst, "Limit",
(CMPIValue *)&dev->dev.mem.maxsize, CMPI_uint64);
} else if (dev->type == CIM_RES_TYPE_PROC) {
- if (dev->dev.vcpu.quantity > 0) {
- CMSetProperty(inst,
- "VirtualQuantity",
- (CMPIValue *)&dev->dev.vcpu.quantity,
- CMPI_uint64);
- }
-
- set_proc_rasd_params(broker, ref, host, inst);
+ set_proc_rasd_params(broker, ref, dev, host, inst);
}
/* FIXME: Put the HostResource in place */