Allow i2 option to be independent option for flavor creation

Change-Id: I5d0f27544fa40d43d4b416d1d8e11d107ec44176
This commit is contained in:
Chi Lo 2020-03-20 13:35:37 -07:00
parent 0d9596317e
commit 4dbd0e4058
2 changed files with 8 additions and 6 deletions

View File

@ -491,6 +491,10 @@ class Flavor(Model):
self.options[n].lower() == 'true']
if option_pci:
es = db_models.FlavorExtraSpec(
key_name_value=series_metadata[
'es_pci_numa_affinity_policy'])
extra_spec_needed.append(es)
requested_options.extend(option_pci)
# Evaluate thread options

View File

@ -504,7 +504,7 @@ def delete_extra_specs(flavor_id, transaction_id, extra_spec=None):
flavor_id))
existing_region_names = sql_flavor.get_existing_region_names()
# calculate default flavor extra
# calculate default and options extra specs
flavor_wrapper = FlavorWrapper.from_db_model(sql_flavor)
default_extra_specs = flavor_wrapper.get_extra_spec_needed()
# check if delete all or one
@ -512,8 +512,8 @@ def delete_extra_specs(flavor_id, transaction_id, extra_spec=None):
if not extra_spec_in_default(extra_spec, default_extra_specs):
sql_flavor.remove_extra_spec(extra_spec)
else:
raise ErrorStatus(400,
"Bad request, this key cannot be deleted")
raise ErrorStatus(
400, "Deletion not allowed for {0}".format(extra_spec))
else:
sql_flavor.delete_all_extra_specs()
sql_flavor.add_extra_specs(default_extra_specs)
@ -945,7 +945,7 @@ def calculate_name(flavor):
- flavor options (OPTIONAL)
Following is a sample flavor name:
name = xx.c1r1d1s4e5.i2n0
name = xx.c1r1d1s4e5.n0i2
where xx : flavor series name
c1 : number of cores (or cpu); sample shows vcpu = 1
@ -985,8 +985,6 @@ def calculate_name(flavor):
list(flavor.flavor.options.keys()) and
flavor.flavor.options[n].lower() == 'true']
if 'i2' in options and 'n0' not in options:
options.remove('i2')
if 't0' in options and flavor.flavor.visibility.lower() != 'private':
options.remove('t0')