You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

129 lines
5.1 KiB

From 1a91ecd304d0a9cfb4e2d07c60f134ce8265ea22 Mon Sep 17 00:00:00 2001
From: Xu Wang <gesaint@linux.vnet.ibm.com>
Date: Mon, 3 Mar 2014 09:04:19 +0800
Subject: [PATCH 49/60] Add sgio property support
Add the 'sgio' property to the DiskRASD and parse/save it correctly
Once installed on the target system, use:
wbemcli gcd http://root:password@localhost:5988/root/virt:KVM_DiskResourceAllocationSettingData | grep sgio
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 6b29a2d..d2d3859 100644
--- a/libxkutil/device_parsing.c
+++ b/libxkutil/device_parsing.c
@@ -93,6 +93,7 @@ static void cleanup_disk_device(struct disk_device *dev)
free(dev->virtual_dev);
free(dev->bus_type);
free(dev->rawio);
+ free(dev->sgio);
free(dev->access_mode);
cleanup_device_address(&dev->address);
}
@@ -515,6 +516,8 @@ static int parse_block_device(xmlNode *dnode, struct virt_device **vdevs)
ddev->rawio = get_attr_value(dnode, "rawio");
+ ddev->sgio = get_attr_value(dnode, "sgio");
+
for (child = dnode->children; child != NULL; child = child->next) {
if (XSTREQ(child->name, "driver")) {
ddev->driver = get_attr_value(child, "name");
@@ -1319,6 +1322,7 @@ struct virt_device *virt_device_dup(struct virt_device *_dev)
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.sgio);
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 a8cf7aa..a92e223 100644
--- a/libxkutil/device_parsing.h
+++ b/libxkutil/device_parsing.h
@@ -57,6 +57,7 @@ struct disk_device {
char *source;
char *virtual_dev;
char *rawio;
+ char *sgio;
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 2f0f475..18c4765 100644
--- a/libxkutil/xmlgen.c
+++ b/libxkutil/xmlgen.c
@@ -214,6 +214,8 @@ static char *disk_block_xml(xmlNodePtr root, struct disk_device *dev)
xmlNewProp(disk, BAD_CAST "device", BAD_CAST dev->device);
if (dev->rawio)
xmlNewProp(disk, BAD_CAST "rawio", BAD_CAST dev->rawio);
+ if (dev->sgio)
+ xmlNewProp(disk, BAD_CAST "sgio", BAD_CAST dev->sgio);
if (dev->driver) {
tmp = xmlNewChild(disk, NULL, BAD_CAST "driver", NULL);
diff --git a/schema/ResourceAllocationSettingData.mof b/schema/ResourceAllocationSettingData.mof
index 5228f4b..6b649de 100644
--- a/schema/ResourceAllocationSettingData.mof
+++ b/schema/ResourceAllocationSettingData.mof
@@ -68,6 +68,9 @@ class KVM_DiskResourceAllocationSettingData : KVM_ResourceAllocationSettingData
[Description ("rawio value of lun device")]
string rawio;
+ [Description ("sgio value of lun device")]
+ string sgio;
+
[Description ("if device is shareable")]
boolean shareable;
diff --git a/src/Virt_RASD.c b/src/Virt_RASD.c
index 0800311..abfb09f 100644
--- a/src/Virt_RASD.c
+++ b/src/Virt_RASD.c
@@ -488,6 +488,12 @@ static CMPIStatus set_disk_rasd_params(const CMPIBroker *broker,
(CMPIValue *)dev->dev.disk.rawio,
CMPI_chars);
+ if(dev->dev.disk.sgio)
+ CMSetProperty(inst,
+ "sgio",
+ (CMPIValue *)dev->dev.disk.sgio,
+ CMPI_chars);
+
if(dev->dev.disk.shareable)
CMSetProperty(inst,
"shareable",
diff --git a/src/Virt_VirtualSystemManagementService.c b/src/Virt_VirtualSystemManagementService.c
index a9f7ae0..e146470 100644
--- a/src/Virt_VirtualSystemManagementService.c
+++ b/src/Virt_VirtualSystemManagementService.c
@@ -1189,6 +1189,11 @@ static const char *disk_rasd_to_vdev(CMPIInstance *inst,
else
dev->dev.disk.rawio = strdup(val);
+ if (cu_get_str_prop(inst, "sgio", &val) != CMPI_RC_OK)
+ dev->dev.disk.sgio = NULL;
+ else
+ dev->dev.disk.sgio = strdup(val);
+
if (cu_get_bool_prop(inst, "shareable", &shareable) != CMPI_RC_OK)
dev->dev.disk.shareable = false;
else
--
2.1.0