mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-11-09 23:10:08 +00:00
qemu_validate: Use domaincaps to validate supported net backend type
Now that the logic for detecting supported net backend types has been moved to domain capabilities generation, we can just use it when validating net backend type. Just like we do for device models and so on. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
parent
751a327423
commit
bd6060d1c3
@ -1705,28 +1705,18 @@ qemuValidateDomainDeviceDefNetwork(const virDomainNetDef *net,
|
|||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
if (net->type == VIR_DOMAIN_NET_TYPE_USER) {
|
if (net->type == VIR_DOMAIN_NET_TYPE_USER) {
|
||||||
switch (net->backend.type) {
|
virDomainCapsDeviceNet netCaps = { };
|
||||||
case VIR_DOMAIN_NET_BACKEND_DEFAULT:
|
|
||||||
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_NETDEV_USER)) {
|
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
|
||||||
_("the '%1$s' network backend is not supported with this QEMU binary"),
|
|
||||||
virDomainNetBackendTypeToString(net->backend.type));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case VIR_DOMAIN_NET_BACKEND_PASST:
|
virQEMUCapsFillDomainDeviceNetCaps(qemuCaps, &netCaps);
|
||||||
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_NETDEV_STREAM)) {
|
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
|
||||||
_("the '%1$s' network backend is not supported with this QEMU binary"),
|
|
||||||
virDomainNetBackendTypeToString(net->backend.type));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case VIR_DOMAIN_NET_BACKEND_LAST:
|
if (!VIR_DOMAIN_CAPS_ENUM_IS_SET(netCaps.backendType,
|
||||||
break;
|
net->backend.type)) {
|
||||||
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
|
_("the '%1$s' network backend is not supported with this QEMU binary"),
|
||||||
|
virDomainNetBackendTypeToString(net->backend.type));
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (net->guestIP.nroutes) {
|
if (net->guestIP.nroutes) {
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
_("Invalid attempt to set network interface guest-side IP route, not supported by QEMU"));
|
_("Invalid attempt to set network interface guest-side IP route, not supported by QEMU"));
|
||||||
|
Loading…
Reference in New Issue
Block a user