From a4223f1d89ea7033cbae35790a0411ec439cdb6d Mon Sep 17 00:00:00 2001 From: Johannes Erdfelt Date: Fri, 6 Jan 2012 12:57:37 -0800 Subject: KVM and XEN Disk Management Parity Implements blueprint disk-configuration-parity This change splits local_gb into root_gb and ephemeral_gb. libvirt interpreted local_gb as what ephemeral_gb is now, whereas XenAPI interpreted local_gb as what root_gb is now. Change-Id: I496600991bac1e990326d4ded1607fee08209d68 --- nova/api/ec2/admin.py | 2 +- nova/api/metadata/handler.py | 7 ++++--- nova/api/openstack/compute/contrib/simple_tenant_usage.py | 2 +- nova/api/openstack/compute/flavors.py | 2 +- nova/api/openstack/compute/views/flavors.py | 2 +- 5 files changed, 8 insertions(+), 7 deletions(-) (limited to 'nova/api') diff --git a/nova/api/ec2/admin.py b/nova/api/ec2/admin.py index de2348c91..80a30659d 100644 --- a/nova/api/ec2/admin.py +++ b/nova/api/ec2/admin.py @@ -89,7 +89,7 @@ def instance_dict(inst): return {'name': inst['name'], 'memory_mb': inst['memory_mb'], 'vcpus': inst['vcpus'], - 'disk_gb': inst['local_gb'], + 'disk_gb': inst['root_gb'], 'flavor_id': inst['flavorid']} diff --git a/nova/api/metadata/handler.py b/nova/api/metadata/handler.py index 04e64bd57..7cf5514a3 100644 --- a/nova/api/metadata/handler.py +++ b/nova/api/metadata/handler.py @@ -100,9 +100,10 @@ class MetadataRequestHandler(wsgi.Application): mappings = {} mappings['ami'] = block_device.strip_dev(root_device_name) mappings['root'] = root_device_name - default_local_device = instance_ref.get('default_local_device') - if default_local_device: - mappings['ephemeral0'] = default_local_device + default_ephemeral_device = \ + instance_ref.get('default_ephemeral_device') + if default_ephemeral_device: + mappings['ephemeral0'] = default_ephemeral_device default_swap_device = instance_ref.get('default_swap_device') if default_swap_device: mappings['swap'] = default_swap_device diff --git a/nova/api/openstack/compute/contrib/simple_tenant_usage.py b/nova/api/openstack/compute/contrib/simple_tenant_usage.py index f34581f6c..85ea9a859 100644 --- a/nova/api/openstack/compute/contrib/simple_tenant_usage.py +++ b/nova/api/openstack/compute/contrib/simple_tenant_usage.py @@ -135,7 +135,7 @@ class SimpleTenantUsageController(object): info['name'] = instance['display_name'] info['memory_mb'] = flavor['memory_mb'] - info['local_gb'] = flavor['local_gb'] + info['local_gb'] = flavor['root_gb'] + flavor['ephemeral_gb'] info['vcpus'] = flavor['vcpus'] info['tenant_id'] = instance['project_id'] diff --git a/nova/api/openstack/compute/flavors.py b/nova/api/openstack/compute/flavors.py index c7ceecbec..99f6f44d8 100644 --- a/nova/api/openstack/compute/flavors.py +++ b/nova/api/openstack/compute/flavors.py @@ -104,7 +104,7 @@ class Controller(wsgi.Controller): if 'minDisk' in req.params: try: - filters['min_local_gb'] = int(req.params['minDisk']) + filters['min_root_gb'] = int(req.params['minDisk']) except ValueError: pass # ignore bogus values per spec diff --git a/nova/api/openstack/compute/views/flavors.py b/nova/api/openstack/compute/views/flavors.py index 050ea20d3..729c4df24 100644 --- a/nova/api/openstack/compute/views/flavors.py +++ b/nova/api/openstack/compute/views/flavors.py @@ -37,7 +37,7 @@ class ViewBuilder(common.ViewBuilder): "id": flavor["flavorid"], "name": flavor["name"], "ram": flavor["memory_mb"], - "disk": flavor["local_gb"], + "disk": flavor["root_gb"], "vcpus": flavor.get("vcpus") or "", "swap": flavor.get("swap") or "", "rxtx_factor": flavor.get("rxtx_factor") or "", -- cgit