Revert "qemu: Expose rx/tx_queue_size in qemu.conf too"

This reverts commit 038eb472a0.

On reflection adding defaults for arbitrary guest XML device config
settings to the qemu.conf is not a sustainable path. Removing the
support for rx/tx queue size so that it doesn't set a bad precedent.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrangé 2018-02-12 14:52:04 +00:00
parent a1bce9ef86
commit 12bc2b817f
9 changed files with 19 additions and 74 deletions

View File

@ -5456,12 +5456,7 @@ qemu-kvm -net nic,model=? /dev/null
some restrictions on actual value. For instance, latest some restrictions on actual value. For instance, latest
QEMU (as of 2016-09-01) requires value to be a power of two QEMU (as of 2016-09-01) requires value to be a power of two
from [256, 1024] range. from [256, 1024] range.
<span class="since">Since 2.3.0 (QEMU and KVM only)</span> <span class="since">Since 2.3.0 (QEMU and KVM only)</span><br/><br/>
Additionally, <span class="since">since 4.1.0</span> the
value can be set in the <code>qemu.conf</code> file in order
to override the hypervisor default value. Note that XML has
higher precedence because it's more specific.
<br/><br/>
<b>In general you should leave this option alone, unless you <b>In general you should leave this option alone, unless you
are very certain you know what you are doing.</b> are very certain you know what you are doing.</b>
@ -5477,12 +5472,7 @@ qemu-kvm -net nic,model=? /dev/null
range. In addition to that, this may work only for a subset of range. In addition to that, this may work only for a subset of
interface types, e.g. aforementioned QEMU enables this option interface types, e.g. aforementioned QEMU enables this option
only for <code>vhostuser</code> type. only for <code>vhostuser</code> type.
<span class="since">Since 3.7.0 (QEMU and KVM only)</span> <span class="since">Since 3.7.0 (QEMU and KVM only)</span><br/><br/>
Additionally, <span class="since">since 4.1.0</span> the
value can be set in the <code>qemu.conf</code> file in order
to override the hypervisor default value. Note that XML has
higher precedence because it's more specific.
<br/><br/>
<b>In general you should leave this option alone, unless you <b>In general you should leave this option alone, unless you
are very certain you know what you are doing.</b> are very certain you know what you are doing.</b>

View File

@ -118,9 +118,6 @@ module Libvirtd_qemu =
let vxhs_entry = bool_entry "vxhs_tls" let vxhs_entry = bool_entry "vxhs_tls"
| str_entry "vxhs_tls_x509_cert_dir" | str_entry "vxhs_tls_x509_cert_dir"
let virtio_entry = int_entry "rx_queue_size"
| int_entry "tx_queue_size"
(* Each entry in the config is one of the following ... *) (* Each entry in the config is one of the following ... *)
let entry = default_tls_entry let entry = default_tls_entry
| vnc_entry | vnc_entry
@ -140,7 +137,6 @@ module Libvirtd_qemu =
| gluster_debug_level_entry | gluster_debug_level_entry
| memory_entry | memory_entry
| vxhs_entry | vxhs_entry
| virtio_entry
let comment = [ label "#comment" . del /#[ \t]*/ "# " . store /([^ \t\n][^\n]*)?/ . del /\n/ "\n" ] let comment = [ label "#comment" . del /#[ \t]*/ "# " . store /([^ \t\n][^\n]*)?/ . del /\n/ "\n" ]
let empty = [ label "#empty" . eol ] let empty = [ label "#empty" . eol ]

View File

@ -775,9 +775,3 @@
# This directory is used for memoryBacking source if configured as file. # This directory is used for memoryBacking source if configured as file.
# NOTE: big files will be stored here # NOTE: big files will be stored here
#memory_backing_dir = "/var/lib/libvirt/qemu/ram" #memory_backing_dir = "/var/lib/libvirt/qemu/ram"
# The following two values set the default RX/TX ring buffer size for virtio
# interfaces. These values are taken unless overridden in domain XML. For more
# info consult docs to corresponding attributes from domain XML.
#rx_queue_size = 1024
#tx_queue_size = 1024

View File

@ -3351,8 +3351,7 @@ qemuBuildNicStr(virDomainNetDefPtr net,
char * char *
qemuBuildNicDevStr(virQEMUDriverConfigPtr cfg, qemuBuildNicDevStr(virDomainDefPtr def,
virDomainDefPtr def,
virDomainNetDefPtr net, virDomainNetDefPtr net,
int vlan, int vlan,
unsigned int bootindex, unsigned int bootindex,
@ -3472,41 +3471,21 @@ qemuBuildNicDevStr(virQEMUDriverConfigPtr cfg,
virBufferAsprintf(&buf, ",mq=on,vectors=%zu", 2 * vhostfdSize + 2); virBufferAsprintf(&buf, ",mq=on,vectors=%zu", 2 * vhostfdSize + 2);
} }
} }
if (usingVirtio) { if (usingVirtio && net->driver.virtio.rx_queue_size) {
unsigned int rx_queue_size = net->driver.virtio.rx_queue_size; if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_NET_RX_QUEUE_SIZE)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
if (rx_queue_size == 0) _("virtio rx_queue_size option is not supported with this QEMU binary"));
rx_queue_size = cfg->rx_queue_size; goto error;
if (rx_queue_size) {
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_NET_RX_QUEUE_SIZE)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("virtio rx_queue_size option is "
"not supported with this QEMU binary"));
goto error;
}
net->driver.virtio.rx_queue_size = rx_queue_size;
virBufferAsprintf(&buf, ",rx_queue_size=%u", rx_queue_size);
} }
virBufferAsprintf(&buf, ",rx_queue_size=%u", net->driver.virtio.rx_queue_size);
} }
if (usingVirtio) { if (usingVirtio && net->driver.virtio.tx_queue_size) {
unsigned int tx_queue_size = net->driver.virtio.tx_queue_size; if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_NET_TX_QUEUE_SIZE)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
if (tx_queue_size == 0) _("virtio tx_queue_size option is not supported with this QEMU binary"));
tx_queue_size = cfg->tx_queue_size; goto error;
if (tx_queue_size) {
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_NET_TX_QUEUE_SIZE)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("virtio tx_queue_size option is "
"not supported with this QEMU binary"));
goto error;
}
net->driver.virtio.tx_queue_size = tx_queue_size;
virBufferAsprintf(&buf, ",tx_queue_size=%u", tx_queue_size);
} }
virBufferAsprintf(&buf, ",tx_queue_size=%u", net->driver.virtio.tx_queue_size);
} }
if (usingVirtio && net->mtu) { if (usingVirtio && net->mtu) {
@ -8192,7 +8171,7 @@ qemuBuildVhostuserCommandLine(virQEMUDriverPtr driver,
virCommandAddArg(cmd, netdev); virCommandAddArg(cmd, netdev);
VIR_FREE(netdev); VIR_FREE(netdev);
if (!(nic = qemuBuildNicDevStr(cfg, def, net, -1, bootindex, if (!(nic = qemuBuildNicDevStr(def, net, -1, bootindex,
queues, qemuCaps))) { queues, qemuCaps))) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("Error generating NIC -device string")); "%s", _("Error generating NIC -device string"));
@ -8229,7 +8208,6 @@ qemuBuildInterfaceCommandLine(virQEMUDriverPtr driver,
int **nicindexes, int **nicindexes,
bool chardevStdioLogd) bool chardevStdioLogd)
{ {
virQEMUDriverConfigPtr cfg = NULL;
int ret = -1; int ret = -1;
char *nic = NULL, *host = NULL; char *nic = NULL, *host = NULL;
int *tapfd = NULL; int *tapfd = NULL;
@ -8291,8 +8269,6 @@ qemuBuildInterfaceCommandLine(virQEMUDriverPtr driver,
return -1; return -1;
} }
cfg = virQEMUDriverGetConfig(driver);
switch (actualType) { switch (actualType) {
case VIR_DOMAIN_NET_TYPE_NETWORK: case VIR_DOMAIN_NET_TYPE_NETWORK:
case VIR_DOMAIN_NET_TYPE_BRIDGE: case VIR_DOMAIN_NET_TYPE_BRIDGE:
@ -8488,7 +8464,7 @@ qemuBuildInterfaceCommandLine(virQEMUDriverPtr driver,
virCommandAddArgList(cmd, "-netdev", host, NULL); virCommandAddArgList(cmd, "-netdev", host, NULL);
} }
if (qemuDomainSupportsNicdev(def, net)) { if (qemuDomainSupportsNicdev(def, net)) {
if (!(nic = qemuBuildNicDevStr(cfg, def, net, vlan, bootindex, if (!(nic = qemuBuildNicDevStr(def, net, vlan, bootindex,
vhostfdSize, qemuCaps))) vhostfdSize, qemuCaps)))
goto cleanup; goto cleanup;
virCommandAddArgList(cmd, "-device", nic, NULL); virCommandAddArgList(cmd, "-device", nic, NULL);
@ -8532,7 +8508,6 @@ qemuBuildInterfaceCommandLine(virQEMUDriverPtr driver,
VIR_FREE(host); VIR_FREE(host);
VIR_FREE(tapfdName); VIR_FREE(tapfdName);
VIR_FREE(vhostfdName); VIR_FREE(vhostfdName);
virObjectUnref(cfg);
return ret; return ret;
} }

View File

@ -90,8 +90,7 @@ char *qemuBuildNicStr(virDomainNetDefPtr net,
int vlan); int vlan);
/* Current, best practice */ /* Current, best practice */
char *qemuBuildNicDevStr(virQEMUDriverConfigPtr cfg, char *qemuBuildNicDevStr(virDomainDefPtr def,
virDomainDefPtr def,
virDomainNetDefPtr net, virDomainNetDefPtr net,
int vlan, int vlan,
unsigned int bootindex, unsigned int bootindex,

View File

@ -912,10 +912,6 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr cfg,
if (virConfGetValueString(conf, "memory_backing_dir", &cfg->memoryBackingDir) < 0) if (virConfGetValueString(conf, "memory_backing_dir", &cfg->memoryBackingDir) < 0)
goto cleanup; goto cleanup;
if (virConfGetValueUInt(conf, "rx_queue_size", &cfg->rx_queue_size) < 0 ||
virConfGetValueUInt(conf, "tx_queue_size", &cfg->tx_queue_size) < 0)
goto cleanup;
ret = 0; ret = 0;
cleanup: cleanup:

View File

@ -206,9 +206,6 @@ struct _virQEMUDriverConfig {
bool vxhsTLS; bool vxhsTLS;
char *vxhsTLSx509certdir; char *vxhsTLSx509certdir;
unsigned int rx_queue_size;
unsigned int tx_queue_size;
}; };
/* Main driver state */ /* Main driver state */

View File

@ -1118,7 +1118,7 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver,
for (i = 0; i < vhostfdSize; i++) for (i = 0; i < vhostfdSize; i++)
VIR_FORCE_CLOSE(vhostfd[i]); VIR_FORCE_CLOSE(vhostfd[i]);
if (!(nicstr = qemuBuildNicDevStr(cfg, vm->def, net, vlan, 0, if (!(nicstr = qemuBuildNicDevStr(vm->def, net, vlan, 0,
queueSize, priv->qemuCaps))) queueSize, priv->qemuCaps)))
goto try_remove; goto try_remove;

View File

@ -100,5 +100,3 @@ module Test_libvirtd_qemu =
{ "1" = "mount" } { "1" = "mount" }
} }
{ "memory_backing_dir" = "/var/lib/libvirt/qemu/ram" } { "memory_backing_dir" = "/var/lib/libvirt/qemu/ram" }
{ "rx_queue_size" = "1024" }
{ "tx_queue_size" = "1024" }