On 6/15/20 2:04 PM, Daniel Henrique Barboza wrote:
On 6/12/20 3:18 AM, gongwei@xxxxxxxxxx wrote:
From: gongwei <gongwei@xxxxxxxxxx>
start to failed will not remove the openvswitch port,
the port recycling in this case lets openvswitch handle it by itself
Signed-off-by: gongwei <gongwei@xxxxxxxxxx>
---
Can you please elaborate on the commit message? By the commit title and
the code, I'm assuming that you're saying that we shouldn't remove the
openvswitch port if the QEMU process failed to start, for any other
reason aside from SHUTOFF_FAILED.
More importantly, what "port recycling" will take effect dependent on
how the qemu process is stopped (which I would think wouldn't make any
different to OVS), and why is it necessary for libvirt to not do it.
Up until now, what I have known is that ports will not be removed from
an OVS switch unless they are explicitly removed with ovs-vsctl, and
this attachment will persist across reboots of the host system. As a
matter of fact I've had cases during development where libvirt didn't
remove the OVS port for a tap device when a guest was terminated, and
then many *days* (and several reboots) later the same tap device name
was used for a different guest that was using a Linux host bridge, and
the tap device failed to attach to the Linux host bridge because it had
already been auto-attached back to the OVS switch as soon as it was created.
Can you desccribe how to reproduce the situation where libvirt removes
the OVS port when it shouldn't, and what is the bad outcome of that
happening?
The code itself looks ok.
src/qemu/qemu_process.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index d36088ba98..439bd5b396 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -7482,7 +7482,8 @@ void qemuProcessStop(virQEMUDriverPtr driver,
if (vport) {
if (vport->virtPortType ==
VIR_NETDEV_VPORT_PROFILE_MIDONET) {
ignore_value(virNetDevMidonetUnbindPort(vport));
- } else if (vport->virtPortType ==
VIR_NETDEV_VPORT_PROFILE_OPENVSWITCH) {
+ } else if (vport->virtPortType ==
VIR_NETDEV_VPORT_PROFILE_OPENVSWITCH &&
+ reason != VIR_DOMAIN_SHUTOFF_FAILED) {
ignore_value(virNetDevOpenvswitchRemovePort(
virDomainNetGetActualBridgeName(net),
net->ifname));