From dadec94d83384afe0cbc73455354dab4a87a6728 Mon Sep 17 00:00:00 2001 From: Gary Kotton Date: Wed, 23 Mar 2016 05:19:00 -0700 Subject: [PATCH] NSX|V3: remove redundant warning The DHCP profile is created at boot time. So we do not need to check that it exists. The service will not start if this does not exist or cannot be created. Change-Id: Ib1d4f5977b53cdea3d9b7350e49e91a9ed6d658a --- vmware_nsx/plugins/nsx_v3/plugin.py | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/vmware_nsx/plugins/nsx_v3/plugin.py b/vmware_nsx/plugins/nsx_v3/plugin.py index 3fa3b1046b..25c27fc38e 100644 --- a/vmware_nsx/plugins/nsx_v3/plugin.py +++ b/vmware_nsx/plugins/nsx_v3/plugin.py @@ -163,8 +163,9 @@ class NsxV3Plugin(addr_pair_db.AllowedAddressPairsMixin, NSX_V3_NO_PSEC_PROFILE_NAME)[0])[0] LOG.debug("Initializing NSX v3 DHCP switching profile") self._dhcp_profile = None - self._dhcp_profile = self._init_dhcp_switching_profile() - if not self._dhcp_profile: + try: + self._dhcp_profile = self._init_dhcp_switching_profile() + except Exception: msg = _("Unable to initialize NSX v3 DHCP " "switching profile: %s") % NSX_V3_DHCP_PROFILE_NAME raise nsx_exc.NsxPluginException(msg) @@ -744,13 +745,7 @@ class NsxV3Plugin(addr_pair_db.AllowedAddressPairsMixin, if psec_is_on and address_bindings: profiles = [self._get_port_security_profile_id()] if device_owner == const.DEVICE_OWNER_DHCP: - if self._dhcp_profile: - profiles.append(self._dhcp_profile) - else: - LOG.warning(_LW("No DHCP switching profile configured in the " - "config file. DHCP port: %s configured with " - "default profile on the backend"), - port_data['id']) + profiles.append(self._dhcp_profile) name = self._get_port_name(context, port_data) @@ -1031,8 +1026,7 @@ class NsxV3Plugin(addr_pair_db.AllowedAddressPairsMixin, # Update the DHCP profile if updated_device_owner == const.DEVICE_OWNER_DHCP: - if self._dhcp_profile: - switch_profile_ids.append(self._dhcp_profile) + switch_profile_ids.append(self._dhcp_profile) self._port_client.update( lport_id, vif_uuid, name=name,