qemu: support updating <port isolated='yes|no'/> during device update

This setting can be updating very easily on an already active
interface by just changing it in sysfs. If the bridge used for
connection is also changed, there is no need to separately update it,
because the new setting isf done as a part of connecting to the bridge
anyway.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Laine Stump 2020-02-14 13:51:31 -05:00
parent 2b8fd7334d
commit db7f262884

View File

@ -3481,6 +3481,7 @@ qemuDomainChangeNet(virQEMUDriverPtr driver,
bool needBandwidthSet = false;
bool needCoalesceChange = false;
bool needVlanUpdate = false;
bool needIsolatedPortChange = false;
int ret = -1;
int changeidx = -1;
g_autoptr(virConnect) conn = NULL;
@ -3805,6 +3806,11 @@ qemuDomainChangeNet(virQEMUDriverPtr driver,
needVlanUpdate = true;
}
if (virDomainNetGetActualPortOptionsIsolated(olddev) !=
virDomainNetGetActualPortOptionsIsolated(newdev)) {
needIsolatedPortChange = true;
}
if (olddev->linkstate != newdev->linkstate)
needLinkStateChange = true;
@ -3851,6 +3857,20 @@ qemuDomainChangeNet(virQEMUDriverPtr driver,
* determined that the rest of newdev is equivalent to olddev,
* so move newdev into place */
needReplaceDevDef = true;
/* this is already updated as a part of reconnecting the bridge */
needIsolatedPortChange = false;
}
if (needIsolatedPortChange) {
const char *bridge = virDomainNetGetActualBridgeName(newdev);
bool isolatedOn = (virDomainNetGetActualPortOptionsIsolated(newdev) ==
VIR_TRISTATE_BOOL_YES);
if (virNetDevBridgePortSetIsolated(bridge, newdev->ifname, isolatedOn) < 0)
goto cleanup;
needReplaceDevDef = true;
}
if (needFilterChange) {