mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 06:05:27 +00:00
Introduce a sub-element <driver> for controller
Like what we did for "disk", "filesystem" and "interface", this introduces sub-element <driver> for "controller", and put the "queues" into it.
This commit is contained in:
parent
e3e866aee0
commit
45d6c67143
@ -2135,17 +2135,14 @@
|
|||||||
controller. A "scsi" controller has an optional
|
controller. A "scsi" controller has an optional
|
||||||
attribute <code>model</code>, which is one of "auto", "buslogic",
|
attribute <code>model</code>, which is one of "auto", "buslogic",
|
||||||
"ibmvscsi", "lsilogic", "lsisas1068", "lsisas1078", "virtio-scsi" or
|
"ibmvscsi", "lsilogic", "lsisas1068", "lsisas1078", "virtio-scsi" or
|
||||||
"vmpvscsi". The attribute <code>queues</code>
|
"vmpvscsi". A "usb" controller has an optional attribute
|
||||||
(<span class="since">1.0.5 (QEMU and KVM only)</span>) specifies
|
<code>model</code>, which is one of "piix3-uhci", "piix4-uhci", "ehci",
|
||||||
the number of queues for the controller. For best performance, it's
|
"ich9-ehci1", "ich9-uhci1", "ich9-uhci2", "ich9-uhci3", "vt82c686b-uhci",
|
||||||
recommended to specify a value matching the number of vCPUs. A "usb"
|
"pci-ohci" or "nec-xhci". Additionally,
|
||||||
controller has an optional attribute <code>model</code>, which is one
|
<span class="since">since 0.10.0</span>, if the USB bus needs to be
|
||||||
of "piix3-uhci", "piix4-uhci", "ehci", "ich9-ehci1", "ich9-uhci1",
|
explicitly disabled for the guest, <code>model='none'</code> may be
|
||||||
"ich9-uhci2", "ich9-uhci3", "vt82c686b-uhci", "pci-ohci" or "nec-xhci".
|
used. The PowerPC64 "spapr-vio" addresses do not have an associated
|
||||||
Additionally, <span class="since">since 0.10.0</span>, if the USB bus
|
controller.
|
||||||
needs to be explicitly disabled for the guest, <code>model='none'</code>
|
|
||||||
may be used. The PowerPC64 "spapr-vio" addresses do not have an
|
|
||||||
associated controller.
|
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
@ -2155,6 +2152,13 @@
|
|||||||
semantics <a href="#elementsAddress">given above</a>.
|
semantics <a href="#elementsAddress">given above</a>.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
An optional sub-element <code>driver</code> can specify the driver
|
||||||
|
specific options. Currently it only supports attribute <code>queues</code>
|
||||||
|
(<span class="since">1.0.5</span>, 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.
|
||||||
|
</p>
|
||||||
<p>
|
<p>
|
||||||
USB companion controllers have an optional
|
USB companion controllers have an optional
|
||||||
sub-element <code><master></code> to specify the exact
|
sub-element <code><master></code> to specify the exact
|
||||||
|
@ -1443,11 +1443,6 @@
|
|||||||
</choice>
|
</choice>
|
||||||
</attribute>
|
</attribute>
|
||||||
</optional>
|
</optional>
|
||||||
<optional>
|
|
||||||
<attribute name="queues">
|
|
||||||
<ref name="unsignedInt"/>
|
|
||||||
</attribute>
|
|
||||||
</optional>
|
|
||||||
</group>
|
</group>
|
||||||
<!-- usb has an optional attribute "model", and optional subelement "master" -->
|
<!-- usb has an optional attribute "model", and optional subelement "master" -->
|
||||||
<group>
|
<group>
|
||||||
@ -1492,6 +1487,15 @@
|
|||||||
</optional>
|
</optional>
|
||||||
</group>
|
</group>
|
||||||
</choice>
|
</choice>
|
||||||
|
<optional>
|
||||||
|
<element name="driver">
|
||||||
|
<optional>
|
||||||
|
<attribute name="queues">
|
||||||
|
<ref name="unsignedInt"/>
|
||||||
|
</attribute>
|
||||||
|
</optional>
|
||||||
|
</element>
|
||||||
|
</optional>
|
||||||
</interleave>
|
</interleave>
|
||||||
</element>
|
</element>
|
||||||
</define>
|
</define>
|
||||||
|
@ -5156,6 +5156,7 @@ virDomainControllerDefParseXML(xmlNodePtr node,
|
|||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
virDomainControllerDefPtr def;
|
virDomainControllerDefPtr def;
|
||||||
|
xmlNodePtr cur = NULL;
|
||||||
char *type = NULL;
|
char *type = NULL;
|
||||||
char *idx = NULL;
|
char *idx = NULL;
|
||||||
char *model = NULL;
|
char *model = NULL;
|
||||||
@ -5195,13 +5196,20 @@ virDomainControllerDefParseXML(xmlNodePtr node,
|
|||||||
def->model = -1;
|
def->model = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((queues = virXMLPropString(node, "queues"))) {
|
cur = node->children;
|
||||||
if (virStrToLong_ui(queues, NULL, 10, &def->queues) < 0) {
|
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,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
_("Malformed 'queues' value '%s'"), queues);
|
_("Malformed 'queues' value '%s'"), queues);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (virDomainDeviceInfoParseXML(node, NULL, &def->info, flags) < 0)
|
if (virDomainDeviceInfoParseXML(node, NULL, &def->info, flags) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
@ -13524,9 +13532,6 @@ virDomainControllerDefFormat(virBufferPtr buf,
|
|||||||
virBufferEscapeString(buf, " model='%s'", model);
|
virBufferEscapeString(buf, " model='%s'", model);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (def->queues)
|
|
||||||
virBufferAsprintf(buf, " queues='%u'", def->queues);
|
|
||||||
|
|
||||||
switch (def->type) {
|
switch (def->type) {
|
||||||
case VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL:
|
case VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL:
|
||||||
if (def->opts.vioserial.ports != -1) {
|
if (def->opts.vioserial.ports != -1) {
|
||||||
@ -13543,10 +13548,16 @@ virDomainControllerDefFormat(virBufferPtr buf,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virDomainDeviceInfoIsSet(&def->info, flags)) {
|
if (def->queues || virDomainDeviceInfoIsSet(&def->info, flags)) {
|
||||||
virBufferAddLit(buf, ">\n");
|
virBufferAddLit(buf, ">\n");
|
||||||
if (virDomainDeviceInfoFormat(buf, &def->info, flags) < 0)
|
|
||||||
|
if (def->queues)
|
||||||
|
virBufferAsprintf(buf, " <driver queues='%u'/>\n", def->queues);
|
||||||
|
|
||||||
|
if (virDomainDeviceInfoIsSet(&def->info, flags) &&
|
||||||
|
virDomainDeviceInfoFormat(buf, &def->info, flags) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
virBufferAddLit(buf, " </controller>\n");
|
virBufferAddLit(buf, " </controller>\n");
|
||||||
} else {
|
} else {
|
||||||
virBufferAddLit(buf, "/>\n");
|
virBufferAddLit(buf, "/>\n");
|
||||||
|
@ -20,7 +20,9 @@
|
|||||||
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
|
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
|
||||||
</disk>
|
</disk>
|
||||||
<controller type='usb' index='0'/>
|
<controller type='usb' index='0'/>
|
||||||
<controller type='scsi' index='0' model='virtio-scsi' queues='8'/>
|
<controller type='scsi' index='0' model='virtio-scsi'>
|
||||||
|
<driver queues='8'/>
|
||||||
|
</controller>
|
||||||
<memballoon model='virtio'/>
|
<memballoon model='virtio'/>
|
||||||
</devices>
|
</devices>
|
||||||
</domain>
|
</domain>
|
||||||
|
Loading…
Reference in New Issue
Block a user