Change device_owner used for OVN LB HM port

To differentiate OVN LB HM (Load Balancer Health Monitor) ports
from Neutron ovn-metadata ports, a new constant will be used for
the 'device_owner' field in OVN LB HM ports.

This change ensures that these ports are not managed by some Neutron
tasks that assume only one port per network should have a 'device_owner'
value of 'network:distributed'.

Partially-Closes: 2038091

Depends-On: https://review.opendev.org/c/openstack/neutron/+/897345

Change-Id: I9a9a55d919fc215bf9a593a894e678c84e395e82
This commit is contained in:
Fernando Royo 2023-10-04 18:10:21 +02:00
parent 983ee0c4f3
commit e2dbc59be5
4 changed files with 20 additions and 4 deletions

View File

@ -33,6 +33,9 @@ OVN_GW_PORT_EXT_ID_KEY = 'neutron:gw_port_id'
OVN_PORT_CIDR_EXT_ID_KEY = 'neutron:cidrs'
OVN_MEMBER_STATUS_KEY = 'neutron:member_status'
# TODO(froyo): Use from neutron-lib once released.
OVN_LB_HM_PORT_DISTRIBUTED = 'ovn-lb-hm:distributed'
LB_EXT_IDS_LS_REFS_KEY = 'ls_refs'
LB_EXT_IDS_LR_REF_KEY = 'lr_ref'
LB_EXT_IDS_POOL_PREFIX = 'pool_'

View File

@ -140,7 +140,8 @@ class OvnProviderHelper():
'fixed_ips': [{'subnet_id': subnet_id}],
'admin_state_up': True,
'port_security_enabled': False,
'device_owner': n_const.DEVICE_OWNER_DISTRIBUTED,
'device_owner': ovn_const.OVN_LB_HM_PORT_DISTRIBUTED,
'device_id': ovn_const.LB_HM_PORT_PREFIX + str(subnet_id),
'project_id': project_id}
neutron_client = clients.get_neutron_client()
try:

View File

@ -4563,7 +4563,9 @@ class TestOvnProviderHelper(ovn_base.TestOvnOctaviaBase):
self.vip_dict['vip_subnet_id']}],
'admin_state_up': True,
'port_security_enabled': False,
'device_owner': n_const.DEVICE_OWNER_DISTRIBUTED,
'device_owner': ovn_const.OVN_LB_HM_PORT_DISTRIBUTED,
'device_id': '%s%s' % (ovn_const.LB_HM_PORT_PREFIX,
self.vip_dict['vip_subnet_id']),
'project_id': self.project_id
}
with mock.patch.object(clients, 'get_neutron_client') as net_cli:
@ -4590,7 +4592,9 @@ class TestOvnProviderHelper(ovn_base.TestOvnOctaviaBase):
self.vip_dict['vip_subnet_id']}],
'admin_state_up': True,
'port_security_enabled': False,
'device_owner': n_const.DEVICE_OWNER_DISTRIBUTED,
'device_owner': ovn_const.OVN_LB_HM_PORT_DISTRIBUTED,
'device_id': '%s%s' % (ovn_const.LB_HM_PORT_PREFIX,
self.vip_dict['vip_subnet_id']),
'project_id': self.project_id
}
hm_port = self.helper._create_hm_port(
@ -4625,7 +4629,9 @@ class TestOvnProviderHelper(ovn_base.TestOvnOctaviaBase):
'subnet_id': self.vip_dict['vip_subnet_id']}],
'admin_state_up': True,
'port_security_enabled': False,
'device_owner': n_const.DEVICE_OWNER_DISTRIBUTED,
'device_owner': ovn_const.OVN_LB_HM_PORT_DISTRIBUTED,
'device_id': '%s%s' % (ovn_const.LB_HM_PORT_PREFIX,
self.vip_dict['vip_subnet_id']),
'project_id': self.project_id
}
hm_port = self.helper._create_hm_port(

View File

@ -0,0 +1,6 @@
---
upgrade:
- |
In order to support the new 'device_owner' for OVN
Load Balancer Health Monitor ports this version
requires a Neutron version > 23.0.0rc2