Support tags for Octavia pool member

The API doc:
https://developer.openstack.org/api-ref/load-balancer/v2/index.html#create-member

Change-Id: I6c5aaf116916eb197a62d89561d4d20236006581
Story: #2005219
Task: #29998
This commit is contained in:
Lingxian Kong 2019-03-13 18:57:11 +13:00
parent 97f2636dc7
commit f3c08330fe
4 changed files with 19 additions and 2 deletions

View File

@ -15,6 +15,7 @@ from heat.common.i18n import _
from heat.engine import constraints
from heat.engine import properties
from heat.engine.resources.openstack.octavia import octavia_base
from heat.engine import support
from heat.engine import translation
@ -26,10 +27,10 @@ class PoolMember(octavia_base.OctaviaBase):
PROPERTIES = (
POOL, ADDRESS, PROTOCOL_PORT, MONITOR_ADDRESS, MONITOR_PORT,
WEIGHT, ADMIN_STATE_UP, SUBNET,
WEIGHT, ADMIN_STATE_UP, SUBNET, TAGS
) = (
'pool', 'address', 'protocol_port', 'monitor_address', 'monitor_port',
'weight', 'admin_state_up', 'subnet'
'weight', 'admin_state_up', 'subnet', 'tags'
)
ATTRIBUTES = (
@ -101,6 +102,13 @@ class PoolMember(octavia_base.OctaviaBase):
constraints.CustomConstraint('neutron.subnet')
],
),
TAGS: properties.Schema(
properties.Schema.LIST,
_('A list of simple strings assigned to the member. The property '
'is supported with Stein Octavia or newer version.'),
update_allowed=True,
support_status=support.SupportStatus(version='13.0.0'),
),
}
def translation_rules(self, props):

View File

@ -80,6 +80,7 @@ resources:
weight: 1
subnet: sub123
admin_state_up: True
tags: ['tag1', 'tag2']
'''
MONITOR_TEMPLATE = '''

View File

@ -61,6 +61,7 @@ class PoolMemberTest(common.HeatTestCase):
'weight': 1,
'subnet_id': '123',
'admin_state_up': True,
'tags': ['tag1', 'tag2']
}
}
props = self.member.handle_create()
@ -95,6 +96,7 @@ class PoolMemberTest(common.HeatTestCase):
prop_diff = {
'admin_state_up': False,
'weight': 2,
'tags': ['tag3', 'tag4']
}
prop_diff = self.member.handle_update(None, None, prop_diff)

View File

@ -0,0 +1,6 @@
---
features:
- Support ``tags`` property for the resource ``OS::Octavia::PoolMember``, the
property is allowed to be updated as well. The resource tag was introduced
in Octavia since Stein release, do not specify tags in Heat template if you are
using the previous versions.