Merge "Stop counting hw_video:ram_max_mb against quota"

This commit is contained in:
Jenkins
2017-07-14 15:34:04 +00:00
committed by Gerrit Code Review
2 changed files with 5 additions and 18 deletions
+4 -9
View File
@@ -96,7 +96,6 @@ CONF = nova.conf.CONF
MAX_USERDATA_SIZE = 65535
RO_SECURITY_GROUPS = ['default']
VIDEO_RAM = 'hw_video:ram_max_mb'
AGGREGATE_ACTION_UPDATE = 'Update'
AGGREGATE_ACTION_UPDATE_META = 'UpdateMeta'
@@ -346,8 +345,7 @@ class API(base.Base):
# Determine requested cores and ram
req_cores = max_count * instance_type['vcpus']
vram_mb = int(instance_type.get('extra_specs', {}).get(VIDEO_RAM, 0))
req_ram = max_count * (instance_type['memory_mb'] + vram_mb)
req_ram = max_count * instance_type['memory_mb']
# Check the quota
try:
@@ -371,8 +369,7 @@ class API(base.Base):
headroom['cores'] // instance_type['vcpus'])
if instance_type['memory_mb']:
allowed = min(allowed,
headroom['ram'] // (instance_type['memory_mb'] +
vram_mb))
headroom['ram'] // instance_type['memory_mb'])
# Convert to the appropriate exception message
if allowed <= 0:
@@ -2130,13 +2127,11 @@ class API(base.Base):
task_states.RESIZE_FINISH):
old_flavor = flavor or instance.old_flavor
instance_vcpus = old_flavor.vcpus
vram_mb = old_flavor.extra_specs.get('hw_video:ram_max_mb', 0)
instance_memory_mb = old_flavor.memory_mb + vram_mb
instance_memory_mb = old_flavor.memory_mb
else:
flavor = flavor or instance.flavor
instance_vcpus = flavor.vcpus
vram_mb = int(flavor.get('extra_specs', {}).get(VIDEO_RAM, 0))
instance_memory_mb = flavor.memory_mb + vram_mb
instance_memory_mb = flavor.memory_mb
quotas = objects.Quotas(context=context)
quotas.reserve(project_id=project_id,
+1 -9
View File
@@ -890,11 +890,9 @@ class _ComputeAPIUnitTestMixIn(object):
inst = self._create_instance_obj()
inst.update(attrs)
inst._context = self.context
vram_mb = int(inst.flavor.get('extra_specs',
{}).get(compute_api.VIDEO_RAM, 0))
deltas = {'instances': -1,
'cores': -inst.flavor.vcpus,
'ram': -(inst.flavor.memory_mb + vram_mb)}
'ram': -inst.flavor.memory_mb}
delete_time = datetime.datetime(1955, 11, 5, 9, 30,
tzinfo=iso8601.iso8601.Utc())
self.useFixture(utils_fixture.TimeFixture(delete_time))
@@ -1044,12 +1042,6 @@ class _ComputeAPIUnitTestMixIn(object):
def test_delete_in_resized(self):
self._test_delete('delete', vm_state=vm_states.RESIZED)
def test_delete_with_vram(self):
flavor = objects.Flavor(vcpus=1, memory_mb=512,
extra_specs={compute_api.VIDEO_RAM: "64"})
self._test_delete('delete',
flavor=flavor)
def test_delete_shelved(self):
fake_sys_meta = {'shelved_image_id': SHELVED_IMAGE}
self._test_delete('delete',