[libvirt] [PATCH 0/2] Couple of interface type fixes

See the following link for more info: https://www.redhat.com/archives/libvir-list/2019-April/msg01412.html Be aware that these are very hackish and I don't like them. There's still one problem - virsh domiftune still doesn't work, as in it doesn't set floor on the network bridge because the code expects interface type of network but it sees type bridge. Michal Prívozník (2): conf: Parse bandwidth.floor for interface type='bridge' too qemu: Relax interface type change check when changing an interface src/conf/domain_conf.c | 7 ++++--- src/qemu/qemu_hotplug.c | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) -- 2.21.0

When users want to update an interface of a running domain, they are supposed to take whatever XML 'virsh dumpxml' produces, do all the tweaks and feed libvirt back with the new XML. This is exactly how 'virsh domif-setlink' works. Except after 518026e1595 an interface type='network' will become type='bridge' in live XML. And if the interface has some bandwidth with floor set we fail to parse it because floor is allowed only for type network. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> --- src/conf/domain_conf.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 6331424635..e23ea7a939 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -11631,9 +11631,10 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt, goto error; } } else if (virXMLNodeNameEqual(cur, "bandwidth")) { - if (virNetDevBandwidthParse(&def->bandwidth, - cur, - def->type == VIR_DOMAIN_NET_TYPE_NETWORK) < 0) + bool allowFloor = + def->type == VIR_DOMAIN_NET_TYPE_NETWORK || + def->type == VIR_DOMAIN_NET_TYPE_BRIDGE; + if (virNetDevBandwidthParse(&def->bandwidth, cur, allowFloor) < 0) goto error; } else if (virXMLNodeNameEqual(cur, "vlan")) { if (virNetDevVlanParse(cur, ctxt, &def->vlan) < 0) -- 2.21.0

Then changing some runtime knobs for an interface the qemuDomainChangeNet() is called. This does all kinds of checks to ensure that only supported changes are requested. There is one particular check which purpose is to make sure that interface type does not change. And even if it does, it's a change we can deal with. But since for a running domain any interface with type network becomes interface type bridge, this check fails and an error is reported. What we need to compare are actual types instead of configured ones. Fixes 518026e1595. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> --- src/qemu/qemu_hotplug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 630be12d54..ace171cd52 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -3966,7 +3966,7 @@ qemuDomainChangeNet(virQEMUDriverPtr driver, goto cleanup; } - if (olddev->type == newdev->type && oldType == newType) { + if (oldType == newType) { /* if type hasn't changed, check the relevant fields for the type */ switch (newdev->type) { -- 2.21.0
participants (1)
-
Michal Privoznik