summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
authorIsaku Yamahata <yamahata@valinux.co.jp>2011-09-13 21:04:13 +0000
committerTarmac <>2011-09-13 21:04:13 +0000
commit95b024d53c0c54197ef69d436aa2da1da373ff12 (patch)
tree09f9358b50f0192796ce9edc395be904fcf3b363 /nova/api
parent2f45e36060378048de0fec0cb1fa47da51f7a633 (diff)
parentd8abe79da8dde2667936ee97d88d30d5cf0e6d7f (diff)
downloadnova-95b024d53c0c54197ef69d436aa2da1da373ff12.tar.gz
nova-95b024d53c0c54197ef69d436aa2da1da373ff12.tar.xz
nova-95b024d53c0c54197ef69d436aa2da1da373ff12.zip
This patch teaches virt/libvirt how to format filesystem on ephemeral device depending on os_type so that the behaviour matches with EC2's.
Such behaviour isn't explicitly described in the documentation, but it is confirmed by checking realy EC2 instances. This patch introduces options virt_mkfs as multistring. Its format is --virt_mkfs=<os_type>=<mkfs command> When creating ephemeral device, format it according to the option depending on os_type. This addresses the bugs, https://bugs.launchpad.net/nova/+bug/827598 https://bugs.launchpad.net/nova/+bug/828357
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/ec2/cloud.py28
1 files changed, 25 insertions, 3 deletions
diff --git a/nova/api/ec2/cloud.py b/nova/api/ec2/cloud.py
index eacfdc0df..0efb90d6e 100644
--- a/nova/api/ec2/cloud.py
+++ b/nova/api/ec2/cloud.py
@@ -272,11 +272,23 @@ class CloudController(object):
mappings = {}
mappings['ami'] = block_device.strip_dev(root_device_name)
mappings['root'] = root_device_name
-
- # 'ephemeralN' and 'swap'
+ default_local_device = instance_ref.get('default_local_device')
+ if default_local_device:
+ mappings['ephemeral0'] = default_local_device
+ default_swap_device = instance_ref.get('default_swap_device')
+ if default_swap_device:
+ mappings['swap'] = default_swap_device
+ ebs_devices = []
+
+ # 'ephemeralN', 'swap' and ebs
for bdm in db.block_device_mapping_get_all_by_instance(
ctxt, instance_ref['id']):
- if (bdm['volume_id'] or bdm['snapshot_id'] or bdm['no_device']):
+ if bdm['no_device']:
+ continue
+
+ # ebs volume case
+ if (bdm['volume_id'] or bdm['snapshot_id']):
+ ebs_devices.append(bdm['device_name'])
continue
virtual_name = bdm['virtual_name']
@@ -286,6 +298,16 @@ class CloudController(object):
if block_device.is_swap_or_ephemeral(virtual_name):
mappings[virtual_name] = bdm['device_name']
+ # NOTE(yamahata): I'm not sure how ebs device should be numbered.
+ # Right now sort by device name for deterministic
+ # result.
+ if ebs_devices:
+ nebs = 0
+ ebs_devices.sort()
+ for ebs in ebs_devices:
+ mappings['ebs%d' % nebs] = ebs
+ nebs += 1
+
return mappings
def get_metadata(self, address):