From 488f3c223167f865fd5b4d03e1c2bd9f58e3de88 Mon Sep 17 00:00:00 2001 From: Mark Wagner Date: Wed, 19 Mar 2014 15:32:13 -0400 Subject: [PATCH] Move serverprovider under deploy Move serverprovider under deploy in both rally and tests dirs Moved both directories as requested, adusted the import references in files as appropriate. Also adjusted several pathnames for tests. Updated docs. Change-Id: I38aaded6aca6ed08bdcdded0bee800c2ed2d6ad1 --- doc/source/provisioning.rst | 20 ++++++++--------- rally/deploy/engine.py | 2 +- rally/deploy/engines/devstack.py | 2 +- rally/{ => deploy}/serverprovider/__init__.py | 4 ++-- rally/{ => deploy}/serverprovider/__main__.py | 0 rally/{ => deploy}/serverprovider/provider.py | 0 .../serverprovider/providers/__init__.py | 0 .../serverprovider/providers/dummy.py | 2 +- .../serverprovider/providers/lxc.py | 2 +- .../providers/lxc/configure_container.sh | 0 .../providers/lxc/lxc-install.sh | 0 .../providers/lxc/tunnel-local.sh | 0 .../providers/lxc/tunnel-remote.sh | 0 .../serverprovider/providers/openstack.py | 2 +- .../serverprovider/providers/virsh.py | 2 +- .../providers/virsh/get_domain_ip.sh | 0 tests/deploy/engines/test_devstack.py | 2 +- tests/{ => deploy}/serverprovider/__init__.py | 0 .../serverprovider/providers/__init__.py | 0 .../serverprovider/providers/test_dummy.py | 4 ++-- .../serverprovider/providers/test_lxc.py | 6 ++--- .../providers/test_openstack.py | 22 +++++++++---------- .../serverprovider/providers/test_virsh.py | 16 ++++++++------ .../serverprovider/test_provider.py | 2 +- 24 files changed, 45 insertions(+), 43 deletions(-) rename rally/{ => deploy}/serverprovider/__init__.py (83%) rename rally/{ => deploy}/serverprovider/__main__.py (100%) rename rally/{ => deploy}/serverprovider/provider.py (100%) rename rally/{ => deploy}/serverprovider/providers/__init__.py (100%) rename rally/{ => deploy}/serverprovider/providers/dummy.py (97%) rename rally/{ => deploy}/serverprovider/providers/lxc.py (99%) rename rally/{ => deploy}/serverprovider/providers/lxc/configure_container.sh (100%) rename rally/{ => deploy}/serverprovider/providers/lxc/lxc-install.sh (100%) rename rally/{ => deploy}/serverprovider/providers/lxc/tunnel-local.sh (100%) rename rally/{ => deploy}/serverprovider/providers/lxc/tunnel-remote.sh (100%) rename rally/{ => deploy}/serverprovider/providers/openstack.py (99%) rename rally/{ => deploy}/serverprovider/providers/virsh.py (98%) rename rally/{ => deploy}/serverprovider/providers/virsh/get_domain_ip.sh (100%) rename tests/{ => deploy}/serverprovider/__init__.py (100%) rename tests/{ => deploy}/serverprovider/providers/__init__.py (100%) rename tests/{ => deploy}/serverprovider/providers/test_dummy.py (95%) rename tests/{ => deploy}/serverprovider/providers/test_lxc.py (98%) rename tests/{ => deploy}/serverprovider/providers/test_openstack.py (91%) rename tests/{ => deploy}/serverprovider/providers/test_virsh.py (90%) rename tests/{ => deploy}/serverprovider/test_provider.py (98%) diff --git a/doc/source/provisioning.rst b/doc/source/provisioning.rst index ec18870de2..0336bd294b 100644 --- a/doc/source/provisioning.rst +++ b/doc/source/provisioning.rst @@ -20,10 +20,10 @@ The Server Provider Layer Represents a pluggable mechanism of providers of servers for deployments. -The :mod:`rally.serverprovider.provider` Module +The :mod:`rally.deploy.serverprovider.provider` Module ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. automodule:: rally.serverprovider.provider +.. automodule:: rally.deploy.serverprovider.provider :members: :undoc-members: :show-inheritance: @@ -31,10 +31,10 @@ The :mod:`rally.serverprovider.provider` Module The Dummy Server Provider ------------------------- -The :mod:`rally.serverprovider.providers.dummy` Module +The :mod:`rally.deploy.serverprovider.providers.dummy` Module ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. automodule:: rally.serverprovider.providers.dummy +.. automodule:: rally.deploy.serverprovider.providers.dummy :members: :undoc-members: :show-inheritance: @@ -42,10 +42,10 @@ The :mod:`rally.serverprovider.providers.dummy` Module The OpenStack Server Provider ----------------------------- -The :mod:`rally.serverprovider.providers.openstack` Module +The :mod:`rally.deploy.serverprovider.providers.openstack` Module ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. automodule:: rally.serverprovider.providers.openstack +.. automodule:: rally.deploy.serverprovider.providers.openstack :members: :undoc-members: :show-inheritance: @@ -53,10 +53,10 @@ The :mod:`rally.serverprovider.providers.openstack` Module The LXC Server Provider ----------------------- -The :mod:`rally.serverprovider.providers.lxc` Module +The :mod:`rally.deploy.serverprovider.providers.lxc` Module ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. automodule:: rally.serverprovider.providers.lxc +.. automodule:: rally.deploy.serverprovider.providers.lxc :members: :undoc-members: :show-inheritance: @@ -64,10 +64,10 @@ The :mod:`rally.serverprovider.providers.lxc` Module The Virsh Server Provider ------------------------- -The :mod:`rally.serverprovider.providers.virsh` Module +The :mod:`rally.deploy.serverprovider.providers.virsh` Module ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. automodule:: rally.serverprovider.providers.virsh +.. automodule:: rally.deploy.serverprovider.providers.virsh :members: :undoc-members: :show-inheritance: diff --git a/rally/deploy/engine.py b/rally/deploy/engine.py index fc35d63540..14c75d53b6 100644 --- a/rally/deploy/engine.py +++ b/rally/deploy/engine.py @@ -19,10 +19,10 @@ import jsonschema import six from rally import consts +from rally.deploy.serverprovider import provider from rally import exceptions from rally.openstack.common.gettextutils import _ from rally.openstack.common import log as logging -from rally.serverprovider import provider from rally import utils diff --git a/rally/deploy/engines/devstack.py b/rally/deploy/engines/devstack.py index faf7a80c4a..e9c5e54f3c 100644 --- a/rally/deploy/engines/devstack.py +++ b/rally/deploy/engines/devstack.py @@ -17,10 +17,10 @@ import os from rally import consts from rally.deploy import engine +from rally.deploy.serverprovider import provider from rally import objects from rally.openstack.common.gettextutils import _ from rally.openstack.common import log as logging -from rally.serverprovider import provider from rally import utils diff --git a/rally/serverprovider/__init__.py b/rally/deploy/serverprovider/__init__.py similarity index 83% rename from rally/serverprovider/__init__.py rename to rally/deploy/serverprovider/__init__.py index 53aa96a6b2..dffbcf43d6 100644 --- a/rally/serverprovider/__init__.py +++ b/rally/deploy/serverprovider/__init__.py @@ -13,8 +13,8 @@ # License for the specific language governing permissions and limitations # under the License. -from rally.serverprovider.provider import * # noqa +from rally.deploy.serverprovider.provider import * # noqa from rally import utils -utils.import_modules_from_package('rally.serverprovider.providers') +utils.import_modules_from_package('rally.deploy.serverprovider.providers') diff --git a/rally/serverprovider/__main__.py b/rally/deploy/serverprovider/__main__.py similarity index 100% rename from rally/serverprovider/__main__.py rename to rally/deploy/serverprovider/__main__.py diff --git a/rally/serverprovider/provider.py b/rally/deploy/serverprovider/provider.py similarity index 100% rename from rally/serverprovider/provider.py rename to rally/deploy/serverprovider/provider.py diff --git a/rally/serverprovider/providers/__init__.py b/rally/deploy/serverprovider/providers/__init__.py similarity index 100% rename from rally/serverprovider/providers/__init__.py rename to rally/deploy/serverprovider/providers/__init__.py diff --git a/rally/serverprovider/providers/dummy.py b/rally/deploy/serverprovider/providers/dummy.py similarity index 97% rename from rally/serverprovider/providers/dummy.py rename to rally/deploy/serverprovider/providers/dummy.py index 7e901cd554..8989e1570e 100644 --- a/rally/serverprovider/providers/dummy.py +++ b/rally/deploy/serverprovider/providers/dummy.py @@ -14,7 +14,7 @@ # under the License. -from rally.serverprovider import provider +from rally.deploy.serverprovider import provider class DummyProvider(provider.ProviderFactory): diff --git a/rally/serverprovider/providers/lxc.py b/rally/deploy/serverprovider/providers/lxc.py similarity index 99% rename from rally/serverprovider/providers/lxc.py rename to rally/deploy/serverprovider/providers/lxc.py index c76d4fbabd..e52cc65276 100644 --- a/rally/serverprovider/providers/lxc.py +++ b/rally/deploy/serverprovider/providers/lxc.py @@ -19,10 +19,10 @@ import re import StringIO import time +from rally.deploy.serverprovider import provider from rally import exceptions from rally.openstack.common.gettextutils import _ from rally.openstack.common import log as logging -from rally.serverprovider import provider from rally import utils diff --git a/rally/serverprovider/providers/lxc/configure_container.sh b/rally/deploy/serverprovider/providers/lxc/configure_container.sh similarity index 100% rename from rally/serverprovider/providers/lxc/configure_container.sh rename to rally/deploy/serverprovider/providers/lxc/configure_container.sh diff --git a/rally/serverprovider/providers/lxc/lxc-install.sh b/rally/deploy/serverprovider/providers/lxc/lxc-install.sh similarity index 100% rename from rally/serverprovider/providers/lxc/lxc-install.sh rename to rally/deploy/serverprovider/providers/lxc/lxc-install.sh diff --git a/rally/serverprovider/providers/lxc/tunnel-local.sh b/rally/deploy/serverprovider/providers/lxc/tunnel-local.sh similarity index 100% rename from rally/serverprovider/providers/lxc/tunnel-local.sh rename to rally/deploy/serverprovider/providers/lxc/tunnel-local.sh diff --git a/rally/serverprovider/providers/lxc/tunnel-remote.sh b/rally/deploy/serverprovider/providers/lxc/tunnel-remote.sh similarity index 100% rename from rally/serverprovider/providers/lxc/tunnel-remote.sh rename to rally/deploy/serverprovider/providers/lxc/tunnel-remote.sh diff --git a/rally/serverprovider/providers/openstack.py b/rally/deploy/serverprovider/providers/openstack.py similarity index 99% rename from rally/serverprovider/providers/openstack.py rename to rally/deploy/serverprovider/providers/openstack.py index 63ca1b2641..db352d9d4e 100644 --- a/rally/serverprovider/providers/openstack.py +++ b/rally/deploy/serverprovider/providers/openstack.py @@ -19,12 +19,12 @@ import time import urllib2 from rally.benchmark import utils as benchmark_utils +from rally.deploy.serverprovider import provider from rally import exceptions from rally.objects import endpoint from rally.openstack.common.gettextutils import _ from rally.openstack.common import log as logging from rally import osclients -from rally.serverprovider import provider LOG = logging.getLogger(__name__) diff --git a/rally/serverprovider/providers/virsh.py b/rally/deploy/serverprovider/providers/virsh.py similarity index 98% rename from rally/serverprovider/providers/virsh.py rename to rally/deploy/serverprovider/providers/virsh.py index 83f75a728c..7a22c0845f 100644 --- a/rally/serverprovider/providers/virsh.py +++ b/rally/deploy/serverprovider/providers/virsh.py @@ -19,7 +19,7 @@ import subprocess import time import uuid -from rally.serverprovider import provider +from rally.deploy.serverprovider import provider class VirshProvider(provider.ProviderFactory): diff --git a/rally/serverprovider/providers/virsh/get_domain_ip.sh b/rally/deploy/serverprovider/providers/virsh/get_domain_ip.sh similarity index 100% rename from rally/serverprovider/providers/virsh/get_domain_ip.sh rename to rally/deploy/serverprovider/providers/virsh/get_domain_ip.sh diff --git a/tests/deploy/engines/test_devstack.py b/tests/deploy/engines/test_devstack.py index b843352228..a3e2bf0abf 100644 --- a/tests/deploy/engines/test_devstack.py +++ b/tests/deploy/engines/test_devstack.py @@ -73,7 +73,7 @@ class DevstackEngineTestCase(test.BaseTestCase): @mock.patch('rally.deploy.engine.EngineFactory.get_provider') @mock.patch('rally.deploy.engines.devstack.get_updated_server') @mock.patch('rally.deploy.engines.devstack.get_script') - @mock.patch('rally.serverprovider.provider.Server') + @mock.patch('rally.deploy.serverprovider.provider.Server') @mock.patch('rally.deploy.engines.devstack.objects.Endpoint') def test_deploy(self, m_endpoint, m_server, m_gs, m_gus, m_gp): m_gp.return_value = fake_provider = mock.Mock() diff --git a/tests/serverprovider/__init__.py b/tests/deploy/serverprovider/__init__.py similarity index 100% rename from tests/serverprovider/__init__.py rename to tests/deploy/serverprovider/__init__.py diff --git a/tests/serverprovider/providers/__init__.py b/tests/deploy/serverprovider/providers/__init__.py similarity index 100% rename from tests/serverprovider/providers/__init__.py rename to tests/deploy/serverprovider/providers/__init__.py diff --git a/tests/serverprovider/providers/test_dummy.py b/tests/deploy/serverprovider/providers/test_dummy.py similarity index 95% rename from tests/serverprovider/providers/test_dummy.py rename to tests/deploy/serverprovider/providers/test_dummy.py index d3c4a7101e..7e9e516119 100644 --- a/tests/serverprovider/providers/test_dummy.py +++ b/tests/deploy/serverprovider/providers/test_dummy.py @@ -15,8 +15,8 @@ import jsonschema -from rally import serverprovider -from rally.serverprovider.providers import dummy +from rally.deploy import serverprovider +from rally.deploy.serverprovider.providers import dummy from tests import test diff --git a/tests/serverprovider/providers/test_lxc.py b/tests/deploy/serverprovider/providers/test_lxc.py similarity index 98% rename from tests/serverprovider/providers/test_lxc.py rename to tests/deploy/serverprovider/providers/test_lxc.py index a04fa2ab67..779f29fa0a 100644 --- a/tests/serverprovider/providers/test_lxc.py +++ b/tests/deploy/serverprovider/providers/test_lxc.py @@ -17,12 +17,12 @@ import jsonschema import mock import netaddr +from rally.deploy.serverprovider.providers import lxc from rally import exceptions from rally.openstack.common import test -from rally.serverprovider.providers import lxc -MOD_NAME = 'rally.serverprovider.providers.lxc.' +MOD_NAME = 'rally.deploy.serverprovider.providers.lxc.' class HelperFunctionsTestCase(test.BaseTestCase): @@ -33,7 +33,7 @@ class HelperFunctionsTestCase(test.BaseTestCase): self.assertEqual('fake_script', script) path = m_open.mock_calls[0][1][0] mode = m_open.mock_calls[0][1][1] - self.assertTrue(path.endswith('rally/serverprovider/providers' + self.assertTrue(path.endswith('rally/deploy/serverprovider/providers' '/lxc/script.sh')) self.assertEqual('rb', mode) diff --git a/tests/serverprovider/providers/test_openstack.py b/tests/deploy/serverprovider/providers/test_openstack.py similarity index 91% rename from tests/serverprovider/providers/test_openstack.py rename to tests/deploy/serverprovider/providers/test_openstack.py index 3c0028d0db..e1fb296523 100644 --- a/tests/serverprovider/providers/test_openstack.py +++ b/tests/deploy/serverprovider/providers/test_openstack.py @@ -18,13 +18,13 @@ import jsonschema import mock +from rally.deploy.serverprovider.providers import openstack as provider from rally import exceptions from rally.openstack.common.fixture import mockpatch -from rally.serverprovider.providers import openstack as provider from tests import fakes from tests import test -MOD_NAME = 'rally.serverprovider.providers.openstack' +MOD_NAME = 'rally.deploy.serverprovider.providers.openstack' OSProvider = provider.OpenStackProvider @@ -41,7 +41,7 @@ class OpenStackProviderTestCase(test.TestCase): def setUp(self): super(OpenStackProviderTestCase, self).setUp() - self.useFixture(mockpatch.Patch('rally.serverprovider.provider.' + self.useFixture(mockpatch.Patch('rally.deploy.serverprovider.provider.' 'ResourceManager')) def _get_valid_config(self): @@ -85,7 +85,7 @@ class OpenStackProviderTestCase(test.TestCase): self.clients.nova = mock.MagicMock( return_value=self.nova_client) - @mock.patch("rally.serverprovider.providers.openstack.osclients") + @mock.patch("rally.deploy.serverprovider.providers.openstack.osclients") def test_openstack_provider_init(self, os_cli): cfg = self._get_valid_config() os_cli.Clients = mock.MagicMock(return_value=FakeOSClients()) @@ -100,7 +100,7 @@ class OpenStackProviderTestCase(test.TestCase): provider = OSProvider(mock.MagicMock(), cfg) self.assertEqual(provider.glance, None) - @mock.patch("rally.serverprovider.providers.openstack.osclients") + @mock.patch("rally.deploy.serverprovider.providers.openstack.osclients") def test_openstack_provider_init_with_invalid_conf_no_user(self, mock_osclient): cfg = self._get_valid_config() @@ -108,7 +108,7 @@ class OpenStackProviderTestCase(test.TestCase): self.assertRaises(jsonschema.ValidationError, OSProvider, mock.MagicMock(), cfg) - @mock.patch("rally.serverprovider.providers.openstack.osclients") + @mock.patch("rally.deploy.serverprovider.providers.openstack.osclients") def test_openstack_provider_init_with_invalid_conf_no_url(self, mock_osclient): cfg = self._get_valid_config() @@ -117,7 +117,7 @@ class OpenStackProviderTestCase(test.TestCase): self.assertRaises(jsonschema.ValidationError, OSProvider, mock.MagicMock(), cfg) - @mock.patch("rally.serverprovider.providers.openstack.osclients") + @mock.patch("rally.deploy.serverprovider.providers.openstack.osclients") def test_openstack_provider_init_with_invalid_conf_extra_key(self, mock_osclnt): cfg = self._get_valid_config() @@ -125,26 +125,26 @@ class OpenStackProviderTestCase(test.TestCase): self.assertRaises(jsonschema.ValidationError, OSProvider, mock.MagicMock(), cfg) - @mock.patch("rally.serverprovider.providers.openstack.osclients") + @mock.patch("rally.deploy.serverprovider.providers.openstack.osclients") def test_openstack_provider_init_with_invalid_conf_flavor_(self, mock_osclient): cfg = self._get_valid_config()["user"] = 1111 self.assertRaises(jsonschema.ValidationError, OSProvider, mock.MagicMock(), cfg) - @mock.patch("rally.serverprovider.providers.openstack.osclients") + @mock.patch("rally.deploy.serverprovider.providers.openstack.osclients") def test_openstack_provider_with_valid_config(self, mock_osclient): cfg = self._get_valid_config() OSProvider(mock.MagicMock(), cfg) - @mock.patch("rally.serverprovider.providers.openstack.osclients") + @mock.patch("rally.deploy.serverprovider.providers.openstack.osclients") def test_openstack_provider_with_valid_config_uuid(self, mock_osclient): cfg = self._get_valid_config() cfg['image'] = dict(uuid="289D7A51-1A0C-43C4-800D-706EA8A3CDF3") OSProvider(mock.MagicMock(), cfg) - @mock.patch("rally.serverprovider.providers.openstack.osclients") + @mock.patch("rally.deploy.serverprovider.providers.openstack.osclients") def test_openstack_provider_with_valid_config_checksum(self, mock_osclient): cfg = self._get_valid_config() diff --git a/tests/serverprovider/providers/test_virsh.py b/tests/deploy/serverprovider/providers/test_virsh.py similarity index 90% rename from tests/serverprovider/providers/test_virsh.py rename to tests/deploy/serverprovider/providers/test_virsh.py index 7a75c2b1c5..725548f39f 100644 --- a/tests/serverprovider/providers/test_virsh.py +++ b/tests/deploy/serverprovider/providers/test_virsh.py @@ -18,9 +18,9 @@ import mock import netaddr import os +from rally.deploy.serverprovider.providers import virsh from rally.openstack.common.fixture import mockpatch from rally.openstack.common import test -from rally.serverprovider.providers import virsh class VirshProviderTestCase(test.BaseTestCase): @@ -37,8 +37,9 @@ class VirshProviderTestCase(test.BaseTestCase): self.provider = virsh.VirshProvider(self.deployment, self.config) self.useFixture(mockpatch.PatchObject(self.provider, 'resources')) - @mock.patch('rally.serverprovider.providers.virsh.netaddr.IPAddress') - @mock.patch('rally.serverprovider.providers.virsh.subprocess') + @mock.patch( + 'rally.deploy.serverprovider.providers.virsh.netaddr.IPAddress') + @mock.patch('rally.deploy.serverprovider.providers.virsh.subprocess') @mock.patch('time.sleep') def test_create_vm(self, mock_sleep, mock_subp, mock_ipaddress): mock_subp.check_output.return_value = '10.0.0.1' @@ -67,8 +68,9 @@ class VirshProviderTestCase(test.BaseTestCase): 'name': 'name', }) - @mock.patch('rally.serverprovider.providers.virsh.netaddr.IPAddress') - @mock.patch('rally.serverprovider.providers.virsh.subprocess') + @mock.patch( + 'rally.deploy.serverprovider.providers.virsh.netaddr.IPAddress') + @mock.patch('rally.deploy.serverprovider.providers.virsh.subprocess') @mock.patch('time.sleep') def test_create_vm_ip_failed(self, mock_sleep, mock_subp, mock_ipaddress): mock_ipaddress.side_effect = netaddr.core.AddrFormatError @@ -79,7 +81,7 @@ class VirshProviderTestCase(test.BaseTestCase): ]) self.assertEqual(server.host, 'None') - @mock.patch('rally.serverprovider.providers.virsh.subprocess') + @mock.patch('rally.deploy.serverprovider.providers.virsh.subprocess') def test_destroy_vm(self, mock_subp): self.provider.destroy_vm('uuid') mock_subp.assert_has_calls([ @@ -90,7 +92,7 @@ class VirshProviderTestCase(test.BaseTestCase): shell=True), ]) - @mock.patch('rally.serverprovider.providers.virsh.uuid') + @mock.patch('rally.deploy.serverprovider.providers.virsh.uuid') @mock.patch.object(virsh.VirshProvider, 'create_vm') def test_create_servers(self, mock_create, mock_uuid): mock_uuid.uuid4.side_effect = ['1', '2', '3'] diff --git a/tests/serverprovider/test_provider.py b/tests/deploy/serverprovider/test_provider.py similarity index 98% rename from tests/serverprovider/test_provider.py rename to tests/deploy/serverprovider/test_provider.py index 6240e94a70..ffb472bbdd 100644 --- a/tests/serverprovider/test_provider.py +++ b/tests/deploy/serverprovider/test_provider.py @@ -16,8 +16,8 @@ import mock +from rally.deploy import serverprovider from rally import exceptions -from rally import serverprovider from rally import sshutils from tests import test