Always use bdm in instance_block_mapping on Xen
It doesn't seem that Xen will set the 'root_device_name' property on instances. This is causing instance_block_mapping to return early without evaluating the bdm before returning the list of device_names in use. I'm not sure why instance_block_mapping does this (optimization?) but on Xen at least it seems that it should not. Added a check for Xen compute_driver flag in instance_block_mapping to "guess" the root_device_name (similarlly to what is done in compute.utils for swap and ephemeral). fixes bug #1061944 Change-Id: If5b1a2b7377232c78f0629a3624552ecf6ceb0ee
This commit is contained in:
@@ -17,6 +17,9 @@
|
|||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
from nova import flags
|
||||||
|
|
||||||
|
FLAGS = flags.FLAGS
|
||||||
|
|
||||||
DEFAULT_ROOT_DEV_NAME = '/dev/sda1'
|
DEFAULT_ROOT_DEV_NAME = '/dev/sda1'
|
||||||
_DEFAULT_MAPPINGS = {'ami': 'sda1',
|
_DEFAULT_MAPPINGS = {'ami': 'sda1',
|
||||||
@@ -89,8 +92,12 @@ def strip_prefix(device_name):
|
|||||||
|
|
||||||
def instance_block_mapping(instance, bdms):
|
def instance_block_mapping(instance, bdms):
|
||||||
root_device_name = instance['root_device_name']
|
root_device_name = instance['root_device_name']
|
||||||
|
# NOTE(clayg): remove this when xenapi is setting default_root_device
|
||||||
if root_device_name is None:
|
if root_device_name is None:
|
||||||
return _DEFAULT_MAPPINGS
|
if FLAGS.compute_driver.endswith('xenapi.XenAPIDriver'):
|
||||||
|
root_device_name = '/dev/xvda'
|
||||||
|
else:
|
||||||
|
return _DEFAULT_MAPPINGS
|
||||||
|
|
||||||
mappings = {}
|
mappings = {}
|
||||||
mappings['ami'] = strip_dev(root_device_name)
|
mappings['ami'] = strip_dev(root_device_name)
|
||||||
|
|||||||
Reference in New Issue
Block a user