Add amphora image tag capability to Octavia flavors
This patch adds 'amp_image_tag' to the supported capabilities of the amphora provider driver. One use case where operators could find this relevant is on multi CPU architecture clouds. Task: 40156 Story: 2007854 Change-Id: Id4141e820a8b34e379a8f60b53fc183680c55c79
This commit is contained in:
parent
a422e5a203
commit
ea0bbd2775
@ -43,6 +43,10 @@ SUPPORTED_FLAVOR_SCHEMA = {
|
|||||||
consts.COMPUTE_FLAVOR: {
|
consts.COMPUTE_FLAVOR: {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "The compute driver flavor ID."
|
"description": "The compute driver flavor ID."
|
||||||
|
},
|
||||||
|
consts.AMP_IMAGE_TAG: {
|
||||||
|
"type": "string",
|
||||||
|
"description": "The amphora image tag."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -408,6 +408,26 @@ class AmphoraProviderDriver(driver_base.ProviderDriver):
|
|||||||
# when the octavia-lib supports it.
|
# when the octavia-lib supports it.
|
||||||
compute_driver.validate_flavor(compute_flavor)
|
compute_driver.validate_flavor(compute_flavor)
|
||||||
|
|
||||||
|
amp_image_tag = flavor_dict.get(consts.AMP_IMAGE_TAG, None)
|
||||||
|
if amp_image_tag:
|
||||||
|
image_driver = stevedore_driver.DriverManager(
|
||||||
|
namespace='octavia.image.drivers',
|
||||||
|
name=CONF.controller_worker.image_driver,
|
||||||
|
invoke_on_load=True
|
||||||
|
).driver
|
||||||
|
|
||||||
|
try:
|
||||||
|
image_driver.get_image_id_by_tag(
|
||||||
|
amp_image_tag, CONF.controller_worker.amp_image_owner_id)
|
||||||
|
except Exception as e:
|
||||||
|
raise exceptions.NotFound(
|
||||||
|
user_fault_string='Failed to find an image with tag {} '
|
||||||
|
'due to: {}'.format(
|
||||||
|
amp_image_tag, str(e)),
|
||||||
|
operator_fault_string='Failed to find an image with tag '
|
||||||
|
'{} due to: {}'.format(
|
||||||
|
amp_image_tag, str(e)))
|
||||||
|
|
||||||
# Availability Zone
|
# Availability Zone
|
||||||
def get_supported_availability_zone_metadata(self):
|
def get_supported_availability_zone_metadata(self):
|
||||||
"""Returns the valid availability zone metadata keys and descriptions.
|
"""Returns the valid availability zone metadata keys and descriptions.
|
||||||
|
@ -413,6 +413,26 @@ class AmphoraProviderDriver(driver_base.ProviderDriver):
|
|||||||
# when the octavia-lib supports it.
|
# when the octavia-lib supports it.
|
||||||
compute_driver.validate_flavor(compute_flavor)
|
compute_driver.validate_flavor(compute_flavor)
|
||||||
|
|
||||||
|
amp_image_tag = flavor_dict.get(consts.AMP_IMAGE_TAG, None)
|
||||||
|
if amp_image_tag:
|
||||||
|
image_driver = stevedore_driver.DriverManager(
|
||||||
|
namespace='octavia.image.drivers',
|
||||||
|
name=CONF.controller_worker.image_driver,
|
||||||
|
invoke_on_load=True
|
||||||
|
).driver
|
||||||
|
|
||||||
|
try:
|
||||||
|
image_driver.get_image_id_by_tag(
|
||||||
|
amp_image_tag, CONF.controller_worker.amp_image_owner_id)
|
||||||
|
except Exception as e:
|
||||||
|
raise exceptions.NotFound(
|
||||||
|
user_fault_string='Failed to find an image with tag {} '
|
||||||
|
'due to: {}'.format(
|
||||||
|
amp_image_tag, str(e)),
|
||||||
|
operator_fault_string='Failed to find an image with tag '
|
||||||
|
'{} due to: {}'.format(
|
||||||
|
amp_image_tag, str(e)))
|
||||||
|
|
||||||
# Availability Zone
|
# Availability Zone
|
||||||
def get_supported_availability_zone_metadata(self):
|
def get_supported_availability_zone_metadata(self):
|
||||||
"""Returns the valid availability zone metadata keys and descriptions.
|
"""Returns the valid availability zone metadata keys and descriptions.
|
||||||
|
@ -787,6 +787,7 @@ AVAILABILITY_ZONE_DATA = 'availability_zone_data'
|
|||||||
# Flavor metadata
|
# Flavor metadata
|
||||||
LOADBALANCER_TOPOLOGY = 'loadbalancer_topology'
|
LOADBALANCER_TOPOLOGY = 'loadbalancer_topology'
|
||||||
COMPUTE_FLAVOR = 'compute_flavor'
|
COMPUTE_FLAVOR = 'compute_flavor'
|
||||||
|
AMP_IMAGE_TAG = 'amp_image_tag'
|
||||||
|
|
||||||
# TODO(johnsom) move to octavia_lib
|
# TODO(johnsom) move to octavia_lib
|
||||||
# client certification authorization option
|
# client certification authorization option
|
||||||
|
@ -73,9 +73,12 @@ class ComputeCreate(BaseComputeTask):
|
|||||||
CONF.controller_worker.loadbalancer_topology)
|
CONF.controller_worker.loadbalancer_topology)
|
||||||
amp_compute_flavor = flavor.get(
|
amp_compute_flavor = flavor.get(
|
||||||
constants.COMPUTE_FLAVOR, CONF.controller_worker.amp_flavor_id)
|
constants.COMPUTE_FLAVOR, CONF.controller_worker.amp_flavor_id)
|
||||||
|
amp_image_tag = flavor.get(
|
||||||
|
constants.AMP_IMAGE_TAG, CONF.controller_worker.amp_image_tag)
|
||||||
else:
|
else:
|
||||||
topology = CONF.controller_worker.loadbalancer_topology
|
topology = CONF.controller_worker.loadbalancer_topology
|
||||||
amp_compute_flavor = CONF.controller_worker.amp_flavor_id
|
amp_compute_flavor = CONF.controller_worker.amp_flavor_id
|
||||||
|
amp_image_tag = CONF.controller_worker.amp_image_tag
|
||||||
|
|
||||||
if availability_zone:
|
if availability_zone:
|
||||||
amp_availability_zone = availability_zone.get(
|
amp_availability_zone = availability_zone.get(
|
||||||
@ -108,7 +111,7 @@ class ComputeCreate(BaseComputeTask):
|
|||||||
compute_id = self.compute.build(
|
compute_id = self.compute.build(
|
||||||
name="amphora-" + amphora_id,
|
name="amphora-" + amphora_id,
|
||||||
amphora_flavor=amp_compute_flavor,
|
amphora_flavor=amp_compute_flavor,
|
||||||
image_tag=CONF.controller_worker.amp_image_tag,
|
image_tag=amp_image_tag,
|
||||||
image_owner=CONF.controller_worker.amp_image_owner_id,
|
image_owner=CONF.controller_worker.amp_image_owner_id,
|
||||||
key_name=key_name,
|
key_name=key_name,
|
||||||
sec_groups=CONF.controller_worker.amp_secgroup_list,
|
sec_groups=CONF.controller_worker.amp_secgroup_list,
|
||||||
|
@ -78,9 +78,12 @@ class ComputeCreate(BaseComputeTask):
|
|||||||
CONF.controller_worker.loadbalancer_topology)
|
CONF.controller_worker.loadbalancer_topology)
|
||||||
amp_compute_flavor = flavor.get(
|
amp_compute_flavor = flavor.get(
|
||||||
constants.COMPUTE_FLAVOR, CONF.controller_worker.amp_flavor_id)
|
constants.COMPUTE_FLAVOR, CONF.controller_worker.amp_flavor_id)
|
||||||
|
amp_image_tag = flavor.get(
|
||||||
|
constants.AMP_IMAGE_TAG, CONF.controller_worker.amp_image_tag)
|
||||||
else:
|
else:
|
||||||
topology = CONF.controller_worker.loadbalancer_topology
|
topology = CONF.controller_worker.loadbalancer_topology
|
||||||
amp_compute_flavor = CONF.controller_worker.amp_flavor_id
|
amp_compute_flavor = CONF.controller_worker.amp_flavor_id
|
||||||
|
amp_image_tag = CONF.controller_worker.amp_image_tag
|
||||||
|
|
||||||
if availability_zone:
|
if availability_zone:
|
||||||
amp_availability_zone = availability_zone.get(
|
amp_availability_zone = availability_zone.get(
|
||||||
@ -113,7 +116,7 @@ class ComputeCreate(BaseComputeTask):
|
|||||||
compute_id = self.compute.build(
|
compute_id = self.compute.build(
|
||||||
name="amphora-" + amphora_id,
|
name="amphora-" + amphora_id,
|
||||||
amphora_flavor=amp_compute_flavor,
|
amphora_flavor=amp_compute_flavor,
|
||||||
image_tag=CONF.controller_worker.amp_image_tag,
|
image_tag=amp_image_tag,
|
||||||
image_owner=CONF.controller_worker.amp_image_owner_id,
|
image_owner=CONF.controller_worker.amp_image_owner_id,
|
||||||
key_name=key_name,
|
key_name=key_name,
|
||||||
sec_groups=CONF.controller_worker.amp_secgroup_list,
|
sec_groups=CONF.controller_worker.amp_secgroup_list,
|
||||||
|
@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- |
|
||||||
|
Operators can now use the 'amp_image_tag' Octavia flavor capability when
|
||||||
|
using the amphora provider driver. This allows custom amphora images to be
|
||||||
|
used per-load balancer. If this is not defined in an Octavia flavor, the
|
||||||
|
amp_image_tag Octavia configuration file setting will continue to be used.
|
Loading…
Reference in New Issue
Block a user