Add API support for dumpCore field of Memory devices.
Signed-off-by: Xu Wang <gesaint(a)linux.vnet.ibm.com>
---
libxkutil/device_parsing.c | 1 +
schema/ResourceAllocationSettingData.mof | 3 +++
src/Virt_RASD.c | 8 ++++++++
src/Virt_VirtualSystemManagementService.c | 11 +++++++++++
4 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/libxkutil/device_parsing.c b/libxkutil/device_parsing.c
index f863cc5..d654a6a 100644
--- a/libxkutil/device_parsing.c
+++ b/libxkutil/device_parsing.c
@@ -1438,6 +1438,7 @@ struct virt_device *virt_device_dup(struct virt_device *_dev)
} 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.dumpCore = _dev->dev.mem.dumpCore;
} else if (dev->type == CIM_RES_TYPE_PROC) {
dev->dev.vcpu.quantity = _dev->dev.vcpu.quantity;
} else if (dev->type == CIM_RES_TYPE_EMU) {
diff --git a/schema/ResourceAllocationSettingData.mof
b/schema/ResourceAllocationSettingData.mof
index 9c387f0..11a444f 100644
--- a/schema/ResourceAllocationSettingData.mof
+++ b/schema/ResourceAllocationSettingData.mof
@@ -229,6 +229,9 @@ class Xen_MemResourceAllocationSettingData :
Xen_ResourceAllocationSettingData
]
class KVM_MemResourceAllocationSettingData : KVM_ResourceAllocationSettingData
{
+ [Description ("dumpCore could be set as 'on' or 'off'. "
+ "it also could be leave null.")]
+ boolean dumpCore;
};
[Description ("LXC virtual memory"),
diff --git a/src/Virt_RASD.c b/src/Virt_RASD.c
index 3c62c2d..691fff9 100644
--- a/src/Virt_RASD.c
+++ b/src/Virt_RASD.c
@@ -1044,6 +1044,14 @@ CMPIInstance *rasd_from_vdev(const CMPIBroker *broker,
(CMPIValue *)&dev->dev.mem.size, CMPI_uint64);
CMSetProperty(inst, "Limit",
(CMPIValue *)&dev->dev.mem.maxsize, CMPI_uint64);
+
+ if (dev->dev.mem.dumpCore != MEM_DUMP_CORE_NOT_SET) {
+ bool dumpCore = true;
+ if (dev->dev.mem.dumpCore == MEM_DUMP_CORE_OFF)
+ dumpCore = false;
+ CMSetProperty(inst, "dumpCore",
+ (CMPIValue *)&dumpCore, CMPI_boolean);
+ }
} else if (dev->type == CIM_RES_TYPE_PROC) {
set_proc_rasd_params(broker, ref, dev, host, inst);
} else if (dev->type == CIM_RES_TYPE_GRAPHICS) {
diff --git a/src/Virt_VirtualSystemManagementService.c
b/src/Virt_VirtualSystemManagementService.c
index f673c38..f228a73 100644
--- a/src/Virt_VirtualSystemManagementService.c
+++ b/src/Virt_VirtualSystemManagementService.c
@@ -1236,6 +1236,17 @@ static const char *mem_rasd_to_vdev(CMPIInstance *inst,
const char *units;
CMPIrc ret;
int shift;
+ bool dumpCore;
+
+ ret = cu_get_bool_prop(inst, "dumpCore", &dumpCore);
+ if (ret != CMPI_RC_OK) {
+ dev->dev.mem.dumpCore = MEM_DUMP_CORE_NOT_SET;
+ } else {
+ if (dumpCore)
+ dev->dev.mem.dumpCore = MEM_DUMP_CORE_ON;
+ else
+ dev->dev.mem.dumpCore = MEM_DUMP_CORE_OFF;
+ }
ret = cu_get_u64_prop(inst, "VirtualQuantity",
&dev->dev.mem.size);
if (ret != CMPI_RC_OK)
--
1.7.1