summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
authorIsaku Yamahata <yamahata@valinux.co.jp>2011-06-23 19:51:00 +0900
committerIsaku Yamahata <yamahata@valinux.co.jp>2011-06-23 19:51:00 +0900
commit1c4a3e14a0cef6938c477908d5c3bfe5ddf0e07b (patch)
tree4016a9d7c57ba487150f2d43fb1b0eff47f9b925 /nova/api
parentc24b30c9a060e50c7bd953a7d68c409416f4f752 (diff)
ec2utils: introduce helper function to prepend '/dev/' in mappings
Introduce a helper function to prepend /dev/ to device name in block device mapping of bundle
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/ec2/ec2utils.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/nova/api/ec2/ec2utils.py b/nova/api/ec2/ec2utils.py
index 9839f8604..bae1e0ee5 100644
--- a/nova/api/ec2/ec2utils.py
+++ b/nova/api/ec2/ec2utils.py
@@ -154,3 +154,13 @@ def properties_root_device_name(properties):
root_device_name = properties['root_device_name']
return root_device_name
+
+
+def mappings_prepend_dev(mappings):
+ """Prepend '/dev/' to 'device' entry of swap/ephemeral virtual type"""
+ for m in mappings:
+ virtual = m['virtual']
+ if ((virtual == 'swap' or virtual.startswith('ephemeral')) and
+ (not m['device'].startswith('/'))):
+ m['device'] = '/dev/' + m['device']
+ return mappings