Don't override device_owner for tenant network ports

When a vif is passed to us from nova as a tenant port we shouldn't
change the device_owner or device_id because that is what links the port
to the nova instance. This enables the neutron nova notifier to trigger
the correct events in nova for when the neutron port changes, e.g. being
deleted, triggers the detach interface endpoint.

Change-Id: I43c3af9f424a65211ef5a39f13e4810072997339
Closes-Bug: #1656010
This commit is contained in:
Sam Betts 2017-01-23 17:08:35 +00:00
parent eae8e07132
commit cbdf5076d3
2 changed files with 4 additions and 8 deletions

View File

@ -191,10 +191,12 @@ class NeutronNetwork(common.VIFPortIDMixin,
if client_id:
client_id_opt = (
{'opt_name': 'client-id', 'opt_value': client_id})
# NOTE(sambetts) Only update required binding: attributes and
# admin state, because other port attributes may have been set by
# the user or nova.
body = {
'port': {
'device_owner': 'baremetal:none',
'device_id': node.instance_uuid or node.uuid,
'admin_state_up': True,
'binding:vnic_type': 'baremetal',
'binding:host_id': node.uuid,

View File

@ -254,8 +254,6 @@ class NeutronInterfaceTestCase(db_base.DbTestCase):
self, log_mock, client_mock):
expected_body = {
'port': {
'device_owner': 'baremetal:none',
'device_id': self.node.instance_uuid or self.node.uuid,
'admin_state_up': True,
'binding:vnic_type': 'baremetal',
'binding:host_id': self.node.uuid,
@ -317,8 +315,6 @@ class NeutronInterfaceTestCase(db_base.DbTestCase):
expected_body = {
'port': {
'device_owner': 'baremetal:none',
'device_id': self.node.instance_uuid or self.node.uuid,
'admin_state_up': True,
'binding:vnic_type': 'baremetal',
'binding:host_id': self.node.uuid,
@ -395,8 +391,6 @@ class NeutronInterfaceTestCase(db_base.DbTestCase):
client_mock.return_value.update_port = upd_mock
expected_body = {
'port': {
'device_owner': 'baremetal:none',
'device_id': self.node.uuid,
'admin_state_up': True,
'binding:vnic_type': 'baremetal',
'binding:host_id': self.node.uuid,