some restrictions on actual value. For instance, latest
QEMU (as of 2016-09-01) requires value to be a power of two
from [256, 1024] range.
- <span class="since">Since 2.3.0 (QEMU and KVM only)</span>
- 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/>
+ <span class="since">Since 2.3.0 (QEMU and KVM only)</span><br/><br/>
<b>In general you should leave this option alone, unless you
are very certain you know what you are doing.</b>
range. In addition to that, this may work only for a subset of
interface types, e.g. aforementioned QEMU enables this option
only for <code>vhostuser</code> type.
- <span class="since">Since 3.7.0 (QEMU and KVM only)</span>
- 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/>
+ <span class="since">Since 3.7.0 (QEMU and KVM only)</span><br/><br/>
<b>In general you should leave this option alone, unless you
are very certain you know what you are doing.</b>
char *
-qemuBuildNicDevStr(virQEMUDriverConfigPtr cfg,
- virDomainDefPtr def,
+qemuBuildNicDevStr(virDomainDefPtr def,
virDomainNetDefPtr net,
int vlan,
unsigned int bootindex,
virBufferAsprintf(&buf, ",mq=on,vectors=%zu", 2 * vhostfdSize + 2);
}
}
- if (usingVirtio) {
- unsigned int rx_queue_size = net->driver.virtio.rx_queue_size;
-
- if (rx_queue_size == 0)
- rx_queue_size = cfg->rx_queue_size;
-
- 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);
+ if (usingVirtio && net->driver.virtio.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;
}
+ virBufferAsprintf(&buf, ",rx_queue_size=%u", net->driver.virtio.rx_queue_size);
}
- if (usingVirtio) {
- unsigned int tx_queue_size = net->driver.virtio.tx_queue_size;
-
- if (tx_queue_size == 0)
- tx_queue_size = cfg->tx_queue_size;
-
- 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);
+ if (usingVirtio && net->driver.virtio.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;
}
+ virBufferAsprintf(&buf, ",tx_queue_size=%u", net->driver.virtio.tx_queue_size);
}
if (usingVirtio && net->mtu) {
virCommandAddArg(cmd, netdev);
VIR_FREE(netdev);
- if (!(nic = qemuBuildNicDevStr(cfg, def, net, -1, bootindex,
+ if (!(nic = qemuBuildNicDevStr(def, net, -1, bootindex,
queues, qemuCaps))) {
virReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("Error generating NIC -device string"));
int **nicindexes,
bool chardevStdioLogd)
{
- virQEMUDriverConfigPtr cfg = NULL;
int ret = -1;
char *nic = NULL, *host = NULL;
int *tapfd = NULL;
return -1;
}
- cfg = virQEMUDriverGetConfig(driver);
-
switch (actualType) {
case VIR_DOMAIN_NET_TYPE_NETWORK:
case VIR_DOMAIN_NET_TYPE_BRIDGE:
virCommandAddArgList(cmd, "-netdev", host, NULL);
}
if (qemuDomainSupportsNicdev(def, net)) {
- if (!(nic = qemuBuildNicDevStr(cfg, def, net, vlan, bootindex,
+ if (!(nic = qemuBuildNicDevStr(def, net, vlan, bootindex,
vhostfdSize, qemuCaps)))
goto cleanup;
virCommandAddArgList(cmd, "-device", nic, NULL);
VIR_FREE(host);
VIR_FREE(tapfdName);
VIR_FREE(vhostfdName);
- virObjectUnref(cfg);
return ret;
}