Libvirt-lxc will leak nbd devices on instance shutdown

Bug #1367363 reported by Andrew Melton
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Medium
Andrew Melton

Bug Description

Shutting down a libvirt-lxc based instance will leak the nbd device. This happens because _teardown_container will only be called when libvirt domain's are running. During a shutdown, the domain is not running at the time of the destroy. Thus, _teardown_container is never called and the nbd device is never disconnected.

Steps to reproduce:
1) Create devstack using local.conf: https://gist.github.com/ramielrowe/6ae233dc2c2cd479498a
2) Create an instance
3) Perform ps ax |grep nbd on devstack host. Observe connected nbd device
4) Shutdown instance
5) Perform ps ax |grep nbd on devstack host. Observe connected nbd device
6) Delete instance
7) Perform ps ax |grep nbd on devstack host. Observe connected nbd device

Nova has now leaked the nbd device.

Tags: libvirt
Changed in nova:
assignee: nobody → Andrew Melton (andrew-melton)
tags: added: libvirt
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

Fix proposed to branch: master
Review: https://review.openstack.org/120196

Changed in nova:
status: New → In Progress
Sean Dague (sdague)
Changed in nova:
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/120196
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=5f93c841a80663b68da2fb04df78d5acd0754d68
Submitter: Jenkins
Branch: master

commit 5f93c841a80663b68da2fb04df78d5acd0754d68
Author: Andrew Melton <email address hidden>
Date: Tue Sep 9 15:29:28 2014 -0400

    Libvirt: Always teardown lxc container on destroy

    This fixes a bug where shutting down a libvirt-lxc based instance
    would leak its underlying nbd device. This was happening because
    _teardown_container would only get called if the domain was
    present. After this fix, _teardown_container will always get called
    on a destroy, which ensures the nbd device gets disconnected.

    Change-Id: I8d0044fd038fef80568c6c86e34719ef679aa890
    Closes-Bug: #1367363

Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
milestone: none → kilo-1
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: kilo-1 → 2015.1.0
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.