Browse Source

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
changes/50/642950/4
Lingxian Kong 3 years ago
parent
commit
f3c08330fe
  1. 12
      heat/engine/resources/openstack/octavia/pool_member.py
  2. 1
      heat/tests/openstack/octavia/inline_templates.py
  3. 2
      heat/tests/openstack/octavia/test_pool_member.py
  4. 6
      releasenotes/notes/octavia-member-tags-84cd00224d6b7bc1.yaml

12
heat/engine/resources/openstack/octavia/pool_member.py

@ -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):

1
heat/tests/openstack/octavia/inline_templates.py

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

2
heat/tests/openstack/octavia/test_pool_member.py

@ -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)

6
releasenotes/notes/octavia-member-tags-84cd00224d6b7bc1.yaml

@ -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.
Loading…
Cancel
Save