[libvirt] [PATCH] network: log error when <bandwidth> is requested for hostdev interfaces
Peter Krempa
pkrempa at redhat.com
Thu May 12 05:54:30 UTC 2016
On Wed, May 11, 2016 at 12:18:51 -0400, Laine Stump wrote:
> This would previously be silently ignored.
>
> Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1319044
> ---
> src/network/bridge_driver.c | 25 +++++++++++++++++++++++++
> src/qemu/qemu_domain.c | 21 ++++++++++++++++-----
> 2 files changed, 41 insertions(+), 5 deletions(-)
>
> diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
> index bef8a78..0fd2095 100644
> --- a/src/network/bridge_driver.c
> +++ b/src/network/bridge_driver.c
> @@ -3126,6 +3126,20 @@ networkValidate(virNetworkDriverStatePtr driver,
> def->name);
> return -1;
> }
> +
> + if (def->forward.type == VIR_NETWORK_FORWARD_HOSTDEV) {
> + for (i = 0; i < def->nPortGroups; i++) {
> + if (def->portGroups[i].bandwidth) {
> + virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
> + _("unsupported <bandwidth> element "
> + "in <portgroup name='%s'> of "
> + "network '%s' with forward mode='%s'"),
> + def->portGroups[i].name, def->name,
> + virNetworkForwardTypeToString(def->forward.type));
> + return -1;
> + }
> + }
> + }
Okay this part gets called in networkDefineXML, networkCreateXML and
networkStartNetworkVirtual.
> return 0;
> }
>
> @@ -4305,6 +4319,17 @@ networkAllocateActualDevice(virDomainDefPtr dom,
> goto error;
> }
> }
> + if (virDomainNetGetActualBandwidth(iface)) {
> + /* bandwidth configuration via libvirt is not supported for
> + * hostdev network devices
> + */
> + if (actualType == VIR_DOMAIN_NET_TYPE_HOSTDEV) {
> + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
> + _("bandwidth settings are not supported "
> + "for hostdev interfaces"));
> + goto error;
> + }
> + }
>
> if (netdef) {
> netdef->connections++;
ACK to the code above.
> diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
> index f7356a2..4e32251 100644
> --- a/src/qemu/qemu_domain.c
> +++ b/src/qemu/qemu_domain.c
> @@ -2119,12 +2119,23 @@ qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
>
> qemuCaps = virQEMUCapsCacheLookup(driver->qemuCapsCache, def->emulator);
>
> - if (dev->type == VIR_DOMAIN_DEVICE_NET &&
> - dev->data.net->type != VIR_DOMAIN_NET_TYPE_HOSTDEV &&
> - !dev->data.net->model) {
> - if (VIR_STRDUP(dev->data.net->model,
> - qemuDomainDefaultNetModel(def, qemuCaps)) < 0)
> + if (dev->type == VIR_DOMAIN_DEVICE_NET) {
> + virDomainNetDefPtr net = dev->data.net;
> +
> + if (net->type != VIR_DOMAIN_NET_TYPE_HOSTDEV && !net->model &&
> + VIR_STRDUP(net->model, qemuDomainDefaultNetModel(def, qemuCaps)) < 0)
> + goto cleanup;
> +
> + if (net->type == VIR_DOMAIN_NET_TYPE_HOSTDEV &&
> + virDomainNetGetActualBandwidth(net)) {
> + /* bandwidth configuration via libvirt is not supported
> + * for hostdev network devices
> + */
> + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
> + _("bandwidth settings are not supported "
> + "for hostdev interfaces"));
> goto cleanup;
NACK to this part. This makes vm configs that were previously accepted
vanish. This can only be a start-time check.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20160512/fe35874e/attachment-0001.sig>
More information about the libvir-list
mailing list