Blame SOURCES/libvirt-cim-0.6.3-43ea7135.patch

c55d09
From 43ea7135654413b50601612ab0ab18cd8c47d84c Mon Sep 17 00:00:00 2001
c55d09
From: Xu Wang <gesaint@linux.vnet.ibm.com>
c55d09
Date: Mon, 26 May 2014 17:00:35 +0800
c55d09
Subject: [PATCH 60/60] Complete the support for dumpCore
c55d09
c55d09
Add API support for dumpCore field of Memory devices and fix issue in
c55d09
parse_mem_device() when parsing dumpCore field.
c55d09
c55d09
Signed-off-by: Xu Wang <gesaint@linux.vnet.ibm.com>
c55d09
Signed-off-by: John Ferlan <jferlan@redhat.com>
c55d09
---
c55d09
 libxkutil/device_parsing.c                |  5 +++--
c55d09
 schema/ResourceAllocationSettingData.mof  |  3 +++
c55d09
 src/Virt_RASD.c                           |  8 ++++++++
c55d09
 src/Virt_VirtualSystemManagementService.c | 11 +++++++++++
c55d09
 4 files changed, 25 insertions(+), 2 deletions(-)
c55d09
c55d09
diff --git a/libxkutil/device_parsing.c b/libxkutil/device_parsing.c
c55d09
index f863cc5..815feea 100644
c55d09
--- a/libxkutil/device_parsing.c
c55d09
+++ b/libxkutil/device_parsing.c
c55d09
@@ -850,9 +850,9 @@ static int parse_mem_device(xmlNode *node, struct virt_device **vdevs)
c55d09
         else if (XSTREQ(node->name, "memory")) {
c55d09
                 sscanf(content, "%" PRIu64, &mdev->maxsize);
c55d09
                 tmpval = get_attr_value(node, "dumpCore");
c55d09
-                if (tmpval && XSTREQ(tmpval, "on")) {
c55d09
+                if (tmpval && STREQC(tmpval, "on")) {
c55d09
                     mdev->dumpCore = MEM_DUMP_CORE_ON;
c55d09
-                } else if (tmpval && XSTREQ(content, "off")) {
c55d09
+                } else if (tmpval && STREQC(tmpval, "off")) {
c55d09
                     mdev->dumpCore = MEM_DUMP_CORE_OFF;
c55d09
                 } else {
c55d09
                     mdev->dumpCore = MEM_DUMP_CORE_NOT_SET;
c55d09
@@ -1438,6 +1438,7 @@ struct virt_device *virt_device_dup(struct virt_device *_dev)
c55d09
         } else if (dev->type == CIM_RES_TYPE_MEM) {
c55d09
                 dev->dev.mem.size = _dev->dev.mem.size;
c55d09
                 dev->dev.mem.maxsize = _dev->dev.mem.maxsize;
c55d09
+                dev->dev.mem.dumpCore = _dev->dev.mem.dumpCore;
c55d09
         } else if (dev->type == CIM_RES_TYPE_PROC) {
c55d09
                 dev->dev.vcpu.quantity = _dev->dev.vcpu.quantity;
c55d09
         } else if (dev->type == CIM_RES_TYPE_EMU) {
c55d09
diff --git a/schema/ResourceAllocationSettingData.mof b/schema/ResourceAllocationSettingData.mof
c55d09
index f78d423..ba57b55 100644
c55d09
--- a/schema/ResourceAllocationSettingData.mof
c55d09
+++ b/schema/ResourceAllocationSettingData.mof
c55d09
@@ -229,6 +229,9 @@ class Xen_MemResourceAllocationSettingData : Xen_ResourceAllocationSettingData
c55d09
 ]
c55d09
 class KVM_MemResourceAllocationSettingData : KVM_ResourceAllocationSettingData
c55d09
 {
c55d09
+      [Description ("dumpCore could be set as 'on' or 'off'. "
c55d09
+                    "it also could be leave null.")]
c55d09
+      boolean dumpCore;
c55d09
 };
c55d09
 
c55d09
 [Description ("LXC virtual memory"),
c55d09
diff --git a/src/Virt_RASD.c b/src/Virt_RASD.c
c55d09
index 761d053..9a028bd 100644
c55d09
--- a/src/Virt_RASD.c
c55d09
+++ b/src/Virt_RASD.c
c55d09
@@ -1047,6 +1047,14 @@ CMPIInstance *rasd_from_vdev(const CMPIBroker *broker,
c55d09
                               (CMPIValue *)&dev->dev.mem.size, CMPI_uint64);
c55d09
                 CMSetProperty(inst, "Limit",
c55d09
                               (CMPIValue *)&dev->dev.mem.maxsize, CMPI_uint64);
c55d09
+
c55d09
+                if (dev->dev.mem.dumpCore != MEM_DUMP_CORE_NOT_SET) {
c55d09
+                        bool dumpCore = true;
c55d09
+                        if (dev->dev.mem.dumpCore == MEM_DUMP_CORE_OFF)
c55d09
+                                dumpCore = false;
c55d09
+                        CMSetProperty(inst, "dumpCore",
c55d09
+                                      (CMPIValue *)&dumpCore, CMPI_boolean);
c55d09
+                }
c55d09
         } else if (dev->type == CIM_RES_TYPE_PROC) {
c55d09
                 set_proc_rasd_params(broker, ref, dev, host, inst);
c55d09
         } else if (dev->type == CIM_RES_TYPE_GRAPHICS) {
c55d09
diff --git a/src/Virt_VirtualSystemManagementService.c b/src/Virt_VirtualSystemManagementService.c
c55d09
index c640360..bf96afe 100644
c55d09
--- a/src/Virt_VirtualSystemManagementService.c
c55d09
+++ b/src/Virt_VirtualSystemManagementService.c
c55d09
@@ -1239,6 +1239,17 @@ static const char *mem_rasd_to_vdev(CMPIInstance *inst,
c55d09
         const char *units;
c55d09
         CMPIrc ret;
c55d09
         int shift;
c55d09
+        bool dumpCore;
c55d09
+
c55d09
+        ret = cu_get_bool_prop(inst, "dumpCore", &dumpCore);
c55d09
+        if (ret != CMPI_RC_OK) {
c55d09
+                dev->dev.mem.dumpCore = MEM_DUMP_CORE_NOT_SET;
c55d09
+        } else {
c55d09
+                if (dumpCore)
c55d09
+                        dev->dev.mem.dumpCore = MEM_DUMP_CORE_ON;
c55d09
+                else
c55d09
+                        dev->dev.mem.dumpCore = MEM_DUMP_CORE_OFF;
c55d09
+        }
c55d09
 
c55d09
         ret = cu_get_u64_prop(inst, "VirtualQuantity", &dev->dev.mem.size);
c55d09
         if (ret != CMPI_RC_OK)
c55d09
-- 
c55d09
2.1.0
c55d09