mirror of https://gitee.com/openkylin/libvirt.git
qemu_command.c: move QEMU_CAPS_VIRTIO_NET_HOST_MTU check to qemu_validate.c
Reviewed-by: Michal Privoznik <mprivozn@redhat.com> Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
This commit is contained in:
parent
53fa517082
commit
edee4290c9
|
@ -3408,14 +3408,9 @@ qemuBuildNicDevStr(virDomainDefPtr def,
|
|||
if (usingVirtio && net->driver.virtio.tx_queue_size)
|
||||
virBufferAsprintf(&buf, ",tx_queue_size=%u", net->driver.virtio.tx_queue_size);
|
||||
|
||||
if (usingVirtio && net->mtu) {
|
||||
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_NET_HOST_MTU)) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("setting MTU is not supported with this QEMU binary"));
|
||||
return NULL;
|
||||
}
|
||||
if (usingVirtio && net->mtu)
|
||||
virBufferAsprintf(&buf, ",host_mtu=%u", net->mtu);
|
||||
}
|
||||
|
||||
if (usingVirtio && net->teaming.type == VIR_DOMAIN_NET_TEAMING_TYPE_PERSISTENT)
|
||||
virBufferAddLit(&buf, ",failover=on");
|
||||
|
||||
|
|
|
@ -1277,6 +1277,14 @@ qemuValidateDomainDeviceDefNetwork(const virDomainNetDef *net,
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (net->mtu &&
|
||||
!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_NET_HOST_MTU)) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("setting MTU is not supported with this "
|
||||
"QEMU binary"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (net->driver.virtio.rx_queue_size & (net->driver.virtio.rx_queue_size - 1)) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("rx_queue_size has to be a power of two"));
|
||||
|
|
|
@ -499,7 +499,7 @@ mymain(void)
|
|||
DO_TEST("watchdog", NONE);
|
||||
DO_TEST("net-bandwidth", QEMU_CAPS_DEVICE_VGA, QEMU_CAPS_VNC);
|
||||
DO_TEST("net-bandwidth2", QEMU_CAPS_DEVICE_VGA, QEMU_CAPS_VNC);
|
||||
DO_TEST("net-mtu", NONE);
|
||||
DO_TEST("net-mtu", QEMU_CAPS_VIRTIO_NET_HOST_MTU);
|
||||
DO_TEST("net-coalesce", NONE);
|
||||
DO_TEST("net-many-models", NONE);
|
||||
|
||||
|
|
Loading…
Reference in New Issue