mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
qemu_validate: Validate net backends against QEMU caps
Now that we have a capability for each domain net backend we can start validating user's selection against QEMU capabilities. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
parent
e28bc15f09
commit
73fc20e262
@ -1705,12 +1705,28 @@ 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) {
|
||||||
if (net->backend.type == VIR_DOMAIN_NET_BACKEND_PASST &&
|
switch (net->backend.type) {
|
||||||
!virQEMUCapsGet(qemuCaps, QEMU_CAPS_NETDEV_STREAM)) {
|
case VIR_DOMAIN_NET_BACKEND_DEFAULT:
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_NETDEV_USER)) {
|
||||||
_("the passt network backend is not supported with this QEMU binary"));
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
|
_("the '%1$s' network backend is not supported with this QEMU binary"),
|
||||||
|
virDomainNetBackendTypeToString(net->backend.type));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case VIR_DOMAIN_NET_BACKEND_PASST:
|
||||||
|
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:
|
||||||
|
break;
|
||||||
|
}
|
||||||
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