LXC instances cannot boot from volume

Bug #1458354 reported by Daniel Stelter-Gliese
24
This bug affects 4 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Undecided
Sudipta Biswas

Bug Description

Nova Version: Kilo; 1:2015.1.0-0ubuntu1~cloud0

Steps to reproduce:
1. Create volume from image
2. Boot new instance from this volume
3. Observe error in nova-compute.log

Expected result: Instance boots successfully
Actual result: Failed to prep block device error

----------------------------------------------------------------------------------------------------------
When booting an LXC instance from an existing volume, nova-compute fails with:

  File "/usr/lib/python2.7/dist-packages/nova/virt/libvirt/driver.py", line 4290, in _lxc_disk_handler
    block_device_info, disk_info)
  File "/usr/lib/python2.7/dist-packages/nova/virt/libvirt/driver.py", line 4226, in _create_domain_setup_lxc
    disk_path = root_disk['connection_info']['data']['device_path']
KeyError: 'device_path'

This happens directly before connecting the volume. Debugging shows that the device path is indeed not present at this stage - but rather it shows up directly after _connect_volume(). Moving the faulting line down seems to solve the issue:

--- a/nova/virt/libvirt/driver.py 2015-05-24 19:37:34.909039728 +0200
+++ b/nova/virt/libvirt/driver.py 2015-05-24 19:36:58.225923316 +0200
@@ -4221,10 +4221,10 @@

         if self._is_booted_from_volume(instance, disk_mapping):
             root_disk = block_device.get_root_bdm(block_device_mapping)
- disk_path = root_disk['connection_info']['data']['device_path']
             disk_info = blockinfo.get_info_from_bdm(
                 CONF.libvirt.virt_type, image_meta, root_disk)
             self._connect_volume(root_disk['connection_info'], disk_info)
+ disk_path = root_disk['connection_info']['data']['device_path']

             # Get the system metadata from the instance
             use_cow = instance.system_metadata['image_disk_format'] == 'qcow2'

Tags: lxc volumes
tags: added: lxc volumes
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/188025

Changed in nova:
assignee: nobody → Daniel Stelter-Gliese (daniel-stelter-gliese)
status: New → In Progress
Changed in nova:
assignee: Daniel Stelter-Gliese (daniel-stelter-gliese) → Sudipta Biswas (sbiswas7)
Revision history for this message
Sudipta Biswas (sbiswas7) wrote :

Daniel - you seemed to have the fix for this bug out for review already.
Any reason you assigned this to me? :)

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

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

commit c9d4dd3d1409f73d18537a9737c67dcadaf3428e
Author: Daniel Stelter-Gliese <email address hidden>
Date: Wed Jun 3 16:24:40 2015 +0200

    libvirt: Fix KeyError during LXC instance boot

    The local device path is populated by connect_volume, accessing it
    earlier will result in a KeyError being thrown.

    Change-Id: I2125c568adf61a5a34e494414c0a8ae9547c67dd
    Closes-Bug: #1458354

Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
milestone: none → liberty-3
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: liberty-3 → 12.0.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.