Neutron fixture: don't clobber profile and vif_details if empty
Previously, the way Neutron fixture's update_port method was coded would cause the binding:profile and binding:vid_details fields to get clobbered if they were not passed to the update. This was because if nothing was passed, a default of {} was used. This is not how the real Neutron API behaves. If nothing is passed, the previous values remain and are not replaced with {}. This patches fixes this in the Neutron fixture. Change-Id: Ia7ad1322b5a15d1407140c77fe0edb179f66ec7a
This commit is contained in:
parent
fdd96de20d
commit
62868aaac7
@ -2034,16 +2034,19 @@ class NeutronFixture(fixtures.Fixture):
|
|||||||
# else update the active one
|
# else update the active one
|
||||||
host, _ = self._get_active_binding(port_id)
|
host, _ = self._get_active_binding(port_id)
|
||||||
|
|
||||||
self._port_bindings[port_id][host] = {
|
update = {
|
||||||
'host': host,
|
'host': host,
|
||||||
'status': 'ACTIVE',
|
'status': 'ACTIVE',
|
||||||
'profile': copy.deepcopy(
|
|
||||||
body['port'].get('binding:profile') or {},
|
|
||||||
),
|
|
||||||
'vif_details': port.get('binding:vif_details') or {},
|
|
||||||
'vif_type': port['binding:vif_type'],
|
'vif_type': port['binding:vif_type'],
|
||||||
'vnic_type': port['binding:vnic_type'],
|
'vnic_type': port['binding:vnic_type'],
|
||||||
}
|
}
|
||||||
|
if body['port'].get('binding:profile'):
|
||||||
|
update['profile'] = copy.deepcopy(
|
||||||
|
body['port']['binding:profile'])
|
||||||
|
if body['port'].get('binding:vif_details'):
|
||||||
|
update['vif_details'] = copy.deepcopy(
|
||||||
|
body['port']['binding:vif_details'])
|
||||||
|
self._port_bindings[port_id][host] = update
|
||||||
|
|
||||||
# mark any other active bindings as inactive
|
# mark any other active bindings as inactive
|
||||||
self._activate_port_binding(port_id, host)
|
self._activate_port_binding(port_id, host)
|
||||||
|
Loading…
Reference in New Issue
Block a user