Blob Blame History Raw
From d9414e36cc8e23f938ce10260c6a2a7e68c72739 Mon Sep 17 00:00:00 2001
From: Xu Wang <gesaint@linux.vnet.ibm.com>
Date: Mon, 3 Mar 2014 09:04:18 +0800
Subject: [PATCH 48/60] Add rawio property support

Add the 'rawio' property to the DiskRASD and parse/save it properly

Once installed on the target system, use:

wbemcli gcd http://root:password@localhost:5988/root/virt:KVM_DiskResourceAllocationSettingData | grep rawio

to determine if property exists in MOF. Using 'wbemcli ei' will determine
whether or not it shows up in the enumarated instance(s) - if there are
any on the system

Signed-off-by: Xu Wang <gesaint@linux.vnet.ibm.com>
Signed-off-by: John Ferlan <jferlan@redhat.com>
---
 libxkutil/device_parsing.c                | 4 ++++
 libxkutil/device_parsing.h                | 1 +
 libxkutil/xmlgen.c                        | 2 ++
 schema/ResourceAllocationSettingData.mof  | 3 +++
 src/Virt_RASD.c                           | 6 ++++++
 src/Virt_VirtualSystemManagementService.c | 5 +++++
 6 files changed, 21 insertions(+)

diff --git a/libxkutil/device_parsing.c b/libxkutil/device_parsing.c
index c9ae886..6b29a2d 100644
--- a/libxkutil/device_parsing.c
+++ b/libxkutil/device_parsing.c
@@ -92,6 +92,7 @@ static void cleanup_disk_device(struct disk_device *dev)
         free(dev->source);
         free(dev->virtual_dev);
         free(dev->bus_type);
+        free(dev->rawio);
         free(dev->access_mode);
         cleanup_device_address(&dev->address);
 }
@@ -512,6 +513,8 @@ static int parse_block_device(xmlNode *dnode, struct virt_device **vdevs)
         if (ddev->device == NULL)
                 goto err;
 
+        ddev->rawio = get_attr_value(dnode, "rawio");
+
         for (child = dnode->children; child != NULL; child = child->next) {
                 if (XSTREQ(child->name, "driver")) {
                         ddev->driver = get_attr_value(child, "name");
@@ -1315,6 +1318,7 @@ struct virt_device *virt_device_dup(struct virt_device *_dev)
                 DUP_FIELD(dev, _dev, dev.disk.device);
                 DUP_FIELD(dev, _dev, dev.disk.driver);
                 DUP_FIELD(dev, _dev, dev.disk.driver_type);
+                DUP_FIELD(dev, _dev, dev.disk.rawio);
                 DUP_FIELD(dev, _dev, dev.disk.cache);
                 DUP_FIELD(dev, _dev, dev.disk.source);
                 DUP_FIELD(dev, _dev, dev.disk.virtual_dev);
diff --git a/libxkutil/device_parsing.h b/libxkutil/device_parsing.h
index 92427c1..a8cf7aa 100644
--- a/libxkutil/device_parsing.h
+++ b/libxkutil/device_parsing.h
@@ -56,6 +56,7 @@ struct disk_device {
         char *driver_type;
         char *source;
         char *virtual_dev;
+        char *rawio;
         enum {DISK_UNKNOWN, DISK_PHY, DISK_FILE, DISK_FS} disk_type;
         bool readonly;
         bool shareable;
diff --git a/libxkutil/xmlgen.c b/libxkutil/xmlgen.c
index 931f0c9..2f0f475 100644
--- a/libxkutil/xmlgen.c
+++ b/libxkutil/xmlgen.c
@@ -212,6 +212,8 @@ static char *disk_block_xml(xmlNodePtr root, struct disk_device *dev)
         xmlNewProp(disk, BAD_CAST "type", BAD_CAST "block");
         if (dev->device)
                 xmlNewProp(disk, BAD_CAST "device", BAD_CAST dev->device);
+        if (dev->rawio)
+                xmlNewProp(disk, BAD_CAST "rawio", BAD_CAST dev->rawio);
 
         if (dev->driver) {
                 tmp = xmlNewChild(disk, NULL, BAD_CAST "driver", NULL);
diff --git a/schema/ResourceAllocationSettingData.mof b/schema/ResourceAllocationSettingData.mof
index bf1fbb6..5228f4b 100644
--- a/schema/ResourceAllocationSettingData.mof
+++ b/schema/ResourceAllocationSettingData.mof
@@ -65,6 +65,9 @@ class KVM_DiskResourceAllocationSettingData : KVM_ResourceAllocationSettingData
       [Description ("filesystem access mode")]
       string AccessMode;
 
+      [Description ("rawio value of lun device")]
+      string rawio;
+
       [Description ("if device is shareable")]
       boolean shareable;
 
diff --git a/src/Virt_RASD.c b/src/Virt_RASD.c
index df1e921..0800311 100644
--- a/src/Virt_RASD.c
+++ b/src/Virt_RASD.c
@@ -482,6 +482,12 @@ static CMPIStatus set_disk_rasd_params(const CMPIBroker *broker,
                               (CMPIValue *)dev->dev.disk.access_mode,
                               CMPI_chars);
 
+        if(dev->dev.disk.rawio)
+                CMSetProperty(inst,
+                              "rawio",
+                              (CMPIValue *)dev->dev.disk.rawio,
+                              CMPI_chars);
+
         if(dev->dev.disk.shareable)
                 CMSetProperty(inst,
                               "shareable",
diff --git a/src/Virt_VirtualSystemManagementService.c b/src/Virt_VirtualSystemManagementService.c
index 3e7785e..a9f7ae0 100644
--- a/src/Virt_VirtualSystemManagementService.c
+++ b/src/Virt_VirtualSystemManagementService.c
@@ -1184,6 +1184,11 @@ static const char *disk_rasd_to_vdev(CMPIInstance *inst,
         else 
                 dev->dev.disk.access_mode = strdup(val);
 
+        if (cu_get_str_prop(inst, "rawio", &val) != CMPI_RC_OK)
+                dev->dev.disk.rawio = NULL;
+        else
+                dev->dev.disk.rawio = strdup(val);
+
         if (cu_get_bool_prop(inst, "shareable", &shareable) != CMPI_RC_OK)
                 dev->dev.disk.shareable = false;
         else
-- 
2.1.0