Merge "NSX|V3: Update LB vip with device owner"
This commit is contained in:
commit
dbee9d3024
@ -93,6 +93,7 @@ from vmware_nsx.plugins.nsx_v3 import availability_zones as nsx_az
|
||||
from vmware_nsx.plugins.nsx_v3 import utils as v3_utils
|
||||
from vmware_nsx.services.fwaas.common import utils as fwaas_utils
|
||||
from vmware_nsx.services.fwaas.nsx_v3 import fwaas_callbacks_v2
|
||||
from vmware_nsx.services.lbaas import lb_const
|
||||
from vmware_nsx.services.lbaas.nsx_v3.implementation import healthmonitor_mgr
|
||||
from vmware_nsx.services.lbaas.nsx_v3.implementation import l7policy_mgr
|
||||
from vmware_nsx.services.lbaas.nsx_v3.implementation import l7rule_mgr
|
||||
@ -2953,7 +2954,8 @@ class NsxV3Plugin(nsx_plugin_common.NsxPluginV3Base,
|
||||
device_owner = port_data.get('device_owner')
|
||||
fip_address = new_fip['floating_ip_address']
|
||||
if (device_owner == const.DEVICE_OWNER_LOADBALANCERV2 or
|
||||
device_owner == oct_const.DEVICE_OWNER_OCTAVIA):
|
||||
device_owner == oct_const.DEVICE_OWNER_OCTAVIA or
|
||||
device_owner == lb_const.VMWARE_LB_VIP_OWNER):
|
||||
try:
|
||||
self._update_lb_vip(port_data, fip_address)
|
||||
except nsx_lib_exc.ManagerError:
|
||||
@ -2983,7 +2985,8 @@ class NsxV3Plugin(nsx_plugin_common.NsxPluginV3Base,
|
||||
device_owner = port_data.get('device_owner')
|
||||
fixed_ip_address = fip['fixed_ip_address']
|
||||
if (device_owner == const.DEVICE_OWNER_LOADBALANCERV2 or
|
||||
device_owner == oct_const.DEVICE_OWNER_OCTAVIA):
|
||||
device_owner == oct_const.DEVICE_OWNER_OCTAVIA or
|
||||
device_owner == lb_const.VMWARE_LB_VIP_OWNER):
|
||||
# If the port is LB VIP port, after deleting the FIP,
|
||||
# update the virtual server VIP back to fixed IP.
|
||||
is_lb_port = True
|
||||
@ -3035,7 +3038,8 @@ class NsxV3Plugin(nsx_plugin_common.NsxPluginV3Base,
|
||||
old_device_owner = old_port_data['device_owner']
|
||||
old_fixed_ip = old_fip['fixed_ip_address']
|
||||
if (old_device_owner == const.DEVICE_OWNER_LOADBALANCERV2 or
|
||||
old_device_owner == oct_const.DEVICE_OWNER_OCTAVIA):
|
||||
old_device_owner == oct_const.DEVICE_OWNER_OCTAVIA or
|
||||
old_device_owner == lb_const.VMWARE_LB_VIP_OWNER):
|
||||
is_lb_port = True
|
||||
self._update_lb_vip(old_port_data, old_fixed_ip)
|
||||
|
||||
@ -3063,7 +3067,8 @@ class NsxV3Plugin(nsx_plugin_common.NsxPluginV3Base,
|
||||
new_dev_own = new_port_data['device_owner']
|
||||
new_fip_address = new_fip['floating_ip_address']
|
||||
if (new_dev_own == const.DEVICE_OWNER_LOADBALANCERV2 or
|
||||
new_dev_own == oct_const.DEVICE_OWNER_OCTAVIA):
|
||||
new_dev_own == oct_const.DEVICE_OWNER_OCTAVIA or
|
||||
new_dev_own == lb_const.VMWARE_LB_VIP_OWNER):
|
||||
is_lb_port = True
|
||||
self._update_lb_vip(new_port_data, new_fip_address)
|
||||
|
||||
|
@ -25,6 +25,7 @@ from vmware_nsx.db import db as nsx_db
|
||||
from vmware_nsx.services.lbaas import base_mgr
|
||||
from vmware_nsx.services.lbaas import lb_const
|
||||
from vmware_nsx.services.lbaas.nsx_v3.implementation import lb_utils
|
||||
from vmware_nsx.services.lbaas.octavia import constants as oct_const
|
||||
from vmware_nsxlib.v3 import exceptions as nsxlib_exc
|
||||
from vmware_nsxlib.v3 import utils
|
||||
|
||||
@ -35,9 +36,6 @@ class EdgeLoadBalancerManagerFromDict(base_mgr.Nsxv3LoadbalancerBaseManager):
|
||||
|
||||
@log_helpers.log_method_call
|
||||
def create(self, context, lb, completor):
|
||||
|
||||
# TODO(asarfaty): If the lb is created with a port_id,
|
||||
# need to set octavia device owner & device id on it.
|
||||
if not lb_utils.validate_lb_subnet(context, self.core_plugin,
|
||||
lb['vip_subnet_id']):
|
||||
completor(success=False)
|
||||
@ -82,6 +80,15 @@ class EdgeLoadBalancerManagerFromDict(base_mgr.Nsxv3LoadbalancerBaseManager):
|
||||
context.session, lb['id'], lb_service['id'],
|
||||
nsx_router_id, lb['vip_address'])
|
||||
|
||||
# Make sure the vip port is marked with a device owner
|
||||
port = self.core_plugin.get_port(
|
||||
context.elevated(), lb['vip_port_id'])
|
||||
if not port.get('device_owner'):
|
||||
self.core_plugin.update_port(
|
||||
context.elevated(), lb['vip_port_id'],
|
||||
{'port': {'device_id': oct_const.DEVICE_ID_PREFIX + lb['id'],
|
||||
'device_owner': lb_const.VMWARE_LB_VIP_OWNER}})
|
||||
|
||||
completor(success=True)
|
||||
|
||||
@log_helpers.log_method_call
|
||||
@ -215,6 +222,15 @@ class EdgeLoadBalancerManagerFromDict(base_mgr.Nsxv3LoadbalancerBaseManager):
|
||||
router_id):
|
||||
self.core_plugin.delete_service_router(context,
|
||||
router_id)
|
||||
# Make sure the vip port is not marked with a vmware device owner
|
||||
port = self.core_plugin.get_port(
|
||||
context.elevated(), lb['vip_port_id'])
|
||||
if port.get('device_owner') == lb_const.VMWARE_LB_VIP_OWNER:
|
||||
self.core_plugin.update_port(
|
||||
context.elevated(), lb['vip_port_id'],
|
||||
{'port': {'device_id': '',
|
||||
'device_owner': ''}})
|
||||
|
||||
completor(success=True)
|
||||
|
||||
@log_helpers.log_method_call
|
||||
|
Loading…
x
Reference in New Issue
Block a user