summaryrefslogtreecommitdiffstats
path: root/nova/compute
diff options
context:
space:
mode:
authorJohannes Erdfelt <johannes.erdfelt@rackspace.com>2012-01-06 12:57:37 -0800
committerJohannes Erdfelt <johannes.erdfelt@rackspace.com>2012-01-24 16:54:23 +0000
commita4223f1d89ea7033cbae35790a0411ec439cdb6d (patch)
treebf3768b78a9ab8633b525b17579bc8326bbcab63 /nova/compute
parent91bc67d81a9711fbf5a0f0c46bbf1d87232391f8 (diff)
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
Diffstat (limited to 'nova/compute')
-rw-r--r--nova/compute/api.py11
-rw-r--r--nova/compute/instance_types.py5
-rw-r--r--nova/compute/manager.py16
3 files changed, 18 insertions, 14 deletions
diff --git a/nova/compute/api.py b/nova/compute/api.py
index ca28f3871..a4c228e26 100644
--- a/nova/compute/api.py
+++ b/nova/compute/api.py
@@ -226,7 +226,7 @@ class API(base.Base):
if instance_type['memory_mb'] < int(image.get('min_ram') or 0):
raise exception.InstanceTypeMemoryTooSmall()
- if instance_type['local_gb'] < int(image.get('min_disk') or 0):
+ if instance_type['root_gb'] < int(image.get('min_disk') or 0):
raise exception.InstanceTypeDiskTooSmall()
config_drive_id = None
@@ -315,7 +315,8 @@ class API(base.Base):
'instance_type_id': instance_type['id'],
'memory_mb': instance_type['memory_mb'],
'vcpus': instance_type['vcpus'],
- 'local_gb': instance_type['local_gb'],
+ 'root_gb': instance_type['root_gb'],
+ 'ephemeral_gb': instance_type['ephemeral_gb'],
'display_name': display_name,
'display_description': display_description,
'user_data': user_data or '',
@@ -376,13 +377,13 @@ class API(base.Base):
# TODO(yamahata): ephemeralN where N > 0
# Only ephemeral0 is allowed for now because InstanceTypes
- # table only allows single local disk, local_gb.
+ # table only allows single local disk, ephemeral_gb.
# In order to enhance it, we need to add a new columns to
# instance_types table.
if num > 0:
return 0
- size = instance_type.get('local_gb')
+ size = instance_type.get('ephemeral_gb')
return size
@@ -1240,7 +1241,7 @@ class API(base.Base):
#disk format of vhd is non-shrinkable
if orig_image.get('disk_format') == 'vhd':
min_ram = instance['instance_type']['memory_mb']
- min_disk = instance['instance_type']['local_gb']
+ min_disk = instance['instance_type']['root_gb']
else:
#set new image values to the original image values
min_ram = orig_image.get('min_ram')
diff --git a/nova/compute/instance_types.py b/nova/compute/instance_types.py
index 58f479a07..191f9ca0e 100644
--- a/nova/compute/instance_types.py
+++ b/nova/compute/instance_types.py
@@ -30,13 +30,14 @@ FLAGS = flags.FLAGS
LOG = logging.getLogger('nova.instance_types')
-def create(name, memory, vcpus, local_gb, flavorid, swap=0,
+def create(name, memory, vcpus, root_gb, ephemeral_gb, flavorid, swap=0,
rxtx_factor=1):
"""Creates instance types."""
kwargs = {
'memory_mb': memory,
'vcpus': vcpus,
- 'local_gb': local_gb,
+ 'root_gb': root_gb,
+ 'ephemeral_gb': ephemeral_gb,
'swap': swap,
'rxtx_factor': rxtx_factor,
}
diff --git a/nova/compute/manager.py b/nova/compute/manager.py
index 65985ca02..f43c7a1a0 100644
--- a/nova/compute/manager.py
+++ b/nova/compute/manager.py
@@ -432,12 +432,12 @@ class ComputeManager(manager.SchedulerDependentManager):
instance_type_id = instance['instance_type_id']
instance_type = instance_types.get_instance_type(instance_type_id)
- allowed_size_gb = instance_type['local_gb']
+ allowed_size_gb = instance_type['root_gb']
- # NOTE(jk0): Since libvirt uses local_gb as a secondary drive, we
- # need to handle potential situations where local_gb is 0. This is
- # the default for m1.tiny.
- if allowed_size_gb == 0:
+ # NOTE(johannes): root_gb is allowed to be 0 for legacy reasons
+ # since libvirt interpreted the value differently than other
+ # drivers. A value of 0 means don't check size.
+ if not allowed_size_gb:
return image_meta
allowed_size_bytes = allowed_size_gb * 1024 * 1024 * 1024
@@ -1111,7 +1111,8 @@ class ComputeManager(manager.SchedulerDependentManager):
memory_mb=instance_type['memory_mb'],
host=migration_ref['source_compute'],
vcpus=instance_type['vcpus'],
- local_gb=instance_type['local_gb'],
+ root_gb=instance_type['root_gb'],
+ ephemeral_gb=instance_type['ephemeral_gb'],
instance_type_id=instance_type['id'])
self.driver.finish_revert_migration(instance_ref)
@@ -1238,7 +1239,8 @@ class ComputeManager(manager.SchedulerDependentManager):
dict(instance_type_id=instance_type['id'],
memory_mb=instance_type['memory_mb'],
vcpus=instance_type['vcpus'],
- local_gb=instance_type['local_gb']))
+ root_gb=instance_type['root_gb'],
+ ephemeral_gb=instance_type['ephemeral_gb']))
resize_instance = True
instance_ref = self.db.instance_get_by_uuid(context,