From 41806e8f4153347efe4b7f68c9e99e15c263e15d Mon Sep 17 00:00:00 2001 From: Adit Sarfaty Date: Sun, 17 Dec 2017 15:30:43 +0200 Subject: [PATCH] NSX-TVD QoS drivers support Modify the QoS drivers of NSX-V and NSX-V3 to support TVD core plugin Change-Id: I20eb61a01f6a0238871440d9d91e18f55b4bd20e --- vmware_nsx/services/qos/nsx_v/driver.py | 5 +++++ vmware_nsx/services/qos/nsx_v3/utils.py | 14 +++++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/vmware_nsx/services/qos/nsx_v/driver.py b/vmware_nsx/services/qos/nsx_v/driver.py index 884a91a902..748f3f57f3 100644 --- a/vmware_nsx/services/qos/nsx_v/driver.py +++ b/vmware_nsx/services/qos/nsx_v/driver.py @@ -20,6 +20,7 @@ from neutron_lib.services.qos import base from neutron_lib.services.qos import constants as qos_consts from oslo_log import log as logging +from vmware_nsx.extensions import projectpluginmap LOG = logging.getLogger(__name__) DRIVER = None @@ -54,6 +55,10 @@ class NSXvQosDriver(base.DriverBase): def __init__(self, core_plugin, **kwargs): super(NSXvQosDriver, self).__init__(**kwargs) self.core_plugin = core_plugin + if self.core_plugin.is_tvd_plugin(): + # get the plugin that match this driver + self.core_plugin = self.core_plugin.get_plugin_by_type( + projectpluginmap.NsxPlugins.NSX_V) self.requires_rpc_notifications = False def is_vif_type_compatible(self, vif_type): diff --git a/vmware_nsx/services/qos/nsx_v3/utils.py b/vmware_nsx/services/qos/nsx_v3/utils.py index 97426d2c74..9d13bdd5ba 100644 --- a/vmware_nsx/services/qos/nsx_v3/utils.py +++ b/vmware_nsx/services/qos/nsx_v3/utils.py @@ -26,6 +26,7 @@ from neutron_lib.services.qos import constants as qos_consts from vmware_nsx._i18n import _ from vmware_nsx.common import exceptions as nsx_exc from vmware_nsx.db import db as nsx_db +from vmware_nsx.extensions import projectpluginmap LOG = logging.getLogger(__name__) @@ -39,14 +40,21 @@ class QosNotificationsHandler(object): def __init__(self): super(QosNotificationsHandler, self).__init__() + self._core_plugin = None @property - def _core_plugin(self): - return directory.get_plugin() + def core_plugin(self): + if not self._core_plugin: + self._core_plugin = directory.get_plugin() + if self._core_plugin.is_tvd_plugin(): + # get the plugin that match this driver + self._core_plugin = self._core_plugin.get_plugin_by_type( + projectpluginmap.NsxPlugins.NSX_T) + return self._core_plugin @property def _nsxlib_qos(self): - return self._core_plugin.nsxlib.qos_switching_profile + return self.core_plugin.nsxlib.qos_switching_profile def _get_tags(self, context, policy): policy_dict = {'id': policy.id, 'tenant_id': policy.tenant_id}