[PATCH] network: Fix a race condition when shutdown & start vm at the same time
Daniel Henrique Barboza
danielhb413 at gmail.com
Mon Jun 15 18:36:14 UTC 2020
On 6/11/20 6:58 AM, Bingsong Si wrote:
> when shutdown vm, the qemuProcessStop cleanup virtual interface in two steps:
s/when/When
> 1. qemuProcessKill kill qemu process, and vif disappeared
> 2. ovs-vsctl del-port from the brige
>
> if start a vm in the middle of the two steps, the new vm will reused the vif,
s/if/If
> but removed from bridge by step 2
>
> Signed-off-by: Bingsong Si <owen.si at ucloud.cn>
> ---
> src/qemu/qemu_process.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
> index d36088ba98..706248815a 100644
> --- a/src/qemu/qemu_process.c
> +++ b/src/qemu/qemu_process.c
> @@ -7483,9 +7483,11 @@ void qemuProcessStop(virQEMUDriverPtr driver,
> if (vport->virtPortType == VIR_NETDEV_VPORT_PROFILE_MIDONET) {
> ignore_value(virNetDevMidonetUnbindPort(vport));
> } else if (vport->virtPortType == VIR_NETDEV_VPORT_PROFILE_OPENVSWITCH) {
> - ignore_value(virNetDevOpenvswitchRemovePort(
> - virDomainNetGetActualBridgeName(net),
> - net->ifname));
> + virMacAddr mac;
> + if (virNetDevGetMAC(net->ifname, &mac) < 0 || !virMacAddrCmp(&mac, &net->mac))
Extra space between "||" and "!virMacAddrCmp(.."
With these nits fixed:
Reviewed-by: Daniel Henrique Barboza <danielhb413 at gmail.com>
> + ignore_value(virNetDevOpenvswitchRemovePort(
> + virDomainNetGetActualBridgeName(net),
> + net->ifname));
> }
> }
>
>
More information about the libvir-list
mailing list