提交 92a71456 编写于 作者: P Pavel Mores 提交者: Michal Privoznik

qemu: fail on attempt to set 'floor' if interface type is not 'network'

QoS 'floor' setting is documented to be only supported for interfaces of
type 'network'.  Fail with an error message on attempt to set 'floor' on
an interface of any other type.
Signed-off-by: NPavel Mores <pmores@redhat.com>
Reviewed-by: NMichal Privoznik <mprivozn@redhat.com>
上级 17f430eb
......@@ -11672,9 +11672,21 @@ qemuDomainSetInterfaceParameters(virDomainPtr dom,
sizeof(*newBandwidth->out));
}
if (net->type == VIR_DOMAIN_NET_TYPE_NETWORK &&
virDomainNetBandwidthUpdate(net, newBandwidth) < 0)
goto endjob;
if (net->type == VIR_DOMAIN_NET_TYPE_NETWORK) {
if (virDomainNetBandwidthUpdate(net, newBandwidth) < 0)
goto endjob;
} else {
if (virNetDevBandwidthHasFloor(bandwidth)) {
char ifmac[VIR_MAC_STRING_BUFLEN];
virMacAddrFormat(&net->mac, ifmac);
virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
_("Invalid use of 'floor' on interface with MAC address %s "
"- 'floor' is only supported for interface type 'network' with forward type 'nat', 'route', 'open' or none"),
ifmac);
goto endjob;
}
}
if (virNetDevBandwidthSet(net->ifname, newBandwidth, false,
!virDomainNetTypeSharesHostView(net)) < 0) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册