diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 4e9665fb31..235a20683e 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -2135,17 +2135,14 @@ controller. A "scsi" controller has an optional attribute model, which is one of "auto", "buslogic", "ibmvscsi", "lsilogic", "lsisas1068", "lsisas1078", "virtio-scsi" or - "vmpvscsi". The attribute queues - (1.0.5 (QEMU and KVM only)) specifies - the number of queues for the controller. For best performance, it's - recommended to specify a value matching the number of vCPUs. A "usb" - controller has an optional attribute model, which is one - of "piix3-uhci", "piix4-uhci", "ehci", "ich9-ehci1", "ich9-uhci1", - "ich9-uhci2", "ich9-uhci3", "vt82c686b-uhci", "pci-ohci" or "nec-xhci". - Additionally, since 0.10.0, if the USB bus - needs to be explicitly disabled for the guest, model='none' - may be used. The PowerPC64 "spapr-vio" addresses do not have an - associated controller. + "vmpvscsi". A "usb" controller has an optional attribute + model, which is one of "piix3-uhci", "piix4-uhci", "ehci", + "ich9-ehci1", "ich9-uhci1", "ich9-uhci2", "ich9-uhci3", "vt82c686b-uhci", + "pci-ohci" or "nec-xhci". Additionally, + since 0.10.0, if the USB bus needs to be + explicitly disabled for the guest, model='none' may be + used. The PowerPC64 "spapr-vio" addresses do not have an associated + controller.

@@ -2155,6 +2152,13 @@ semantics given above.

+

+ An optional sub-element driver can specify the driver + specific options. Currently it only supports attribute queues + (1.0.5, QEMU and KVM only), which specifies the + number of queues for the controller. For best performance, it's recommended + to specify a value matching the number of vCPUs. +

USB companion controllers have an optional sub-element <master> to specify the exact diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index b1c4c2f854..a9d05817d9 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -1443,11 +1443,6 @@ - - - - - @@ -1492,6 +1487,15 @@ + + + + + + + + + diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 253c9ef70a..0b432dd3d8 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -5156,6 +5156,7 @@ virDomainControllerDefParseXML(xmlNodePtr node, unsigned int flags) { virDomainControllerDefPtr def; + xmlNodePtr cur = NULL; char *type = NULL; char *idx = NULL; char *model = NULL; @@ -5195,12 +5196,19 @@ virDomainControllerDefParseXML(xmlNodePtr node, def->model = -1; } - if ((queues = virXMLPropString(node, "queues"))) { - if (virStrToLong_ui(queues, NULL, 10, &def->queues) < 0) { - virReportError(VIR_ERR_XML_ERROR, - _("Malformed 'queues' value '%s'"), queues); - goto error; + cur = node->children; + while (cur != NULL) { + if (cur->type == XML_ELEMENT_NODE) { + if (xmlStrEqual(cur->name, BAD_CAST "driver")) + queues = virXMLPropString(cur, "queues"); } + cur = cur->next; + } + + if (queues && virStrToLong_ui(queues, NULL, 10, &def->queues) < 0) { + virReportError(VIR_ERR_XML_ERROR, + _("Malformed 'queues' value '%s'"), queues); + goto error; } if (virDomainDeviceInfoParseXML(node, NULL, &def->info, flags) < 0) @@ -13524,9 +13532,6 @@ virDomainControllerDefFormat(virBufferPtr buf, virBufferEscapeString(buf, " model='%s'", model); } - if (def->queues) - virBufferAsprintf(buf, " queues='%u'", def->queues); - switch (def->type) { case VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL: if (def->opts.vioserial.ports != -1) { @@ -13543,10 +13548,16 @@ virDomainControllerDefFormat(virBufferPtr buf, break; } - if (virDomainDeviceInfoIsSet(&def->info, flags)) { + if (def->queues || virDomainDeviceInfoIsSet(&def->info, flags)) { virBufferAddLit(buf, ">\n"); - if (virDomainDeviceInfoFormat(buf, &def->info, flags) < 0) + + if (def->queues) + virBufferAsprintf(buf, " \n", def->queues); + + if (virDomainDeviceInfoIsSet(&def->info, flags) && + virDomainDeviceInfoFormat(buf, &def->info, flags) < 0) return -1; + virBufferAddLit(buf, " \n"); } else { virBufferAddLit(buf, "/>\n"); diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-scsi-num_queues.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-scsi-num_queues.xml index b3b1289f85..fda976cb95 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-scsi-num_queues.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-scsi-num_queues.xml @@ -20,7 +20,9 @@

- + + +