From b4f09d9af680d97efcb6b099f2239e12084d1629 Mon Sep 17 00:00:00 2001 From: Gary Kotton Date: Sun, 12 Nov 2017 01:24:37 -0800 Subject: [PATCH] NSX|V3: use vmware-nsxlib that does not have neutron-lib This makes use of the following: 1. new exception raised by vmware-nsxlib (instead of neutron-lib InvalidInput) 2. Bind to the is_set_attr callback Change-Id: I062e4fb85fe2faaa8ed159cc96077c6ed69af7a9 Depends-On: Ia8ec71dee2d5de921700a9b4fd7e789d2aed4679 --- vmware_nsx/plugins/nsx_v3/plugin.py | 3 +++ .../shell/admin/plugins/nsxv3/resources/certificates.py | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/vmware_nsx/plugins/nsx_v3/plugin.py b/vmware_nsx/plugins/nsx_v3/plugin.py index 74d1c5affc..f257de007c 100644 --- a/vmware_nsx/plugins/nsx_v3/plugin.py +++ b/vmware_nsx/plugins/nsx_v3/plugin.py @@ -203,6 +203,7 @@ class NsxV3Plugin(agentschedulers_db.AZDhcpAgentSchedulerDbMixin, router=l3_db_models.Router, floatingip=l3_db_models.FloatingIP) def __init__(self): + nsxlib_utils.set_is_attr_callback(validators.is_attr_set) self._extend_fault_map() self._extension_manager = managers.ExtensionManager() super(NsxV3Plugin, self).__init__() @@ -297,6 +298,8 @@ class NsxV3Plugin(agentschedulers_db.AZDhcpAgentSchedulerDbMixin, nsx_lib_exc.ClientCertificateNotTrusted: webob.exc.HTTPBadRequest, nsx_exc.SecurityGroupMaximumCapacityReached: + webob.exc.HTTPBadRequest, + nsx_lib_exc.NsxLibInvalidInput: webob.exc.HTTPBadRequest}) def _init_fwaas(self, resource, event, trigger, **kwargs): diff --git a/vmware_nsx/shell/admin/plugins/nsxv3/resources/certificates.py b/vmware_nsx/shell/admin/plugins/nsxv3/resources/certificates.py index d1ec6df12a..c30e000daa 100644 --- a/vmware_nsx/shell/admin/plugins/nsxv3/resources/certificates.py +++ b/vmware_nsx/shell/admin/plugins/nsxv3/resources/certificates.py @@ -21,11 +21,11 @@ from vmware_nsx.shell.admin.plugins.common import utils as admin_utils from vmware_nsx.shell.admin.plugins.nsxv3.resources import utils from vmware_nsx.shell import resources as shell from vmware_nsxlib.v3 import client_cert +from vmware_nsxlib.v3 import exceptions from vmware_nsxlib.v3 import trust_management from neutron_lib.callbacks import registry from neutron_lib import context -from neutron_lib import exceptions from oslo_config import cfg LOG = logging.getLogger(__name__) @@ -121,7 +121,7 @@ def generate_cert(resource, event, trigger, **kwargs): try: cert.generate(subject, key_size, valid_for_days, signature_alg) - except exceptions.InvalidInput as e: + except exceptions.NsxLibInvalidInput as e: LOG.info(e) return