summaryrefslogtreecommitdiffstats
path: root/nova/block_device.py
diff options
context:
space:
mode:
authorClay Gerrard <clay.gerrard@gmail.com>2012-10-04 18:50:39 -0500
committerClay Gerrard <clay.gerrard@gmail.com>2012-10-04 18:59:43 -0500
commit07845ad68f83952bbae36b4b115ff6c433e81fa3 (patch)
tree5d5e82b6731287b81aaadff2781193d50e142b42 /nova/block_device.py
parentb1896ede6999b37757f73d1a31d53789c341ef7f (diff)
downloadnova-07845ad68f83952bbae36b4b115ff6c433e81fa3.tar.gz
nova-07845ad68f83952bbae36b4b115ff6c433e81fa3.tar.xz
nova-07845ad68f83952bbae36b4b115ff6c433e81fa3.zip
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
Diffstat (limited to 'nova/block_device.py')
-rw-r--r--nova/block_device.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/nova/block_device.py b/nova/block_device.py
index bce71e183..031fcae16 100644
--- a/nova/block_device.py
+++ b/nova/block_device.py
@@ -17,6 +17,9 @@
import re
+from nova import flags
+
+FLAGS = flags.FLAGS
DEFAULT_ROOT_DEV_NAME = '/dev/sda1'
_DEFAULT_MAPPINGS = {'ami': 'sda1',
@@ -89,8 +92,12 @@ def strip_prefix(device_name):
def instance_block_mapping(instance, bdms):
root_device_name = instance['root_device_name']
+ # NOTE(clayg): remove this when xenapi is setting default_root_device
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['ami'] = strip_dev(root_device_name)