From cd16f8b85cf57748c07d169125801ecdb456ea58 Mon Sep 17 00:00:00 2001 From: Kevin Benton Date: Thu, 26 Jan 2017 03:05:44 -0800 Subject: [PATCH] Use new network for each subnet scenario run Using _get_or_create_network was resulting in all concurrent runners creating/updating/deleting subnets on a single Neutron network. This was problematic for two reasons. First, a network in Neutron in any normal deployment does not have that many concurrent subnet create/update/deletes happening on it at once because networks very rarely have more than 1 or 2 subnets on them. Second, it made it appear as though Neutron was having performance problems for handling lots of concurrent subnet requests because Neutron internally performs overlapping checks for subnets within a given network. So we weren't getting performance measurements for normal heavy usage (lots of subnet activity across lots of different networks) and we were getting performance measurements for a non-standard case (significant subnet activity within a single network). This adjusts the scenario to always create a network for each test run, which brings it inline with normal heavy use deployment behavior. Change-Id: I254dbd166a79ca07e18a61da92bc536b035452e1 --- rally/plugins/openstack/scenarios/neutron/network.py | 4 ++-- .../plugins/openstack/scenarios/neutron/test_network.py | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/rally/plugins/openstack/scenarios/neutron/network.py b/rally/plugins/openstack/scenarios/neutron/network.py index 59bec825..bc8a37f6 100644 --- a/rally/plugins/openstack/scenarios/neutron/network.py +++ b/rally/plugins/openstack/scenarios/neutron/network.py @@ -116,7 +116,7 @@ class CreateAndListSubnets(utils.NeutronScenario): :param subnet_cidr_start: str, start value for subnets CIDR :param subnets_per_network: int, number of subnets for one network """ - network = self._get_or_create_network(network_create_args) + network = self._create_network(network_create_args or {}) self._create_subnets(network, subnet_create_args, subnet_cidr_start, subnets_per_network) self._list_subnets() @@ -145,7 +145,7 @@ class CreateAndUpdateSubnets(utils.NeutronScenario): :param subnet_cidr_start: str, start value for subnets CIDR :param subnets_per_network: int, number of subnets for one network """ - network = self._get_or_create_network(network_create_args) + network = self._create_network(network_create_args or {}) subnets = self._create_subnets(network, subnet_create_args, subnet_cidr_start, subnets_per_network) diff --git a/tests/unit/plugins/openstack/scenarios/neutron/test_network.py b/tests/unit/plugins/openstack/scenarios/neutron/test_network.py index 925a7d27..bc3b4cda 100644 --- a/tests/unit/plugins/openstack/scenarios/neutron/test_network.py +++ b/tests/unit/plugins/openstack/scenarios/neutron/test_network.py @@ -141,7 +141,7 @@ class NeutronNetworksTestCase(test.ScenarioTestCase): net = mock.MagicMock() scenario = network.CreateAndListSubnets(self.context) - scenario._get_or_create_network = mock.Mock(return_value=net) + scenario._create_network = mock.Mock(return_value=net) scenario._create_subnets = mock.Mock() scenario._list_subnets = mock.Mock() @@ -150,7 +150,7 @@ class NeutronNetworksTestCase(test.ScenarioTestCase): subnet_cidr_start=subnet_cidr_start, subnets_per_network=subnets_per_network) - scenario._get_or_create_network.assert_called_once_with( + scenario._create_network.assert_called_once_with( network_create_args) scenario._create_subnets.assert_called_once_with( net, subnet_create_args, subnet_cidr_start, subnets_per_network) @@ -167,7 +167,7 @@ class NeutronNetworksTestCase(test.ScenarioTestCase): subnets = [mock.MagicMock() for _ in range(subnets_per_network)] scenario = network.CreateAndUpdateSubnets(self.context) - scenario._get_or_create_network = mock.Mock(return_value=net) + scenario._create_network = mock.Mock(return_value=net) scenario._create_subnets = mock.Mock(return_value=subnets) scenario._update_subnet = mock.Mock() @@ -177,7 +177,7 @@ class NeutronNetworksTestCase(test.ScenarioTestCase): subnet_cidr_start=subnet_cidr_start, subnets_per_network=subnets_per_network) - scenario._get_or_create_network.assert_called_once_with( + scenario._create_network.assert_called_once_with( network_create_args) scenario._create_subnets.assert_called_once_with( net, subnet_create_args, subnet_cidr_start, subnets_per_network)