
# HG changeset patch # User Dan Smith <danms@us.ibm.com> # Date 1223920960 25200 # Node ID 31edd656481f4a328f16102ab9f7b9e24643d687 # 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@us.ibm.com> diff -r f0a209b602e7 -r 31edd656481f src/Virt_VirtualSystemManagementService.c --- a/src/Virt_VirtualSystemManagementService.c Wed Oct 08 09:13:55 2008 -0700 +++ b/src/Virt_VirtualSystemManagementService.c Mon Oct 13 11:02:40 2008 -0700 @@ -522,6 +522,34 @@ return NULL; } +static const char *lxc_proc_rasd_to_vdev(CMPIInstance *inst, + struct virt_device *dev) +{ + CMPIObjectPath *op = NULL; + 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"; + + op = CMGetObjectPath(inst, NULL); + if (op == NULL) { + CU_DEBUG("Unable to determine class of ProcRASD"); + return NULL; + } + + 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 +579,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";