diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c
index d2ad6352b2acc7940d846a14cc5d6c73d95b3c47..85cfd83961a5af59798915e1800aed0961b64464 100644
--- a/src/conf/node_device_conf.c
+++ b/src/conf/node_device_conf.c
@@ -155,6 +155,320 @@ virPCIEDeviceInfoFormat(virBufferPtr buf,
}
+static void
+virNodeDeviceCapSystemDefFormat(virBufferPtr buf,
+ const virNodeDevCapData *data)
+{
+ char uuidstr[VIR_UUID_STRING_BUFLEN];
+
+ if (data->system.product_name)
+ virBufferEscapeString(buf, "%s\n",
+ data->system.product_name);
+ virBufferAddLit(buf, "\n");
+ virBufferAdjustIndent(buf, 2);
+ if (data->system.hardware.vendor_name)
+ virBufferEscapeString(buf, "%s\n",
+ data->system.hardware.vendor_name);
+ if (data->system.hardware.version)
+ virBufferEscapeString(buf, "%s\n",
+ data->system.hardware.version);
+ if (data->system.hardware.serial)
+ virBufferEscapeString(buf, "%s\n",
+ data->system.hardware.serial);
+ virUUIDFormat(data->system.hardware.uuid, uuidstr);
+ virBufferAsprintf(buf, "%s\n", uuidstr);
+ virBufferAdjustIndent(buf, -2);
+ virBufferAddLit(buf, "\n");
+
+ virBufferAddLit(buf, "\n");
+ virBufferAdjustIndent(buf, 2);
+ if (data->system.firmware.vendor_name)
+ virBufferEscapeString(buf, "%s\n",
+ data->system.firmware.vendor_name);
+ if (data->system.firmware.version)
+ virBufferEscapeString(buf, "%s\n",
+ data->system.firmware.version);
+ if (data->system.firmware.release_date)
+ virBufferEscapeString(buf, "%s\n",
+ data->system.firmware.release_date);
+ virBufferAdjustIndent(buf, -2);
+ virBufferAddLit(buf, "\n");
+}
+
+
+static void
+virNodeDeviceCapPCIDefFormat(virBufferPtr buf,
+ const virNodeDevCapData *data)
+{
+ size_t i;
+
+ virBufferAsprintf(buf, "%d\n",
+ data->pci_dev.domain);
+ virBufferAsprintf(buf, "%d\n", data->pci_dev.bus);
+ virBufferAsprintf(buf, "%d\n",
+ data->pci_dev.slot);
+ virBufferAsprintf(buf, "%d\n",
+ data->pci_dev.function);
+ virBufferAsprintf(buf, "pci_dev.product);
+ if (data->pci_dev.product_name)
+ virBufferEscapeString(buf, ">%s\n",
+ data->pci_dev.product_name);
+ else
+ virBufferAddLit(buf, " />\n");
+ virBufferAsprintf(buf, "pci_dev.vendor);
+ if (data->pci_dev.vendor_name)
+ virBufferEscapeString(buf, ">%s\n",
+ data->pci_dev.vendor_name);
+ else
+ virBufferAddLit(buf, " />\n");
+ if (data->pci_dev.flags & VIR_NODE_DEV_CAP_FLAG_PCI_PHYSICAL_FUNCTION) {
+ virBufferAddLit(buf, "\n");
+ virBufferAdjustIndent(buf, 2);
+ virBufferAsprintf(buf,
+ "\n",
+ data->pci_dev.physical_function->domain,
+ data->pci_dev.physical_function->bus,
+ data->pci_dev.physical_function->slot,
+ data->pci_dev.physical_function->function);
+ virBufferAdjustIndent(buf, -2);
+ virBufferAddLit(buf, "\n");
+ }
+ if (data->pci_dev.flags & VIR_NODE_DEV_CAP_FLAG_PCI_VIRTUAL_FUNCTION) {
+ virBufferAddLit(buf, "pci_dev.max_virtual_functions)
+ virBufferAsprintf(buf, " maxCount='%u'",
+ data->pci_dev.max_virtual_functions);
+ if (data->pci_dev.num_virtual_functions == 0) {
+ virBufferAddLit(buf, "/>\n");
+ } else {
+ virBufferAddLit(buf, ">\n");
+ virBufferAdjustIndent(buf, 2);
+ for (i = 0; i < data->pci_dev.num_virtual_functions; i++) {
+ virBufferAsprintf(buf,
+ "\n",
+ data->pci_dev.virtual_functions[i]->domain,
+ data->pci_dev.virtual_functions[i]->bus,
+ data->pci_dev.virtual_functions[i]->slot,
+ data->pci_dev.virtual_functions[i]->function);
+ }
+ virBufferAdjustIndent(buf, -2);
+ virBufferAddLit(buf, "\n");
+ }
+ }
+ if (data->pci_dev.hdrType) {
+ virBufferAsprintf(buf, "\n",
+ virPCIHeaderTypeToString(data->pci_dev.hdrType));
+ }
+ if (data->pci_dev.nIommuGroupDevices) {
+ virBufferAsprintf(buf, "\n",
+ data->pci_dev.iommuGroupNumber);
+ virBufferAdjustIndent(buf, 2);
+ for (i = 0; i < data->pci_dev.nIommuGroupDevices; i++) {
+ virBufferAsprintf(buf,
+ "\n",
+ data->pci_dev.iommuGroupDevices[i]->domain,
+ data->pci_dev.iommuGroupDevices[i]->bus,
+ data->pci_dev.iommuGroupDevices[i]->slot,
+ data->pci_dev.iommuGroupDevices[i]->function);
+ }
+ virBufferAdjustIndent(buf, -2);
+ virBufferAddLit(buf, "\n");
+ }
+ if (data->pci_dev.numa_node >= 0)
+ virBufferAsprintf(buf, "\n",
+ data->pci_dev.numa_node);
+
+ if (data->pci_dev.flags & VIR_NODE_DEV_CAP_FLAG_PCIE)
+ virPCIEDeviceInfoFormat(buf, data->pci_dev.pci_express);
+}
+
+
+static void
+virNodeDeviceCapUSBDevDefFormat(virBufferPtr buf,
+ const virNodeDevCapData *data)
+{
+ virBufferAsprintf(buf, "%d\n", data->usb_dev.bus);
+ virBufferAsprintf(buf, "%d\n",
+ data->usb_dev.device);
+ virBufferAsprintf(buf, "usb_dev.product);
+ if (data->usb_dev.product_name)
+ virBufferEscapeString(buf, ">%s\n",
+ data->usb_dev.product_name);
+ else
+ virBufferAddLit(buf, " />\n");
+ virBufferAsprintf(buf, "usb_dev.vendor);
+ if (data->usb_dev.vendor_name)
+ virBufferEscapeString(buf, ">%s\n",
+ data->usb_dev.vendor_name);
+ else
+ virBufferAddLit(buf, " />\n");
+}
+
+
+static void
+virNodeDeviceCapUSBInterfaceDefFormat(virBufferPtr buf,
+ const virNodeDevCapData *data)
+{
+ virBufferAsprintf(buf, "%d\n",
+ data->usb_if.number);
+ virBufferAsprintf(buf, "%d\n",
+ data->usb_if._class);
+ virBufferAsprintf(buf, "%d\n",
+ data->usb_if.subclass);
+ virBufferAsprintf(buf, "%d\n",
+ data->usb_if.protocol);
+ if (data->usb_if.description)
+ virBufferEscapeString(buf,
+ "%s\n",
+ data->usb_if.description);
+}
+
+
+static void
+virNodeDeviceCapNetDefFormat(virBufferPtr buf,
+ const virNodeDevCapData *data)
+{
+ size_t i;
+
+ virBufferEscapeString(buf, "%s\n",
+ data->net.ifname);
+ if (data->net.address)
+ virBufferEscapeString(buf, "
%s\n",
+ data->net.address);
+ virInterfaceLinkFormat(buf, &data->net.lnk);
+ if (data->net.features) {
+ for (i = 0; i < VIR_NET_DEV_FEAT_LAST; i++) {
+ if (virBitmapIsBitSet(data->net.features, i)) {
+ virBufferAsprintf(buf, "\n",
+ virNetDevFeatureTypeToString(i));
+ }
+ }
+ }
+ if (data->net.subtype != VIR_NODE_DEV_CAP_NET_LAST) {
+ const char *subtyp =
+ virNodeDevNetCapTypeToString(data->net.subtype);
+ virBufferEscapeString(buf, "\n",
+ subtyp);
+ }
+}
+
+
+static void
+virNodeDeviceCapSCSIHostDefFormat(virBufferPtr buf,
+ const virNodeDevCapData *data)
+{
+ virBufferAsprintf(buf, "%d\n",
+ data->scsi_host.host);
+ if (data->scsi_host.unique_id != -1)
+ virBufferAsprintf(buf, "%d\n",
+ data->scsi_host.unique_id);
+ if (data->scsi_host.flags & VIR_NODE_DEV_CAP_FLAG_HBA_FC_HOST) {
+ virBufferAddLit(buf, "\n");
+ virBufferAdjustIndent(buf, 2);
+ virBufferEscapeString(buf, "%s\n",
+ data->scsi_host.wwnn);
+ virBufferEscapeString(buf, "%s\n",
+ data->scsi_host.wwpn);
+ virBufferEscapeString(buf, "%s\n",
+ data->scsi_host.fabric_wwn);
+ virBufferAdjustIndent(buf, -2);
+ virBufferAddLit(buf, "\n");
+ }
+ if (data->scsi_host.flags & VIR_NODE_DEV_CAP_FLAG_HBA_VPORT_OPS) {
+ virBufferAddLit(buf, "\n");
+ virBufferAdjustIndent(buf, 2);
+ virBufferAsprintf(buf, "%d\n",
+ data->scsi_host.max_vports);
+ virBufferAsprintf(buf, "%d\n",
+ data->scsi_host.vports);
+ virBufferAdjustIndent(buf, -2);
+ virBufferAddLit(buf, "\n");
+ }
+}
+
+
+static void
+virNodeDeviceCapSCSIDefFormat(virBufferPtr buf,
+ const virNodeDevCapData *data)
+{
+ virBufferAsprintf(buf, "%d\n", data->scsi.host);
+ virBufferAsprintf(buf, "%d\n", data->scsi.bus);
+ virBufferAsprintf(buf, "%d\n",
+ data->scsi.target);
+ virBufferAsprintf(buf, "%d\n", data->scsi.lun);
+ if (data->scsi.type)
+ virBufferEscapeString(buf, "%s\n",
+ data->scsi.type);
+}
+
+
+static void
+virNodeDeviceCapStorageDefFormat(virBufferPtr buf,
+ const virNodeDevCapData *data)
+{
+ virBufferEscapeString(buf, "%s\n",
+ data->storage.block);
+ if (data->storage.bus)
+ virBufferEscapeString(buf, "%s\n",
+ data->storage.bus);
+ if (data->storage.drive_type)
+ virBufferEscapeString(buf, "%s\n",
+ data->storage.drive_type);
+ if (data->storage.model)
+ virBufferEscapeString(buf, "%s\n",
+ data->storage.model);
+ if (data->storage.vendor)
+ virBufferEscapeString(buf, "%s\n",
+ data->storage.vendor);
+ if (data->storage.serial)
+ virBufferEscapeString(buf, "%s\n",
+ data->storage.serial);
+ if (data->storage.flags & VIR_NODE_DEV_CAP_STORAGE_REMOVABLE) {
+ int avl = data->storage.flags &
+ VIR_NODE_DEV_CAP_STORAGE_REMOVABLE_MEDIA_AVAILABLE;
+ virBufferAddLit(buf, "\n");
+ virBufferAdjustIndent(buf, 2);
+ virBufferAsprintf(buf, "%d"
+ "\n", avl ? 1 : 0);
+ virBufferAsprintf(buf, "%llu\n",
+ data->storage.removable_media_size);
+ if (data->storage.media_label)
+ virBufferEscapeString(buf,
+ "%s\n",
+ data->storage.media_label);
+ if (data->storage.logical_block_size > 0)
+ virBufferAsprintf(buf, "%llu"
+ "\n",
+ data->storage.logical_block_size);
+ if (data->storage.num_blocks > 0)
+ virBufferAsprintf(buf,
+ "%llu\n",
+ data->storage.num_blocks);
+ virBufferAdjustIndent(buf, -2);
+ virBufferAddLit(buf, "\n");
+ } else {
+ virBufferAsprintf(buf, "%llu\n",
+ data->storage.size);
+ if (data->storage.logical_block_size > 0)
+ virBufferAsprintf(buf, "%llu"
+ "\n",
+ data->storage.logical_block_size);
+ if (data->storage.num_blocks > 0)
+ virBufferAsprintf(buf, "%llu\n",
+ data->storage.num_blocks);
+ }
+ if (data->storage.flags & VIR_NODE_DEV_CAP_STORAGE_HOTPLUGGABLE)
+ virBufferAddLit(buf, "\n");
+}
+
+
char *
virNodeDeviceDefFormat(const virNodeDeviceDef *def)
{
@@ -185,7 +499,6 @@ virNodeDeviceDefFormat(const virNodeDeviceDef *def)
}
for (caps = def->caps; caps; caps = caps->next) {
- char uuidstr[VIR_UUID_STRING_BUFLEN];
virNodeDevCapDataPtr data = &caps->data;
virBufferAsprintf(&buf, "\n",
@@ -193,279 +506,32 @@ virNodeDeviceDefFormat(const virNodeDeviceDef *def)
virBufferAdjustIndent(&buf, 2);
switch (caps->data.type) {
case VIR_NODE_DEV_CAP_SYSTEM:
- if (data->system.product_name)
- virBufferEscapeString(&buf, "%s\n",
- data->system.product_name);
- virBufferAddLit(&buf, "\n");
- virBufferAdjustIndent(&buf, 2);
- if (data->system.hardware.vendor_name)
- virBufferEscapeString(&buf, "%s\n",
- data->system.hardware.vendor_name);
- if (data->system.hardware.version)
- virBufferEscapeString(&buf, "%s\n",
- data->system.hardware.version);
- if (data->system.hardware.serial)
- virBufferEscapeString(&buf, "%s\n",
- data->system.hardware.serial);
- virUUIDFormat(data->system.hardware.uuid, uuidstr);
- virBufferAsprintf(&buf, "%s\n", uuidstr);
- virBufferAdjustIndent(&buf, -2);
- virBufferAddLit(&buf, "\n");
-
- virBufferAddLit(&buf, "\n");
- virBufferAdjustIndent(&buf, 2);
- if (data->system.firmware.vendor_name)
- virBufferEscapeString(&buf, "%s\n",
- data->system.firmware.vendor_name);
- if (data->system.firmware.version)
- virBufferEscapeString(&buf, "%s\n",
- data->system.firmware.version);
- if (data->system.firmware.release_date)
- virBufferEscapeString(&buf, "%s\n",
- data->system.firmware.release_date);
- virBufferAdjustIndent(&buf, -2);
- virBufferAddLit(&buf, "\n");
+ virNodeDeviceCapSystemDefFormat(&buf, data);
break;
case VIR_NODE_DEV_CAP_PCI_DEV:
- virBufferAsprintf(&buf, "%d\n",
- data->pci_dev.domain);
- virBufferAsprintf(&buf, "%d\n", data->pci_dev.bus);
- virBufferAsprintf(&buf, "%d\n",
- data->pci_dev.slot);
- virBufferAsprintf(&buf, "%d\n",
- data->pci_dev.function);
- virBufferAsprintf(&buf, "pci_dev.product);
- if (data->pci_dev.product_name)
- virBufferEscapeString(&buf, ">%s\n",
- data->pci_dev.product_name);
- else
- virBufferAddLit(&buf, " />\n");
- virBufferAsprintf(&buf, "pci_dev.vendor);
- if (data->pci_dev.vendor_name)
- virBufferEscapeString(&buf, ">%s\n",
- data->pci_dev.vendor_name);
- else
- virBufferAddLit(&buf, " />\n");
- if (data->pci_dev.flags & VIR_NODE_DEV_CAP_FLAG_PCI_PHYSICAL_FUNCTION) {
- virBufferAddLit(&buf, "\n");
- virBufferAdjustIndent(&buf, 2);
- virBufferAsprintf(&buf,
- "\n",
- data->pci_dev.physical_function->domain,
- data->pci_dev.physical_function->bus,
- data->pci_dev.physical_function->slot,
- data->pci_dev.physical_function->function);
- virBufferAdjustIndent(&buf, -2);
- virBufferAddLit(&buf, "\n");
- }
- if (data->pci_dev.flags & VIR_NODE_DEV_CAP_FLAG_PCI_VIRTUAL_FUNCTION) {
- virBufferAddLit(&buf, "pci_dev.max_virtual_functions)
- virBufferAsprintf(&buf, " maxCount='%u'",
- data->pci_dev.max_virtual_functions);
- if (data->pci_dev.num_virtual_functions == 0) {
- virBufferAddLit(&buf, "/>\n");
- } else {
- virBufferAddLit(&buf, ">\n");
- virBufferAdjustIndent(&buf, 2);
- for (i = 0; i < data->pci_dev.num_virtual_functions; i++) {
- virBufferAsprintf(&buf,
- "\n",
- data->pci_dev.virtual_functions[i]->domain,
- data->pci_dev.virtual_functions[i]->bus,
- data->pci_dev.virtual_functions[i]->slot,
- data->pci_dev.virtual_functions[i]->function);
- }
- virBufferAdjustIndent(&buf, -2);
- virBufferAddLit(&buf, "\n");
- }
- }
- if (data->pci_dev.hdrType) {
- virBufferAsprintf(&buf, "\n",
- virPCIHeaderTypeToString(data->pci_dev.hdrType));
- }
- if (data->pci_dev.nIommuGroupDevices) {
- virBufferAsprintf(&buf, "\n",
- data->pci_dev.iommuGroupNumber);
- virBufferAdjustIndent(&buf, 2);
- for (i = 0; i < data->pci_dev.nIommuGroupDevices; i++) {
- virBufferAsprintf(&buf,
- "\n",
- data->pci_dev.iommuGroupDevices[i]->domain,
- data->pci_dev.iommuGroupDevices[i]->bus,
- data->pci_dev.iommuGroupDevices[i]->slot,
- data->pci_dev.iommuGroupDevices[i]->function);
- }
- virBufferAdjustIndent(&buf, -2);
- virBufferAddLit(&buf, "\n");
- }
- if (data->pci_dev.numa_node >= 0)
- virBufferAsprintf(&buf, "\n",
- data->pci_dev.numa_node);
-
- if (data->pci_dev.flags & VIR_NODE_DEV_CAP_FLAG_PCIE)
- virPCIEDeviceInfoFormat(&buf, data->pci_dev.pci_express);
+ virNodeDeviceCapPCIDefFormat(&buf, data);
break;
case VIR_NODE_DEV_CAP_USB_DEV:
- virBufferAsprintf(&buf, "%d\n", data->usb_dev.bus);
- virBufferAsprintf(&buf, "%d\n",
- data->usb_dev.device);
- virBufferAsprintf(&buf, "usb_dev.product);
- if (data->usb_dev.product_name)
- virBufferEscapeString(&buf, ">%s\n",
- data->usb_dev.product_name);
- else
- virBufferAddLit(&buf, " />\n");
- virBufferAsprintf(&buf, "usb_dev.vendor);
- if (data->usb_dev.vendor_name)
- virBufferEscapeString(&buf, ">%s\n",
- data->usb_dev.vendor_name);
- else
- virBufferAddLit(&buf, " />\n");
+ virNodeDeviceCapUSBDevDefFormat(&buf, data);
break;
case VIR_NODE_DEV_CAP_USB_INTERFACE:
- virBufferAsprintf(&buf, "%d\n",
- data->usb_if.number);
- virBufferAsprintf(&buf, "%d\n",
- data->usb_if._class);
- virBufferAsprintf(&buf, "%d\n",
- data->usb_if.subclass);
- virBufferAsprintf(&buf, "%d\n",
- data->usb_if.protocol);
- if (data->usb_if.description)
- virBufferEscapeString(&buf,
- "%s\n",
- data->usb_if.description);
+ virNodeDeviceCapUSBInterfaceDefFormat(&buf, data);
break;
case VIR_NODE_DEV_CAP_NET:
- virBufferEscapeString(&buf, "%s\n",
- data->net.ifname);
- if (data->net.address)
- virBufferEscapeString(&buf, "%s\n",
- data->net.address);
- virInterfaceLinkFormat(&buf, &data->net.lnk);
- if (data->net.features) {
- for (i = 0; i < VIR_NET_DEV_FEAT_LAST; i++) {
- if (virBitmapIsBitSet(data->net.features, i)) {
- virBufferAsprintf(&buf, "\n",
- virNetDevFeatureTypeToString(i));
- }
- }
- }
- if (data->net.subtype != VIR_NODE_DEV_CAP_NET_LAST) {
- const char *subtyp =
- virNodeDevNetCapTypeToString(data->net.subtype);
- virBufferEscapeString(&buf, "\n",
- subtyp);
- }
+ virNodeDeviceCapNetDefFormat(&buf, data);
break;
case VIR_NODE_DEV_CAP_SCSI_HOST:
- virBufferAsprintf(&buf, "%d\n",
- data->scsi_host.host);
- if (data->scsi_host.unique_id != -1)
- virBufferAsprintf(&buf, "%d\n",
- data->scsi_host.unique_id);
- if (data->scsi_host.flags & VIR_NODE_DEV_CAP_FLAG_HBA_FC_HOST) {
- virBufferAddLit(&buf, "\n");
- virBufferAdjustIndent(&buf, 2);
- virBufferEscapeString(&buf, "%s\n",
- data->scsi_host.wwnn);
- virBufferEscapeString(&buf, "%s\n",
- data->scsi_host.wwpn);
- virBufferEscapeString(&buf, "%s\n",
- data->scsi_host.fabric_wwn);
- virBufferAdjustIndent(&buf, -2);
- virBufferAddLit(&buf, "\n");
- }
- if (data->scsi_host.flags & VIR_NODE_DEV_CAP_FLAG_HBA_VPORT_OPS) {
- virBufferAddLit(&buf, "\n");
- virBufferAdjustIndent(&buf, 2);
- virBufferAsprintf(&buf, "%d\n",
- data->scsi_host.max_vports);
- virBufferAsprintf(&buf, "%d\n",
- data->scsi_host.vports);
- virBufferAdjustIndent(&buf, -2);
- virBufferAddLit(&buf, "\n");
- }
-
+ virNodeDeviceCapSCSIHostDefFormat(&buf, data);
break;
-
case VIR_NODE_DEV_CAP_SCSI_TARGET:
virBufferEscapeString(&buf, "%s\n",
data->scsi_target.name);
break;
-
case VIR_NODE_DEV_CAP_SCSI:
- virBufferAsprintf(&buf, "%d\n", data->scsi.host);
- virBufferAsprintf(&buf, "%d\n", data->scsi.bus);
- virBufferAsprintf(&buf, "%d\n",
- data->scsi.target);
- virBufferAsprintf(&buf, "%d\n", data->scsi.lun);
- if (data->scsi.type)
- virBufferEscapeString(&buf, "%s\n",
- data->scsi.type);
+ virNodeDeviceCapSCSIDefFormat(&buf, data);
break;
case VIR_NODE_DEV_CAP_STORAGE:
- virBufferEscapeString(&buf, "%s\n",
- data->storage.block);
- if (data->storage.bus)
- virBufferEscapeString(&buf, "%s\n",
- data->storage.bus);
- if (data->storage.drive_type)
- virBufferEscapeString(&buf, "%s\n",
- data->storage.drive_type);
- if (data->storage.model)
- virBufferEscapeString(&buf, "%s\n",
- data->storage.model);
- if (data->storage.vendor)
- virBufferEscapeString(&buf, "%s\n",
- data->storage.vendor);
- if (data->storage.serial)
- virBufferEscapeString(&buf, "%s\n",
- data->storage.serial);
- if (data->storage.flags & VIR_NODE_DEV_CAP_STORAGE_REMOVABLE) {
- int avl = data->storage.flags &
- VIR_NODE_DEV_CAP_STORAGE_REMOVABLE_MEDIA_AVAILABLE;
- virBufferAddLit(&buf, "\n");
- virBufferAdjustIndent(&buf, 2);
- virBufferAsprintf(&buf, "%d"
- "\n", avl ? 1 : 0);
- virBufferAsprintf(&buf, "%llu\n",
- data->storage.removable_media_size);
- if (data->storage.media_label)
- virBufferEscapeString(&buf,
- "%s\n",
- data->storage.media_label);
- if (data->storage.logical_block_size > 0)
- virBufferAsprintf(&buf, "%llu"
- "\n",
- data->storage.logical_block_size);
- if (data->storage.num_blocks > 0)
- virBufferAsprintf(&buf,
- "%llu\n",
- data->storage.num_blocks);
- virBufferAdjustIndent(&buf, -2);
- virBufferAddLit(&buf, "\n");
- } else {
- virBufferAsprintf(&buf, "%llu\n",
- data->storage.size);
- if (data->storage.logical_block_size > 0)
- virBufferAsprintf(&buf, "%llu"
- "\n",
- data->storage.logical_block_size);
- if (data->storage.num_blocks > 0)
- virBufferAsprintf(&buf, "%llu\n",
- data->storage.num_blocks);
- }
- if (data->storage.flags & VIR_NODE_DEV_CAP_STORAGE_HOTPLUGGABLE)
- virBufferAddLit(&buf, "\n");
+ virNodeDeviceCapStorageDefFormat(&buf, data);
break;
case VIR_NODE_DEV_CAP_SCSI_GENERIC:
virBufferEscapeString(&buf, "%s\n",