diff --git a/quark/drivers/nvp_driver.py b/quark/drivers/nvp_driver.py index 4332c4f..e57111d 100644 --- a/quark/drivers/nvp_driver.py +++ b/quark/drivers/nvp_driver.py @@ -406,8 +406,10 @@ class NVPDriver(base.BaseDriver): return results def _lswitch_select_open(self, context, switches=None, **kwargs): - """Selects an open lswitch for a network. Note that it does not select - the most full switch, but merely one with ports available. + """Selects an open lswitch for a network. + + Note that it does not select the most full switch, but merely one with + ports available. """ if switches is not None: diff --git a/quark/ipam.py b/quark/ipam.py index b083d04..678fd6a 100644 --- a/quark/ipam.py +++ b/quark/ipam.py @@ -23,8 +23,8 @@ import uuid import netaddr from neutron.common import exceptions from neutron.openstack.common import log as logging -from neutron.openstack.common import timeutils from neutron.openstack.common.notifier import api as notifier_api +from neutron.openstack.common import timeutils from oslo.config import cfg from quark.db import api as db_api @@ -286,6 +286,7 @@ class QuarkIpam(object): def _allocate_from_v6_subnet(self, context, net_id, subnet, port_id, ip_address=None, **kwargs): """This attempts to allocate v6 addresses as per RFC2462 and RFC3041. + To accomodate this, we effectively treat all v6 assignment as a first time allocation utilizing the MAC address of the VIF. Because we recycle MACs, we will eventually attempt to recreate a previously diff --git a/quark/plugin_modules/subnets.py b/quark/plugin_modules/subnets.py index 274c6dd..351da66 100644 --- a/quark/plugin_modules/subnets.py +++ b/quark/plugin_modules/subnets.py @@ -18,8 +18,8 @@ from neutron.common import config as neutron_cfg from neutron.common import exceptions from neutron.openstack.common import importutils from neutron.openstack.common import log as logging -from neutron.openstack.common import timeutils from neutron.openstack.common.notifier import api as notifier_api +from neutron.openstack.common import timeutils from oslo.config import cfg from quark.db import api as db_api diff --git a/quark/quota_driver.py b/quark/quota_driver.py index 8f61977..6552258 100644 --- a/quark/quota_driver.py +++ b/quark/quota_driver.py @@ -19,8 +19,7 @@ from neutron.db import quota_db class QuarkQuotaDriver(quota_db.DbQuotaDriver): - """Driver to perform necessary checks to enforce quotas and obtain quota - information. + """Driver to perform necessary checks to enforce and obtain quotas. The default driver utilizes the local database. """ diff --git a/quark/tests/functional/test_ipam.py b/quark/tests/functional/test_ipam.py index e7bb745..a4d0ebd 100644 --- a/quark/tests/functional/test_ipam.py +++ b/quark/tests/functional/test_ipam.py @@ -160,7 +160,9 @@ class QuarkIPAddressFindReallocatable(QuarkIpamBaseFunctionalTest): yield net_mod def test_find_reallocatable_ips_does_not_raise(self): - """A patch recently introduced a bug wherein addressses + """Regression testing + + A patch recently introduced a bug wherein addressses could not be returned to the ip_address_find call in attempt_to_reallocate_ip. Adding this test to prevent a future regression. diff --git a/quark/tests/plugin_modules/test_subnets.py b/quark/tests/plugin_modules/test_subnets.py index 8e4f97e..bf01346 100644 --- a/quark/tests/plugin_modules/test_subnets.py +++ b/quark/tests/plugin_modules/test_subnets.py @@ -624,7 +624,9 @@ class TestQuarkCreateSubnet(test_quark_plugin.TestQuarkPlugin): self.plugin.create_subnet(self.context, subnet_request) def test_create_subnet_default_route_gateway_ip(self): - """If default route (host_routes) and gateway_ip are both provided, + """Host_routes precedence + + If default route (host_routes) and gateway_ip are both provided, then host_route takes precedence. """ @@ -661,9 +663,7 @@ class TestQuarkCreateSubnet(test_quark_plugin.TestQuarkPlugin): self.assertEqual(res[key], subnet["subnet"][key]) def test_create_subnet_null_gateway_no_routes(self): - """Creating a subnet with a NULL gateway IP shouldn't - create routes. - """ + """A subnet with a NULL gateway IP shouldn't create routes.""" routes = [dict(cidr="0.0.0.0/0", gateway="172.16.0.4")] subnet = dict( diff --git a/quark/tests/test_base.py b/quark/tests/test_base.py index 584da69..00f4ff0 100644 --- a/quark/tests/test_base.py +++ b/quark/tests/test_base.py @@ -14,7 +14,6 @@ # limitations under the License. import unittest2 - from neutron import context diff --git a/quark/tests/test_ipam.py b/quark/tests/test_ipam.py index b4c73bb..d63236b 100644 --- a/quark/tests/test_ipam.py +++ b/quark/tests/test_ipam.py @@ -23,8 +23,8 @@ from neutron.openstack.common.notifier import api as notifier_api from oslo.config import cfg from quark.db import models -import quark.ipam from quark import exceptions as q_exc +import quark.ipam from quark.tests import test_base diff --git a/quark/tests/test_nvp_driver.py b/quark/tests/test_nvp_driver.py index 5296471..c4383bc 100644 --- a/quark/tests/test_nvp_driver.py +++ b/quark/tests/test_nvp_driver.py @@ -145,9 +145,7 @@ class TestNVPDriverCreateNetwork(TestNVPDriver): class TestNVPDriverProviderNetwork(TestNVPDriver): - """Testing all of the network types is unnecessary, but it's nice for peace - of mind. - """ + """Testing all of the network types is unnecessary, but a nice have""" @contextlib.contextmanager def _stubs(self, tz): @@ -211,7 +209,9 @@ class TestNVPDriverProviderNetwork(TestNVPDriver): zone_uuid="net_uuid", transport_type="local", vlan_id=None) def test_config_provider_attrs_bridge_net(self): - """Exists because internal driver calls can also call this method, + """A specialized case for NVP + + This exists because internal driver calls can also call this method, and they may pass bridge in as the type as that's how it's known to NVP. """ diff --git a/quark/tests/test_optimized_nvp_driver.py b/quark/tests/test_optimized_nvp_driver.py index f30c623..059a48e 100644 --- a/quark/tests/test_optimized_nvp_driver.py +++ b/quark/tests/test_optimized_nvp_driver.py @@ -97,8 +97,10 @@ class TestOptimizedNVPDriverDeleteNetwork(TestOptimizedNVPDriver): class TestOptimizedNVPDriverDeletePortMultiSwitch(TestOptimizedNVPDriver): - '''Need to test if ports on switch = 0 delete switch if it is not the last - switch on the network. + '''Test for 0 ports on the switch, and the switch not last in network. + + Need to test if ports on switch = 0 and delete the switch if it is not + the last switch on the network. ''' @contextlib.contextmanager @@ -137,9 +139,7 @@ class TestOptimizedNVPDriverDeletePortMultiSwitch(TestOptimizedNVPDriver): class TestOptimizedNVPDriverDeletePortSingleSwitch(TestOptimizedNVPDriver): - '''Need to test if ports on switch = 0 delete switch unless it is the last - switch on the network. - ''' + '''If ports on switch = 0, delete switch unless last on the network''' @contextlib.contextmanager def _stubs(self, port_count=2): @@ -170,6 +170,7 @@ class TestOptimizedNVPDriverDeletePortSingleSwitch(TestOptimizedNVPDriver): class TestOptimizedNVPDriverCreatePort(TestOptimizedNVPDriver): '''In no case should the optimized driver query for an lswitch.''' + @contextlib.contextmanager def _stubs(self, has_lswitch=True, maxed_ports=False): with contextlib.nested( @@ -433,9 +434,10 @@ class TestGetNetworkDetails(TestOptimizedNVPDriver): class TestQueryMethods(TestOptimizedNVPDriver): - """These tests provide coverage on the query helpers. No serious - assertions are made, as there's no sense in testing that sqlalchemy - does in fact do what it's supposed to do. + """These tests provide coverage on the query helpers. + + No serious assertions are made, as there's no sense in testing that + sqlalchemy does in fact do what it's supposed to do. """ @contextlib.contextmanager diff --git a/quark/utils.py b/quark/utils.py index efa4d77..19d1690 100644 --- a/quark/utils.py +++ b/quark/utils.py @@ -15,10 +15,10 @@ import contextlib -import time -import sys - import cProfile as profiler +import sys +import time + import gc try: import pstats