[Libvirt-cim] [PATCH 1 of 3] Make VSMS honor Weight property of ProcRASD for LXC

Dan Smith danms at us.ibm.com
Tue Oct 14 19:11:31 UTC 2008


# HG changeset patch
# User Dan Smith <danms at us.ibm.com>
# Date 1224011458 25200
# Node ID 96cf38e8a1101ce68965509c9e76f6d7f41516d7
# Parent  f0a209b602e707305a713611097310ec503451df
Make VSMS honor Weight property of ProcRASD for LXC

Also, reject if VirtualQuantity or Limit is specified (for the moment)

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

diff -r f0a209b602e7 -r 96cf38e8a110 src/Virt_VirtualSystemManagementService.c
--- a/src/Virt_VirtualSystemManagementService.c	Wed Oct 08 09:13:55 2008 -0700
+++ b/src/Virt_VirtualSystemManagementService.c	Tue Oct 14 12:10:58 2008 -0700
@@ -522,6 +522,27 @@
         return NULL;
 }
 
+static const char *lxc_proc_rasd_to_vdev(CMPIInstance *inst,
+                                         struct virt_device *dev)
+{
+        CMPIrc rc;
+        uint32_t def_weight = 1024;
+
+        rc = cu_get_u64_prop(inst, "VirtualQuantity", &dev->dev.vcpu.quantity);
+        if (rc == CMPI_RC_OK)
+                return "ProcRASD field VirtualQuantity not valid for LXC";
+
+        rc = cu_get_u64_prop(inst, "Limit", &dev->dev.vcpu.limit);
+        if (rc == CMPI_RC_OK)
+                return "ProcRASD field Limit not valid for LXC";
+
+        rc = cu_get_u32_prop(inst, "Weight", &dev->dev.vcpu.weight);
+        if (rc != CMPI_RC_OK)
+                dev->dev.vcpu.weight = def_weight;
+
+        return NULL;
+}
+
 static const char *_sysvirt_rasd_to_vdev(CMPIInstance *inst,
                                          struct virt_device *dev,
                                          uint16_t type,
@@ -551,6 +572,8 @@
                 return lxc_disk_rasd_to_vdev(inst, dev);
         } else if (type == CIM_RES_TYPE_NET) {
                 return net_rasd_to_vdev(inst, dev, ns);
+        } else if (type == CIM_RES_TYPE_PROC) {
+                return lxc_proc_rasd_to_vdev(inst, dev);
         }
 
         return "Resource type not supported on this platform";




More information about the Libvirt-cim mailing list