From b6ddab61e9836f9e2f537fab00224be540a0a123 Mon Sep 17 00:00:00 2001 From: Gary Kotton Date: Thu, 17 Mar 2016 05:45:18 -0700 Subject: [PATCH] NSX: Enable resource tracking in NSX plugins Commit 0d7b5392ab05aa8842b42bbbe3adc19773925e67 added resource tracking. This patch is missing in the NSX plugins and caused the CI to become unstable. Change-Id: I6e6da4b8804382f7ed6c28f3139be5ac1da907f7 Closes-bug: #1558461 --- vmware_nsx/plugins/dvs/plugin.py | 9 +++++++++ vmware_nsx/plugins/nsx_mh/plugin.py | 10 ++++++++++ vmware_nsx/plugins/nsx_v/plugin.py | 10 ++++++++++ vmware_nsx/plugins/nsx_v3/plugin.py | 10 ++++++++++ 4 files changed, 39 insertions(+) diff --git a/vmware_nsx/plugins/dvs/plugin.py b/vmware_nsx/plugins/dvs/plugin.py index b01bc2e8ad..447e674c16 100644 --- a/vmware_nsx/plugins/dvs/plugin.py +++ b/vmware_nsx/plugins/dvs/plugin.py @@ -25,6 +25,7 @@ from neutron.db import allowedaddresspairs_db as addr_pair_db from neutron.db import db_base_plugin_v2 from neutron.db import external_net_db from neutron.db import l3_db +from neutron.db import models_v2 from neutron.db import portbindings_db from neutron.db import portsecurity_db from neutron.db import securitygroups_db @@ -36,6 +37,7 @@ from neutron.extensions import providernet as pnet from neutron.extensions import securitygroup as ext_sg from neutron.plugins.common import constants from neutron.plugins.common import utils +from neutron.quota import resource_registry from neutron_lib import exceptions as n_exc import vmware_nsx @@ -76,6 +78,13 @@ class NsxDvsV2(addr_pair_db.AllowedAddressPairsMixin, __native_pagination_support = True __native_sorting_support = True + @resource_registry.tracked_resources( + network=models_v2.Network, + port=models_v2.Port, + subnet=models_v2.Subnet, + subnetpool=models_v2.SubnetPool, + security_group=securitygroups_db.SecurityGroup, + security_group_rule=securitygroups_db.SecurityGroupRule) def __init__(self): super(NsxDvsV2, self).__init__() LOG.debug('Driver support: DVS: %s' % dvs_utils.dvs_is_enabled()) diff --git a/vmware_nsx/plugins/nsx_mh/plugin.py b/vmware_nsx/plugins/nsx_mh/plugin.py index acbd735a61..b7b9320c06 100644 --- a/vmware_nsx/plugins/nsx_mh/plugin.py +++ b/vmware_nsx/plugins/nsx_mh/plugin.py @@ -58,6 +58,7 @@ from neutron.extensions import providernet as pnet from neutron.extensions import securitygroup as ext_sg from neutron.plugins.common import constants as plugin_const from neutron.plugins.common import utils +from neutron.quota import resource_registry import vmware_nsx from vmware_nsx._i18n import _, _LE, _LI, _LW @@ -133,6 +134,15 @@ class NsxPluginV2(addr_pair_db.AllowedAddressPairsMixin, # Map nova zones to cluster for easy retrieval novazone_cluster_map = {} + @resource_registry.tracked_resources( + network=models_v2.Network, + port=models_v2.Port, + subnet=models_v2.Subnet, + subnetpool=models_v2.SubnetPool, + security_group=securitygroups_db.SecurityGroup, + security_group_rule=securitygroups_db.SecurityGroupRule, + router=l3_db.Router, + floatingip=l3_db.FloatingIP) def __init__(self): super(NsxPluginV2, self).__init__() # TODO(salv-orlando): Replace These dicts with diff --git a/vmware_nsx/plugins/nsx_v/plugin.py b/vmware_nsx/plugins/nsx_v/plugin.py index 3685d01330..9f3ce49394 100644 --- a/vmware_nsx/plugins/nsx_v/plugin.py +++ b/vmware_nsx/plugins/nsx_v/plugin.py @@ -54,6 +54,7 @@ from neutron.extensions import providernet as pnet from neutron.extensions import securitygroup as ext_sg from neutron.plugins.common import constants as plugin_const from neutron.plugins.common import utils +from neutron.quota import resource_registry import vmware_nsx from vmware_nsx._i18n import _, _LE, _LI, _LW @@ -130,6 +131,15 @@ class NsxVPluginV2(addr_pair_db.AllowedAddressPairsMixin, __native_pagination_support = True __native_sorting_support = True + @resource_registry.tracked_resources( + network=models_v2.Network, + port=models_v2.Port, + subnet=models_v2.Subnet, + subnetpool=models_v2.SubnetPool, + security_group=securitygroups_db.SecurityGroup, + security_group_rule=securitygroups_db.SecurityGroupRule, + router=l3_db.Router, + floatingip=l3_db.FloatingIP) def __init__(self): super(NsxVPluginV2, self).__init__() self.metadata_proxy_handler = None diff --git a/vmware_nsx/plugins/nsx_v3/plugin.py b/vmware_nsx/plugins/nsx_v3/plugin.py index ce2b128c8a..50c947494d 100644 --- a/vmware_nsx/plugins/nsx_v3/plugin.py +++ b/vmware_nsx/plugins/nsx_v3/plugin.py @@ -51,6 +51,7 @@ from neutron.extensions import providernet as pnet from neutron.extensions import securitygroup as ext_sg from neutron.plugins.common import constants as plugin_const from neutron.plugins.common import utils as n_utils +from neutron.quota import resource_registry from neutron_lib import constants as const from neutron_lib import exceptions as n_exc from oslo_config import cfg @@ -115,6 +116,15 @@ class NsxV3Plugin(addr_pair_db.AllowedAddressPairsMixin, "network_availability_zone", "subnet_allocation"] + @resource_registry.tracked_resources( + network=models_v2.Network, + port=models_v2.Port, + subnet=models_v2.Subnet, + subnetpool=models_v2.SubnetPool, + security_group=securitygroups_db.SecurityGroup, + security_group_rule=securitygroups_db.SecurityGroupRule, + router=l3_db.Router, + floatingip=l3_db.FloatingIP) def __init__(self): super(NsxV3Plugin, self).__init__() LOG.info(_LI("Starting NsxV3Plugin"))