[PATCH 0 of 4] Adds disk bus type support for libvirt-cim

# HG changeset patch # User Richard Maciel <rmaciel@linux.vnet.ibm.com> # Date 1244339202 10800 # Node ID 5a873709bd07b283922a09e0ae8c0d6970bea93c # Parent 6107c1026ed44acaf24ce9430a0e6dd2fa97f252 Adds BusType prop to DiskRASD and support for it to the disk structure Signed-off-by: Richard Maciel <rmaciel@linux.vnet.ibm.com> diff -r 6107c1026ed4 -r 5a873709bd07 libxkutil/device_parsing.h --- a/libxkutil/device_parsing.h Mon Jun 01 18:19:42 2009 -0300 +++ b/libxkutil/device_parsing.h Sat Jun 06 22:46:42 2009 -0300 @@ -39,6 +39,7 @@ enum {DISK_UNKNOWN, DISK_PHY, DISK_FILE, DISK_FS} disk_type; bool readonly; bool shareable; + char *bus_type; }; struct net_device { diff -r 6107c1026ed4 -r 5a873709bd07 schema/ResourceAllocationSettingData.mof --- a/schema/ResourceAllocationSettingData.mof Mon Jun 01 18:19:42 2009 -0300 +++ b/schema/ResourceAllocationSettingData.mof Sat Jun 06 22:46:42 2009 -0300 @@ -28,6 +28,9 @@ ValueMap {"0", "1"}, Values {"Disk", "CDROM"}] uint16 EmulatedType; + + [Description ("Bus type of the device")] + string BusType; }; [Description ("LXC virtual disk configuration"),

diff -r 6107c1026ed4 -r 5a873709bd07 schema/ResourceAllocationSettingData.mof --- a/schema/ResourceAllocationSettingData.mof Mon Jun 01 18:19:42 2009 -0300 +++ b/schema/ResourceAllocationSettingData.mof Sat Jun 06 22:46:42 2009 -0300 @@ -28,6 +28,9 @@ ValueMap {"0", "1"}, Values {"Disk", "CDROM"}] uint16 EmulatedType; + + [Description ("Bus type of the device")] + string BusType; };
Xen guests also support the BusType option. -- Kaitlin Rupert IBM Linux Technology Center kaitlin@linux.vnet.ibm.com

Hmmm... I didn't know. The bug specifically targets KVM (see bugzilla description) Kaitlin Rupert wrote:
diff -r 6107c1026ed4 -r 5a873709bd07 schema/ResourceAllocationSettingData.mof --- a/schema/ResourceAllocationSettingData.mof Mon Jun 01 18:19:42 2009 -0300 +++ b/schema/ResourceAllocationSettingData.mof Sat Jun 06 22:46:42 2009 -0300 @@ -28,6 +28,9 @@ ValueMap {"0", "1"}, Values {"Disk", "CDROM"}] uint16 EmulatedType; + + [Description ("Bus type of the device")] + string BusType; };
Xen guests also support the BusType option.
-- Richard Maciel, MSc IBM Linux Technology Center rmaciel@linux.vnet.ibm.com

# HG changeset patch # User Richard Maciel <rmaciel@linux.vnet.ibm.com> # Date 1244339211 10800 # Node ID efdd812a716e949db3c09b54c05fe955cc34fb4a # Parent 5a873709bd07b283922a09e0ae8c0d6970bea93c Added support for BusType prop on device_parsing Signed-off-by: Richard Maciel <rmaciel@linux.vnet.ibm.com> diff -r 5a873709bd07 -r efdd812a716e libxkutil/device_parsing.c --- a/libxkutil/device_parsing.c Sat Jun 06 22:46:42 2009 -0300 +++ b/libxkutil/device_parsing.c Sat Jun 06 22:46:51 2009 -0300 @@ -59,6 +59,7 @@ free(dev->driver); free(dev->source); free(dev->virtual_dev); + free(dev->bus_type); } static void cleanup_net_device(struct net_device *dev) @@ -246,6 +247,7 @@ ddev->virtual_dev = get_attr_value(child, "dev"); if (ddev->virtual_dev == NULL) goto err; + ddev->bus_type = get_attr_value(child, "bus"); } else if (XSTREQ(child->name, "readonly")) { ddev->readonly = true; } else if (XSTREQ(child->name, "shareable")) { @@ -666,6 +668,7 @@ DUP_FIELD(dev, _dev, dev.disk.driver); DUP_FIELD(dev, _dev, dev.disk.source); DUP_FIELD(dev, _dev, dev.disk.virtual_dev); + DUP_FIELD(dev, _dev, dev.disk.bus_type); dev->dev.disk.disk_type = _dev->dev.disk.disk_type; dev->dev.disk.readonly = _dev->dev.disk.readonly; dev->dev.disk.shareable = _dev->dev.disk.shareable;

# HG changeset patch # User Richard Maciel <rmaciel@linux.vnet.ibm.com> # Date 1244339211 10800 # Node ID 54abd208846613c4babff527809b2b5fcd305de6 # Parent efdd812a716e949db3c09b54c05fe955cc34fb4a Added support for BusType prop on xmlgen and xml_parse_test Signed-off-by: Richard Maciel <rmaciel@linux.vnet.ibm.com> diff -r efdd812a716e -r 54abd2088466 libxkutil/xml_parse_test.c --- a/libxkutil/xml_parse_test.c Sat Jun 06 22:46:51 2009 -0300 +++ b/libxkutil/xml_parse_test.c Sat Jun 06 22:46:51 2009 -0300 @@ -97,6 +97,7 @@ print_value(d, "Driver", dev->dev.disk.driver); print_value(d, "Source", dev->dev.disk.source); print_value(d, "Virt Device", dev->dev.disk.virtual_dev); + print_value(d, "Bus Type", dev->dev.disk.bus_type); } static void print_dev_vcpu(struct virt_device *dev, diff -r efdd812a716e -r 54abd2088466 libxkutil/xmlgen.c --- a/libxkutil/xmlgen.c Sat Jun 06 22:46:51 2009 -0300 +++ b/libxkutil/xmlgen.c Sat Jun 06 22:46:51 2009 -0300 @@ -60,6 +60,8 @@ if (tmp == NULL) return XML_ERROR; xmlNewProp(tmp, BAD_CAST "dev", BAD_CAST dev->virtual_dev); + if (dev->bus_type) + xmlNewProp(tmp, BAD_CAST "bus", BAD_CAST dev->bus_type); if (dev->readonly) xmlNewChild(disk, NULL, BAD_CAST "readonly", NULL);

static void print_dev_vcpu(struct virt_device *dev, diff -r efdd812a716e -r 54abd2088466 libxkutil/xmlgen.c --- a/libxkutil/xmlgen.c Sat Jun 06 22:46:51 2009 -0300 +++ b/libxkutil/xmlgen.c Sat Jun 06 22:46:51 2009 -0300 @@ -60,6 +60,8 @@ if (tmp == NULL) return XML_ERROR; xmlNewProp(tmp, BAD_CAST "dev", BAD_CAST dev->virtual_dev); + if (dev->bus_type) + xmlNewProp(tmp, BAD_CAST "bus", BAD_CAST dev->bus_type);
if (dev->readonly) xmlNewChild(disk, NULL, BAD_CAST "readonly", NULL);
What about for file type disks? This only covers block type disks. -- Kaitlin Rupert IBM Linux Technology Center kaitlin@linux.vnet.ibm.com

Again, bug description only targets block devices. I don't even know if file type disks works with this property. Kaitlin Rupert wrote:
static void print_dev_vcpu(struct virt_device *dev, diff -r efdd812a716e -r 54abd2088466 libxkutil/xmlgen.c --- a/libxkutil/xmlgen.c Sat Jun 06 22:46:51 2009 -0300 +++ b/libxkutil/xmlgen.c Sat Jun 06 22:46:51 2009 -0300 @@ -60,6 +60,8 @@ if (tmp == NULL) return XML_ERROR; xmlNewProp(tmp, BAD_CAST "dev", BAD_CAST dev->virtual_dev); + if (dev->bus_type) + xmlNewProp(tmp, BAD_CAST "bus", BAD_CAST dev->bus_type);
if (dev->readonly) xmlNewChild(disk, NULL, BAD_CAST "readonly", NULL);
What about for file type disks? This only covers block type disks.
-- Richard Maciel, MSc IBM Linux Technology Center rmaciel@linux.vnet.ibm.com

# HG changeset patch # User Richard Maciel <rmaciel@linux.vnet.ibm.com> # Date 1244339211 10800 # Node ID f40d6547d9db21d942f0f033f8f51150f5c57637 # Parent 54abd208846613c4babff527809b2b5fcd305de6 Added support for BusType prop on RASD and VSMS Signed-off-by: Richard Maciel <rmaciel@linux.vnet.ibm.com> diff -r 54abd2088466 -r f40d6547d9db src/Virt_RASD.c --- a/src/Virt_RASD.c Sat Jun 06 22:46:51 2009 -0300 +++ b/src/Virt_RASD.c Sat Jun 06 22:46:51 2009 -0300 @@ -253,6 +253,11 @@ (CMPIValue *)dev->dev.disk.source, CMPI_chars); + CMSetProperty(inst, + "BusType", + (CMPIValue *)dev->dev.disk.bus_type, + CMPI_chars); + /* There's not much we can do here if we don't recognize the type, * so it seems that assuming 'disk' is a reasonable default */ diff -r 54abd2088466 -r f40d6547d9db src/Virt_VirtualSystemManagementService.c --- a/src/Virt_VirtualSystemManagementService.c Sat Jun 06 22:46:51 2009 -0300 +++ b/src/Virt_VirtualSystemManagementService.c Sat Jun 06 22:46:51 2009 -0300 @@ -599,6 +599,12 @@ else return "Invalid value for EmulatedType"; + if (cu_get_str_prop(inst, "BusType", &val) != CMPI_RC_OK) + val = "ide"; + + free(dev->dev.disk.bus_type); + dev->dev.disk.bus_type = strdup(val); + free(dev->id); dev->id = strdup(dev->dev.disk.virtual_dev);

diff -r 54abd2088466 -r f40d6547d9db src/Virt_VirtualSystemManagementService.c --- a/src/Virt_VirtualSystemManagementService.c Sat Jun 06 22:46:51 2009 -0300 +++ b/src/Virt_VirtualSystemManagementService.c Sat Jun 06 22:46:51 2009 -0300 @@ -599,6 +599,12 @@ else return "Invalid value for EmulatedType";
+ if (cu_get_str_prop(inst, "BusType", &val) != CMPI_RC_OK) + val = "ide";
This is an optional value. If the user doesn't specify a value, libvirt will attempt to determine the correct value. So instead of setting "ide" as the default here, just set dev->dev.disk.bus_type to NULL to indicate no value was set. -- Kaitlin Rupert IBM Linux Technology Center kaitlin@linux.vnet.ibm.com

You'll also need to follow up with a patch that exposes the BusType attribute in the template RASDs. -- Kaitlin Rupert IBM Linux Technology Center kaitlin@linux.vnet.ibm.com
participants (2)
-
Kaitlin Rupert
-
Richard Maciel