Merge "Allow to clean VIPs from plugins" into stable/8.0
This commit is contained in:
commit
c363c742bf
|
@ -51,6 +51,14 @@ class NetworkRoleMergePolicy(MergePolicy):
|
|||
:return: the patched VIPs
|
||||
"""
|
||||
seen = dict((vip['name'], vip) for vip in target)
|
||||
|
||||
# This is a workaround for 8.0 release to allow
|
||||
# moving controllers to different racks. Will be
|
||||
# replaced by a different solution in 9.0
|
||||
if len(patch) == 0:
|
||||
return []
|
||||
# END OF WORKAROUND
|
||||
|
||||
for vip in patch:
|
||||
if vip['name'] in seen:
|
||||
if vip != seen[vip['name']]:
|
||||
|
|
|
@ -66,6 +66,16 @@ class TestNetworkRoleMergePolicy(BaseUnitTest):
|
|||
target['properties']['vip']
|
||||
)
|
||||
|
||||
def test_apply_patch_vips_reset(self):
|
||||
target = self._make_plugin_network_role(
|
||||
vip=[{'name': 'test_vip_a'}, {'name': 'test_vip_b'}]
|
||||
)
|
||||
|
||||
patch = self._make_plugin_network_role(vip=[])
|
||||
self.policy.apply_patch(target, patch)
|
||||
|
||||
self.assertItemsEqual([], target['properties']['vip'])
|
||||
|
||||
def test_apply_patch_fail_if_conflict(self):
|
||||
with self.assertRaisesRegexp(errors.UnresolvableConflict, 'subnet'):
|
||||
self.policy.apply_patch(
|
||||
|
|
Loading…
Reference in New Issue