[Libvirt-cim] [PATCH 3 of 6] Make ProcRASD expose stored scheduler parameters

Dan Smith danms at us.ibm.com
Wed Jun 18 16:05:56 UTC 2008


# HG changeset patch
# User Dan Smith <danms at us.ibm.com>
# Date 1213804869 25200
# Node ID 05ee6d4b3049b86ab74d1b8121716e2440769316
# Parent  491abbe7867c50c66ce0cd3af41f169bf32dc8fb
Make ProcRASD expose stored scheduler parameters

When we're constructing a ProcRASD, open the infostore for the domain
and read out the weight and limit attributes so they can be set
in the RASD appropriately.

Signed-off-by: Dan Smith <danms at us.ibm.com>

diff -r 491abbe7867c -r 05ee6d4b3049 src/Virt_RASD.c
--- a/src/Virt_RASD.c	Wed Jun 18 09:00:32 2008 -0700
+++ b/src/Virt_RASD.c	Wed Jun 18 09:01:09 2008 -0700
@@ -33,6 +33,7 @@
 
 #include "misc_util.h"
 #include "cs_util.h"
+#include "infostore.h"
 
 #include "Virt_RASD.h"
 #include "svpc_types.h"
@@ -91,6 +92,54 @@
 {
         /* FIXME: Remove this */
         return NULL;
+}
+
+static CMPIStatus set_proc_rasd_params(const CMPIBroker *broker,
+                                       const CMPIObjectPath *ref,
+                                       const char *domain,
+                                       CMPIInstance *inst)
+{
+        CMPIStatus s = {CMPI_RC_OK, NULL};
+        virConnectPtr conn = NULL;
+        virDomainPtr dom = NULL;
+        struct infostore_ctx *info;
+        uint32_t weight;
+        uint64_t limit;
+
+        conn = connect_by_classname(broker, CLASSNAME(ref), &s);
+        if (conn == NULL)
+                return s;
+
+        dom = virDomainLookupByName(conn, domain);
+        if (dom == NULL) {
+                cu_statusf(broker, &s,
+                           CMPI_RC_ERR_NOT_FOUND,
+                           "Domain `%s' not found while getting info", domain);
+                goto out;
+        }
+
+        info = infostore_open(dom);
+        if (info == NULL) {
+                cu_statusf(broker, &s,
+                           CMPI_RC_ERR_FAILED,
+                           "Unable to open domain information store");
+                goto out;
+        }
+
+        weight = (uint32_t)infostore_get_u64(info, "weight");
+        limit = infostore_get_u64(info, "limit");
+
+        CMSetProperty(inst, "Weight",
+                      (CMPIValue *)&weight, CMPI_uint32);
+        CMSetProperty(inst, "Limit",
+                      (CMPIValue *)&limit, CMPI_uint64);
+
+ out:
+        virDomainFree(dom);
+        virConnectClose(conn);
+        infostore_close(info);
+
+        return s;
 }
 
 static CMPIInstance *rasd_from_vdev(const CMPIBroker *broker,
@@ -174,6 +223,7 @@
         } else if (dev->type == CIM_RES_TYPE_PROC) {
                 CMSetProperty(inst, "VirtualQuantity",
                               (CMPIValue *)&dev->dev.vcpu.quantity, CMPI_uint64);
+                set_proc_rasd_params(broker, ref, host, inst);
         }
 
         /* FIXME: Put the HostResource in place */




More information about the Libvirt-cim mailing list