NSX|v: disable service insertion if no driver configured

When the service insertion service plugin is configured without the nsx driver
port creation (and instances deployment) are failing because there is no
service insertion security group.
This patch make sure the nsx plugin knows the service insertion is disabled
in this case.

Depends-on: I4e7027cd456d7b16bb0c6136d9a556ad11246219
Change-Id: Idd7d4ccd1d7af8a6852803db00a3507f20d5f5a4
This commit is contained in:
Adit Sarfaty 2017-06-21 09:16:14 +03:00
parent e91518a472
commit ca8d1b7024
1 changed files with 8 additions and 1 deletions

View File

@ -38,8 +38,15 @@ class NsxvServiceInsertionHandler(object):
self._enabled = False
self._sg_id = None
if self.is_service_insertion_enabled():
self._enabled = True
self._sg_id = self.get_service_inserion_sg_id()
if not self._sg_id:
# failed to create the security group or the driver
# was not configured
LOG.error("Failed to enable service insertion. "
"Security group not found.")
self._enabled = False
else:
self._enabled = True
self._initialized = True
def is_service_insertion_enabled(self):