File proc-rasd.patch of Package libvirt-cim
Index: libvirt-cim-0.5.2/src/Virt_RASD.c
===================================================================
--- libvirt-cim-0.5.2.orig/src/Virt_RASD.c
+++ libvirt-cim-0.5.2/src/Virt_RASD.c
@@ -96,6 +96,7 @@ char *rasd_to_xml(CMPIInstance *rasd)
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 @@ static CMPIStatus set_proc_rasd_params(c
struct infostore_ctx *info;
uint32_t weight;
uint64_t limit;
+ uint64_t count;
conn = connect_by_classname(broker, CLASSNAME(ref), &s);
if (conn == NULL)
@@ -118,6 +120,17 @@ static CMPIStatus set_proc_rasd_params(c
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) {
cu_statusf(broker, &s,
@@ -306,14 +319,7 @@ static CMPIInstance *rasd_from_vdev(cons
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 */