<div class="zcontentRow"> <p><br></p><p><span style="line-height: 21px;">>This fix won't work correctly either. You cannot assume that libvirt has</span><br style="white-space: normal;"><span style="line-height: 21px;">>control over when the QEMU process exits. It may exit itself *before*</span><br style="white-space: normal;"><span style="line-height: 21px;">>libvirt runs any of its cleanup code.</span></p><p><span style="line-height: 21px;">I don't think there's a problem.  Although  libvirt does not runs cleanup code .but tap devices don't exist when </span><span style="line-height: 21px;">when the QEMU process exits.</span><span style="line-height: 21px;"><br></span></p><p><span style="line-height: 21px;">libvirt can create  tap device and add port to the bridge again by calling virNetDevOpenvswitchAddPort .</span></p><p><span style="line-height: 21px;"> </span>i can  only delete the port from openvswitch bridge  and cleanup  other network interfaces after <span style="line-height: 21px;">the QEMU process exits.</span></p><p><br></p><p><br></p><div class="zMailSign"><div><div><div><div><p style="font-family: 宋体; font-size: 7.0px; line-height: normal; widows: 1;"><span style="font-size:12px;color:#58595B;font-family:微软雅黑;font-size: 7.0px;"><span class="signedit"><br></span></span></p><p style="font-family: 宋体; font-size: 7.0px; line-height: normal; widows: 1;"><span style="font-size:12px;color:#58595B;font-family:微软雅黑;font-size: 7.0px;"><span class="signedit"><strong style="box-sizing: border-box; color: rgb(255, 192, 0); font-family: 宋体; line-height: normal; white-space: normal; outline: none !important; background-color: rgb(255, 255, 255);"><span style="box-sizing: border-box; outline: none !important; font-family: 微软雅黑; font-size: 18px;"><span style="box-sizing: border-box; font-family: 微软雅黑, 'Microsoft YaHei'; font-size: 20px; line-height: 36px; outline: none !important;">为了让您的VPlat虚拟化故障得到高效的处理,请上报故障到: </span><span style="box-sizing: border-box; font-family: 微软雅黑, 'Microsoft YaHei'; font-size: 20px; line-height: 17.1420001983643px; outline: none !important;">$VPlat技术支持。</span></span></strong></span></span></p><p style="font-family: 宋体; font-size: medium; line-height: normal; widows: 1;"><span style="font-size:12px;color:#58595B;font-family:微软雅黑"><span class="signedit" id="sign_name">芦志朋</span> <span style="font-family:Arial"><span class="signedit" id="sign_name_eng">luzhipeng</span></span></span></p><p style="font-size: 7.0px; line-height: normal; widows: 1;"><span style="font-size:12px;color:#58595B;font-family:微软雅黑;font-size: 7.0px;"><span style=""><span class="signedit"><br></span></span></span></p><p style="font-family: 宋体; font-size: medium; line-height: normal; widows: 1;"><span style="font-size:10px;color:#58595B;font-family:微软雅黑"><span class="signedit" id="sign_position">IT开发工程师</span> <span style="font-family:Arial"><span class="signedit" id="sign_position_eng">IT Development
Engineer</span></span></span><br><span style="font-size:10px;color:#58595B;font-family:微软雅黑"><span class="signedit" id="sign_dept">操作系统产品部/中心研究院/系统产品</span> <span style="font-family:Arial"> <span class="signedit" id="sign_dept_eng">OS Product Dept./Central R&D Institute/System Product</span></span></span></p><p style="font-size: 7.0px; line-height: normal; widows: 1;"><span style="font-size:10px;color:#58595B;font-family:微软雅黑;font-size: 7.0px;"><span style=""><span class="signedit"><br></span></span></span></p><p style="font-size: 7.0px; line-height: normal; widows: 1;"><span style="font-size:10px;color:#58595B;font-family:微软雅黑;font-size: 7.0px;"></span></p><table style="color: rgb(0, 0, 0); font-family: 宋体; widows: 1;"><tbody><tr class="firstRow"><td valign="top" width="100"><img id="sign-icon" src="cid:9ae3e214c17d49ed935d87c674ba3ee2" width="130" height="120"></td><td valign="top" width="500"><img id="sign-logo" src="cid:24242e5637af428891c4db731e7765ad" width="115" height="38"><br><span style="font-size:10px;color:#58595B;font-family:微软雅黑"><span class="signedit" id="sign_addr">深圳市南山区科技南路55号中兴通讯研发大楼33楼 </span><br><span style="font-family:Arial"><span class="signedit" id="sign_addr_eng_1">33/F, R&D Building, ZTE
Corporation Hi-tech Road South</span>, <br><span class="signedit" id="sign_addr_eng_2">Hi-tech
Industrial Park Nanshan District, Shenzhen, P.R.China, 518057</span> <br><span style="color:#008FD4">T</span>: <span class="signedit" id="sign_fix_phone">+86 755 xxxxxxxx</span> <span style="color:#008FD4">F</span>:<span class="signedit" id="sign_fax">+86 755 xxxxxxxx</span> <br><span style="color:#008FD4">M</span>: <span class="signedit" id="sign_phone">+86 xxxxxxxxxxx</span> <br><span style="color:#008FD4">E</span>: <span class="signedit" id="sign_email">lu.zhipeng@zte.com.cn</span> <br><span style="color:#008FD4"><a href="http://www.zte.com.cn/" target="_blank">www.zte.com.cn</a></span></span></span></td></tr></tbody></table><span style="line-height: normal; widows: 1; font-size: 7.0px;;color:#58595b;font-size:10px"></span></div></div></div></div></div><div><div class="zhistoryRow" style="display:block"><div class="zhistoryDes" style="width: 100%; height: 28px; line-height: 28px; background-color: #E0E5E9; color: #1388FF; text-align: center;" language-data="HistoryOrgTxt">原始邮件</div><div id="zwriteHistoryContainer"><div class="control-group zhistoryPanel"><div class="zhistoryHeader" style="padding: 8px; background-color: #F5F6F8;"><div><strong language-data="HistorySenderTxt">发件人:</strong><span class="zreadUserName"> <berrange@redhat.com>;</span></div><div><strong language-data="HistoryTOTxt">收件人:</strong><span class="zreadUserName" style="display: inline-block;">芦志朋10108272;</span></div><div><strong language-data="HistoryCCTxt">抄送人:</strong><span class="zreadUserName" style="display: inline-block;"> <libvir-list@redhat.com>;</span><span class="zreadUserName" style="display: inline-block;"> <laine@laine.org>;</span></div><div><strong language-data="HistoryDateTxt">日 期 :</strong><span class="">2017年05月08日 16:39</span></div><div><strong language-data="HistorySubjectTxt">主 题 :</strong><span class="zreadTitle"><strong>Re: [libvirt] [PATCH v2] qemu: clean up network interfaces beforeqemuProcessKill is called in qemuProcessStop</strong></span></div></div><p class="zhistoryContent"><br></p><div>On Mon, May 08, 2017 at 03:03:30PM +0800, ZhiPeng Lu wrote:<br>> In qemuProcessStop we explicitly remove the port from the openvswitch bridge after<br>> qemuProcessKill is called. But there is a certain interval of time between<br>> deleting tap device and removing it from bridge. The problem occurs when two vms<br>> start and shutdown with the same name's network interface attached to the same<br>> openvswitch bridge. When one vm with the nic named "vnet0" stopping, it deleted<br>> tap device without timely removing the port from bridge.<br>> At this time, another vm created the tap device named "vnet0" and added port to the<br>> same bridge. Then, the first vm removed the port from the same bridge.<br>> Finally, the tap device of the second vm did not attached to the bridge.<br>> We need to delete the bridge port before deleting the tap device instead of after.<br>> So what's needed is to move the loop in qemuProcessStop that cleans up<br>> network interfaces so that it happens before qemuProcessKill is called.<br><br>This fix won't work correctly either. You cannot assume that libvirt has<br>control over when the QEMU process exits. It may exit itself *before*<br>libvirt runs any of its cleanup code.<br><br><br>Regards,<br>Daniel<br>-- <br>|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|<br>|: https://libvirt.org         -o-            https://fstop138.berrange.com :|<br>|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|<br><br>--<br>libvir-list mailing list<br>libvir-list@redhat.com<br>https://www.redhat.com/mailman/listinfo/libvir-list<br></div><p><br></p></div></div></div></div><p><br></p> </div>