Allow update inplace for allowed_address_pairs

This patch allows to do update inplace for allowed_address_pairs
properties. Scenario mentioned in bug works correct now.

Also add couple fixes to related test:
- Add explicit translation name to string, otherwise it returns objects,
  that raise error during resolving Property name, which should be a
  string.
- Add check, that update of any of mentioned properties does not cause replace.

Change-Id: I913fd36012179f2fdd602f2cca06a89e3fa896f3
Closes-Bug: #1623821
(cherry picked from commit 353e7319db)
This commit is contained in:
Sergey Kraynev 2016-09-15 04:08:20 -04:00
parent 8938a26d6b
commit 5443453fbb
2 changed files with 12 additions and 2 deletions

View File

@ -250,7 +250,8 @@ class Port(neutron.NeutronResource):
]
),
},
)
),
update_allowed=True,
),
VNIC_TYPE: properties.Schema(
properties.Schema.STRING,

View File

@ -933,7 +933,7 @@ class UpdatePortTest(common.HeatTestCase):
return_value=fake_groups_list)
props = {'network_id': u'net1234',
'name': utils.PhysName(stack.name, 'port'),
'name': str(utils.PhysName(stack.name, 'port')),
'admin_state_up': True,
'device_owner': u'network:dhcp'}
@ -970,6 +970,15 @@ class UpdatePortTest(common.HeatTestCase):
update_props)())
update_port.assset_called_once_with(update_dict)
# check, that update does not cause of Update Replace
create_snippet = rsrc_defn.ResourceDefinition(port.name, port.type(),
props)
after_props, before_props = port._prepare_update_props(update_snippet,
create_snippet)
self.assertIsNotNone(
port.update_template_diff_properties(after_props, before_props))
# update with empty prop_diff
scheduler.TaskRunner(port.handle_update, update_snippet, {}, {})()
self.assertEqual(1, update_port.call_count)