[PATCH 0 of 4] (#2) Adds disk bus type support for libvirt-cim

# HG changeset patch # User Richard Maciel <rmaciel@linux.vnet.ibm.com> # Date 1244396364 10800 # Node ID 981877c297fc9ca382d2c9bb83b9653317900641 # Parent fc8f08ab36dac00f5e8bc3f2a1d160d1a57fdc78 Adds BusType prop to DiskRASD and support for it to the disk structure #2: - Xen also supports the BusType prop Signed-off-by: Richard Maciel <rmaciel@linux.vnet.ibm.com> diff -r fc8f08ab36da -r 981877c297fc libxkutil/device_parsing.h --- a/libxkutil/device_parsing.h Wed Jun 10 16:33:17 2009 -0700 +++ b/libxkutil/device_parsing.h Sun Jun 07 14:39:24 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 fc8f08ab36da -r 981877c297fc schema/ResourceAllocationSettingData.mof --- a/schema/ResourceAllocationSettingData.mof Wed Jun 10 16:33:17 2009 -0700 +++ b/schema/ResourceAllocationSettingData.mof Sun Jun 07 14:39:24 2009 -0300 @@ -13,6 +13,10 @@ ValueMap {"0", "1"}, Values {"Disk", "CDROM"}] uint16 EmulatedType; + + [Description ("Bus type of the device")] + string BusType; + }; [Description ("KVM virtual disk configuration"), @@ -28,6 +32,9 @@ ValueMap {"0", "1"}, Values {"Disk", "CDROM"}] uint16 EmulatedType; + + [Description ("Bus type of the device")] + string BusType; }; [Description ("LXC virtual disk configuration"),

# HG changeset patch # User Richard Maciel <rmaciel@linux.vnet.ibm.com> # Date 1244396373 10800 # Node ID d733a0ec8e105c7d315ffefdbfbb900a8e24d857 # Parent 981877c297fc9ca382d2c9bb83b9653317900641 Added support for BusType prop on device_parsing Signed-off-by: Richard Maciel <rmaciel@linux.vnet.ibm.com> imported patch dbus_type_parse diff -r 981877c297fc -r d733a0ec8e10 libxkutil/device_parsing.c --- a/libxkutil/device_parsing.c Sun Jun 07 14:39:24 2009 -0300 +++ b/libxkutil/device_parsing.c Sun Jun 07 14:39:33 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 1244396373 10800 # Node ID acfd07abeb2602bc0727ff29c05511748cd0a276 # Parent d733a0ec8e105c7d315ffefdbfbb900a8e24d857 Added support for BusType prop on xmlgen and xml_parse_test #2: BusType prop is available to file-based disks too Signed-off-by: Richard Maciel <rmaciel@linux.vnet.ibm.com> imported patch dbus_type_xml diff -r d733a0ec8e10 -r acfd07abeb26 libxkutil/xml_parse_test.c --- a/libxkutil/xml_parse_test.c Sun Jun 07 14:39:33 2009 -0300 +++ b/libxkutil/xml_parse_test.c Sun Jun 07 14:39:33 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 d733a0ec8e10 -r acfd07abeb26 libxkutil/xmlgen.c --- a/libxkutil/xmlgen.c Sun Jun 07 14:39:33 2009 -0300 +++ b/libxkutil/xmlgen.c Sun Jun 07 14:39:33 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); @@ -90,6 +92,9 @@ 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);

# HG changeset patch # User Richard Maciel <rmaciel@linux.vnet.ibm.com> # Date 1244396373 10800 # Node ID fb5a4c3d15d5bad7d09a65dcf70899c1b4e32d9c # Parent acfd07abeb2602bc0727ff29c05511748cd0a276 Added support for BusType prop on RASD and VSMS #2: - If BusType prop cannot be fetched by VSMS, set its disk structure corresponding member to NULL Signed-off-by: Richard Maciel <rmaciel@linux.vnet.ibm.com> imported patch dbus_type_rasd diff -r acfd07abeb26 -r fb5a4c3d15d5 src/Virt_RASD.c --- a/src/Virt_RASD.c Sun Jun 07 14:39:33 2009 -0300 +++ b/src/Virt_RASD.c Sun Jun 07 14:39:33 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 acfd07abeb26 -r fb5a4c3d15d5 src/Virt_VirtualSystemManagementService.c --- a/src/Virt_VirtualSystemManagementService.c Sun Jun 07 14:39:33 2009 -0300 +++ b/src/Virt_VirtualSystemManagementService.c Sun Jun 07 14:39:33 2009 -0300 @@ -603,6 +603,12 @@ else return "Invalid value for EmulatedType"; + free(dev->dev.disk.bus_type); + if (cu_get_str_prop(inst, "BusType", &val) != CMPI_RC_OK) + dev->dev.disk.bus_type = NULL; + else + dev->dev.disk.bus_type = strdup(val); + free(dev->id); dev->id = strdup(dev->dev.disk.virtual_dev);
participants (1)
-
Richard Maciel