summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
authorIsaku Yamahata <yamahata@valinux.co.jp>2011-07-23 16:55:25 +0900
committerIsaku Yamahata <yamahata@valinux.co.jp>2011-07-23 16:55:25 +0900
commit1f55e116adbf00a0a5bd990f99a680e9d6b1618e (patch)
treed476bd802604d7addc997d350c361454bce0d3ea /nova/api
parent1a18ea6d738b513e03e3f0eddfb9f01dff9addca (diff)
downloadnova-1f55e116adbf00a0a5bd990f99a680e9d6b1618e.tar.gz
nova-1f55e116adbf00a0a5bd990f99a680e9d6b1618e.tar.xz
nova-1f55e116adbf00a0a5bd990f99a680e9d6b1618e.zip
ec2utils: factor generic helper function into generic place
This patch moves out a helper function, properties_root_device_name(), into generic file nova/block_device.py.
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/ec2/cloud.py5
-rw-r--r--nova/api/ec2/ec2utils.py19
2 files changed, 3 insertions, 21 deletions
diff --git a/nova/api/ec2/cloud.py b/nova/api/ec2/cloud.py
index 16ca1ed2a..b25f74f61 100644
--- a/nova/api/ec2/cloud.py
+++ b/nova/api/ec2/cloud.py
@@ -30,6 +30,7 @@ import tempfile
import time
import shutil
+from nova import block_device
from nova import compute
from nova import context
@@ -1240,7 +1241,7 @@ class CloudController(object):
i['architecture'] = image['properties'].get('architecture')
properties = image['properties']
- root_device_name = ec2utils.properties_root_device_name(properties)
+ root_device_name = block_device.properties_root_device_name(properties)
root_device_type = 'instance-store'
for bdm in properties.get('block_device_mapping', []):
if (bdm.get('device_name') == root_device_name and
@@ -1313,7 +1314,7 @@ class CloudController(object):
def _root_device_name_attribute(image, result):
result['rootDeviceName'] = \
- ec2utils.properties_root_device_name(image['properties'])
+ block_device.properties_root_device_name(image['properties'])
if result['rootDeviceName'] is None:
result['rootDeviceName'] = _DEFAULT_ROOT_DEVICE_NAME
diff --git a/nova/api/ec2/ec2utils.py b/nova/api/ec2/ec2utils.py
index bae1e0ee5..14891debb 100644
--- a/nova/api/ec2/ec2utils.py
+++ b/nova/api/ec2/ec2utils.py
@@ -137,25 +137,6 @@ def dict_from_dotted_str(items):
return args
-def properties_root_device_name(properties):
- """get root device name from image meta data.
- If it isn't specified, return None.
- """
- root_device_name = None
-
- # NOTE(yamahata): see image_service.s3.s3create()
- for bdm in properties.get('mappings', []):
- if bdm['virtual'] == 'root':
- root_device_name = bdm['device']
-
- # NOTE(yamahata): register_image's command line can override
- # <machine>.manifest.xml
- if 'root_device_name' in 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: