[PATCH 0/2] Add rawio/sgio tag property support

They are needed by virtio-scsi so add them into libvirt-cim support Xu Wang (2): Add rawio property support Add sgio property support libxkutil/device_parsing.c | 8 ++++++++ libxkutil/device_parsing.h | 2 ++ libxkutil/xmlgen.c | 4 ++++ schema/ResourceAllocationSettingData.mof | 6 ++++++ src/Virt_RASD.c | 12 ++++++++++++ src/Virt_VirtualSystemManagementService.c | 10 ++++++++++ 6 files changed, 42 insertions(+), 0 deletions(-)

Signed-off-by: Xu Wang <gesaint@linux.vnet.ibm.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(+), 0 deletions(-) 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 -- 1.7.1

Signed-off-by: Xu Wang <gesaint@linux.vnet.ibm.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(+), 0 deletions(-) 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 -- 1.7.1

On 03/02/2014 08:04 PM, Xu Wang wrote:
They are needed by virtio-scsi so add them into libvirt-cim support
Xu Wang (2): Add rawio property support Add sgio property support
libxkutil/device_parsing.c | 8 ++++++++ libxkutil/device_parsing.h | 2 ++ libxkutil/xmlgen.c | 4 ++++ schema/ResourceAllocationSettingData.mof | 6 ++++++ src/Virt_RASD.c | 12 ++++++++++++ src/Virt_VirtualSystemManagementService.c | 10 ++++++++++ 6 files changed, 42 insertions(+), 0 deletions(-)
These look OK, but the existing cimtest had some new failures; however, I believe that those failures had to do with me running the latest git head and there is a new device to deal with (sigh), see: http://www.redhat.com/archives/libvir-list/2014-February/msg01058.html Although I'm OK with the changes - I would like to see a test to verify that this works. Whether that's a cimtest or even adjusting the checkin message to add new files and/or scripts to validate. I have to assume this is desired to be backported into RHEL6.next at some point. In order to do that - I really need a test. John

On 03/02/2014 08:04 PM, Xu Wang wrote:
They are needed by virtio-scsi so add them into libvirt-cim support
Xu Wang (2): Add rawio property support Add sgio property support
libxkutil/device_parsing.c | 8 ++++++++ libxkutil/device_parsing.h | 2 ++ libxkutil/xmlgen.c | 4 ++++ schema/ResourceAllocationSettingData.mof | 6 ++++++ src/Virt_RASD.c | 12 ++++++++++++ src/Virt_VirtualSystemManagementService.c | 10 ++++++++++ 6 files changed, 42 insertions(+), 0 deletions(-)
As an "update" - I ran these changes using my adjusted cimtest and had no new regressions. I have pushed them, so that we can make forward progress. If these are requested to be backported into a RHEL6 release, then the BZ that gets opened needs to have a test associated with it - more than a dump of the mof via: # wbemcli gcd http://root:password@localhost:5988/root/virt:KVM_DiskResourceAllocationSett... | egrep "rawio|sgio" <PROPERTY NAME="rawio" TYPE="string"> <PROPERTY NAME="sgio" TYPE="string"> (or wbemcli ei) I did update the commit message in order to include the command Tks, John
participants (2)
-
John Ferlan
-
Xu Wang