
Thanks for your review, I will fix in version 2. 发件人: Daniel Henrique Barboza 发送时间: 2020年6月16日星期二 上午2:36 收件人: Bingsong Si; libvir-list@redhat.com 主题: Re: [PATCH] network: Fix a race condition when shutdown & start vm at the same time 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@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@gmail.com>
+ ignore_value(virNetDevOpenvswitchRemovePort( + virDomainNetGetActualBridgeName(net), + net->ifname)); } }