<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">
<div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;">
Hi</div>
<div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;">
There seems to be a corner case bug in nova code. Steps to reproduce it are</div>
<ol style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;">
<li>Create a neutron port  </li><li>Create a VM and launch instance with this port</li><li>Shutdown nova compute and network agent on compute node</li><li>Unbind port from VM and delete the VM (offline delete) </li><li>Now create a VM with same port but on a different VM</li><li>Bring up nova compute on old node</li></ol>
<div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;">
It basically runs the reap for deleted instances and cleanes up VM from libvirt. In the process it unbinds the pre-existing ports and ends up unbinding the port from an active VM</div>
<div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;">
Reason nova simply sends a blind port-update with binding_host: “” even if that port is bound to a different instance</div>
<div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;">
<br>
</div>
<div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;">
<br>
</div>
<div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;">
So following fix seemed to help any suggestions on a better fix</div>
<div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;">
<br>
</div>
<div><font face="Calibri,sans-serif">In </font><font face="Menlo"><span style="font-size: 12px;">nova/network/neutronv2/api.py. So basically when neutron sees no ports for this instance don’t attempt an unbind</span></font></div>
<div><font face="Menlo"><span style="font-size: 12px;">In this case </span></font><span style="font-family: Menlo; font-size: 12px;">        </span></div>
<div><span style="font-family: Menlo; font-size: 12px;">data = neutron.list_ports(**search_opts)</span></div>
<div><font face="Menlo"><span style="font-size: 12px;">C</span></font><span style="font-family: Menlo; font-size: 12px;">all in </span><span style="font-family: Menlo; font-size: 12px;">deallocate_for_instance returns empty ports</span></div>
<div><span style="font-family: Menlo; font-size: 12px;"><br>
</span></div>
<div><font face="Menlo"><span style="font-size: 12px;"><br>
</span></font></div>
<div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;">
<span style="font-family: Menlo; font-size: 12px;"><br>
</span></div>
<div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;">
<p style="margin: 0px; font-size: 12px; line-height: normal; font-family: Menlo;">
<span style="font-variant-ligatures: no-common-ligatures">      # Reset device_id and device_owner for the ports that are skipped</span></p>
<p style="margin: 0px; font-size: 12px; line-height: normal; font-family: Menlo;">
<span style="font-variant-ligatures: no-common-ligatures">        if data.get('ports', []):</span></p>
<p style="margin: 0px; font-size: 12px; line-height: normal; font-family: Menlo;">
<span style="font-variant-ligatures: no-common-ligatures">            self._unbind_ports(context, ports_to_skip, neutron)</span></p>
<p style="margin: 0px; font-size: 12px; line-height: normal; font-family: Menlo;">
<span style="font-variant-ligatures: no-common-ligatures">        else:</span></p>
<p style="margin: 0px; font-size: 12px; line-height: normal; font-family: Menlo;">
<span style="font-variant-ligatures: no-common-ligatures">            LOG.debug("Neutron sees a different view of this port hence skipping unbind”)</span></p>
<p style="margin: 0px; font-size: 12px; line-height: normal; font-family: Menlo;">
<span style="font-variant-ligatures: no-common-ligatures"><br>
</span></p>
<p style="margin: 0px; font-size: 12px; line-height: normal; font-family: Menlo;">
<span style="font-variant-ligatures: no-common-ligatures"><br>
</span></p>
<p style="margin: 0px; font-size: 12px; line-height: normal; font-family: Menlo;">
<span style="font-variant-ligatures: no-common-ligatures">Ajay</span></p>
<p style="margin: 0px; font-size: 12px; line-height: normal; font-family: Menlo;">
<span style="font-variant-ligatures: no-common-ligatures"><br>
</span></p>
</div>
<div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;">
<div id="MAC_OUTLOOK_SIGNATURE"></div>
</div>
</body>
</html>