Add same extra specs as self.flavor_ref for created new flavor
In some environments, some extra specs must be set for the flavors
that will be used to create server, e.g., flavor extra specs
{"hw:mem_page_size": "large"} needs to be set if all compute nodes use
huge page and the system demmands explicit huge page filtering, in
this case if no {"hw:mem_page_size": "large"} extra specs is set for
the flavor, when creating server we will get
"BuildErrorException: Server 921aa25c-d182-4b53-88d1-90e003b17212 failed
to build and is in ERROR status
Details: {'message': 'No valid host was found. There are not enough hosts
available.', 'code': 500, 'created': '2017-12-14T05:33:52Z'}"
Another usecase is if there are many compute nodes, e.g., more than 20
compute nodes, we may want to limit the tempest execution on part of them
(maybe not all nodes are suitable for the test), so we can add
{"aggregate_instance_extra_specs:availability_zone": "tempest-zone"}
for the predefined flavor for it to choose only specified compute nodes.
Usually we will set the correct extra specs for the flavors that will
be filled as CONF.compute.flavor_ref and CONF.compute.flavor_ref_alt,
so it's ok to use these flavors to create servers, but if we need to
create a new flavor in testcases to create server, and if no extra specs
is set for it, creating server may fail.
So this is to add same extra specs as self.flavor_ref for the created
flavor that will be used to create server, and we don't need to do this
for those created flavors that won't be used to create servers.
Change-Id: I7dea2ef41bd686b544ead7f1ba0587720c3a3c44
Closes-bug: #1742132
(cherry picked from commit c88e0a1fb884657e4ca298563840a11144aa7a01)
Closes-Issue: https://mirantis.jira.com/browse/PROD-22800
2 files changed