Skip to content

Commit

Permalink
Bug Fix: 1323204
Browse files Browse the repository at this point in the history
The root cause of this issue is that libvirt can not free up vhost-net for the tap device
which has been already deleted by nova compute (contrail) vif driver. As a result, qemu
cores when interface-detach is attempted. Since libvirt doesn't create the tap device (for
ethernet type interface), it can not delete it as it doens't own the device. The fix is to
not delete the tap device from unplug call, rather delegate this work to a deferred thread,
which deletes it after vhost-net is freed up by libvirt.

Change-Id: I4588f571b6699a64a931b492debd8dee14bf4b3f
Signed-off-by: Anirban Chakraborty <abchak@juniper.net>
  • Loading branch information
anirban-c committed Sep 3, 2014
1 parent 59fde86 commit 7a53cd5
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions nova_contrail_vif/contrailvif.py
Expand Up @@ -16,6 +16,8 @@
# under the License.

import gettext
import threading
import time

gettext.install('contrail_vif')

Expand Down Expand Up @@ -97,7 +99,17 @@ def unplug(self, instance, vif):

try:
self._vrouter_client.delete_port(vif['id'])
linux_net.delete_net_dev(dev)
except (TApplicationException, processutils.ProcessExecutionError):
#delegate the deletion of tap device to a deffered thread
worker_thread = threading.Thread(target=self.delete_device, \
name='contrailvif', args=(dev,))
worker_thread.start()
except (TApplicationException, processutils.ProcessExecutionError,\
RuntimeError):
LOG.exception(_LE("Failed while unplugging vif"),
instance=instance)

def delete_device(self, dev):
time.sleep(2)
LOG.debug(dev)
linux_net.delete_net_dev(dev)

0 comments on commit 7a53cd5

Please sign in to comment.