[Libvirt-cim] [PATCH 2 of 2] Make ProcRASD properly reflect the number of VCPUs a domain currently has,

Dan Smith danms at us.ibm.com
Tue Oct 28 15:28:17 UTC 2008


# HG changeset patch
# User Dan Smith <danms at us.ibm.com>
# Date 1225207665 25200
# Node ID 2df4433a10600aee5a8ed0aae0c1ded96a3e4d0f
# Parent  819ae6c97a071eb28c56719a8bb29bf584664556
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 at us.ibm.com>

diff -r 819ae6c97a07 -r 2df4433a1060 src/Virt_RASD.c
--- a/src/Virt_RASD.c	Tue Oct 28 08:22:04 2008 -0700
+++ b/src/Virt_RASD.c	Tue Oct 28 08:27:45 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 */




More information about the Libvirt-cim mailing list