From b21163bd119446dcbadab7523b1dc8dab487a571 Mon Sep 17 00:00:00 2001 From: Laine Stump Date: Mon, 11 Dec 2017 14:26:54 -0500 Subject: [PATCH] qemu: delete exist bandwidth restrictions when they are removed from config When the of an interface is changed with update-device, the old settings are cleared with tc, then new settings added with tc. But if the ifname, - virDomainNetGetActualBandwidth(newdev), - false, - !virDomainNetTypeSharesHostView(newdev)) < 0) - goto cleanup; + virNetDevBandwidthPtr newb = virDomainNetGetActualBandwidth(newdev); + + if (newb) { + if (virNetDevBandwidthSet(newdev->ifname, newb, false, + !virDomainNetTypeSharesHostView(newdev)) < 0) + goto cleanup; + } else { + /* + * virNetDevBandwidthSet() doesn't clear any existing + * setting unless something new is being set. + */ + virNetDevBandwidthClear(newdev->ifname); + } needReplaceDevDef = true; } -- 2.47.2