# HG changeset patch
# User Wayne Xia <xiawenc(a)linux.vnet.ibm.com>
# Date 1311231387 -28800
# Node ID d4002b23fffc97fd358811d551abbce28659839b
# Parent dd060dd8dbbd6c1d9a73de4dffa9fb2ab84d62b9
(#2) bugfix: KVM_MemResourceAllocationSettingData does not conform to profile
According to the discuss and profile, the reserved property means the
memory actually allocated to support the VM running, and the unit
should be byte*2^10. This patch added some code to retrieve VM's state,
and the report the memory status according to that.
#2 removed the unit changing to avoid impacting to existing user case.
Signed-off-by: Wayne Xia <xiawenc(a)linux.vnet.ibm.com>
diff -r dd060dd8dbbd -r d4002b23fffc libxkutil/device_parsing.c
--- a/libxkutil/device_parsing.c Thu Aug 04 11:22:32 2011 -0400
+++ b/libxkutil/device_parsing.c Thu Jul 21 14:56:27 2011 +0800
@@ -801,6 +801,7 @@
} else if (dev->type == CIM_RES_TYPE_MEM) {
dev->dev.mem.size = _dev->dev.mem.size;
dev->dev.mem.maxsize = _dev->dev.mem.maxsize;
+ dev->dev.mem.reserved = _dev->dev.mem.reserved;
} else if (dev->type == CIM_RES_TYPE_PROC) {
dev->dev.vcpu.quantity = _dev->dev.vcpu.quantity;
} else if (dev->type == CIM_RES_TYPE_EMU) {
@@ -895,8 +896,22 @@
if (xml == NULL)
return 0;
- if (type == CIM_RES_TYPE_MEM)
+ if (type == CIM_RES_TYPE_MEM) {
ret = _get_mem_device(xml, list);
+ if (*list != NULL) {
+ virDomainInfo dom_info;
+ if (virDomainGetInfo(dom, &dom_info) == 0) {
+ (*list)->dev.mem.reserved = dom_info.memory;
+ if (dom_info.state == 5) { /* VM not active */
+ (*list)->dev.mem.reserved = 0;
+ }
+ }
+ else {
+ CU_DEBUG("failed to get dom state for mem");
+ ret = -1;
+ }
+ }
+ }
else if (type == CIM_RES_TYPE_PROC)
ret = _get_proc_device(xml, list);
else
diff -r dd060dd8dbbd -r d4002b23fffc libxkutil/device_parsing.h
--- a/libxkutil/device_parsing.h Thu Aug 04 11:22:32 2011 -0400
+++ b/libxkutil/device_parsing.h Thu Jul 21 14:56:27 2011 +0800
@@ -72,6 +72,7 @@
struct mem_device {
uint64_t size;
uint64_t maxsize;
+ uint64_t reserved;
};
struct vcpu_device {
diff -r dd060dd8dbbd -r d4002b23fffc src/Virt_RASD.c
--- a/src/Virt_RASD.c Thu Aug 04 11:22:32 2011 -0400
+++ b/src/Virt_RASD.c Thu Jul 21 14:56:27 2011 +0800
@@ -633,7 +633,7 @@
CMSetProperty(inst, "VirtualQuantity",
(CMPIValue *)&dev->dev.mem.size, CMPI_uint64);
CMSetProperty(inst, "Reservation",
- (CMPIValue *)&dev->dev.mem.size, CMPI_uint64);
+ (CMPIValue *)&dev->dev.mem.reserved, CMPI_uint64);
CMSetProperty(inst, "Limit",
(CMPIValue *)&dev->dev.mem.maxsize, CMPI_uint64);
} else if (dev->type == CIM_RES_TYPE_PROC) {
Show replies by date