Libvirt-LXC can leave image mounted to host

Bug #1333827 reported by Rick Harris
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Undecided
Unassigned

Bug Description

If an error occurs creating a Libvirt+LXC domain, the code can leave the guest FS mounted to host preventing the `lvremove` of a delete from working.

The core problem here is that any code between `setup_container` and `teardown_container` needs be within a `try/finally` block, so that on error, we unmount the image from the host.

While we're at it, we can also cleanup the exception handling by reducing the 3 independent exception handlers into a single one, which is then followed by the `finally` clause.

Tags: libvirt lxc
Tracy Jones (tjones-i)
tags: added: libvirt
tags: added: lxc
Changed in nova:
assignee: nobody → Vladik Romanovsky (vladik-romanovsky)
Revision history for this message
Rick Harris (rconradharris) wrote :

Just FYI, proposed this patch a while back: https://review.openstack.org/#/c/102324/

Revision history for this message
Vladik Romanovsky (vladik-romanovsky) wrote :

OK. Usually, bugs are being assigned to the person who pushed the patch and change the status..

Changed in nova:
assignee: Vladik Romanovsky (vladik-romanovsky) → nobody
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/102324
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=60c90f73261efb8c73ecc02152307c81265cab13
Submitter: Jenkins
Branch: master

commit 60c90f73261efb8c73ecc02152307c81265cab13
Author: Rick Harris <email address hidden>
Date: Tue Jun 24 14:03:17 2014 -0500

    libvirt+lxc: Unmount guest FS from host on error

    If an error occurs during `_create_domain`, we need to ensure that the guest's
    FS is unmounted from the host in all cases.

    This is necessary because, if we leave the FS mounted to the host, the
    `lvremove` triggered by `delete` won't work because the filesystem will
    'still be in use'.

    The solution is to wrap the code in a `try/finally` to ensure the cleanup
    routines (which unmount) are always called.

    Change-Id: If863cf813dddc1e4554fb87b945c68b75b25f9a2
    Closes-Bug: 1333827

Changed in nova:
status: New → Fix Committed
Changed in nova:
milestone: none → juno-2
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: juno-2 → 2014.2
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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