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
This commit is contained in:
parent
5ac225e212
commit
488f3c2231
@ -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:
|
||||
|
@ -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
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
||||
|
@ -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')
|
@ -14,7 +14,7 @@
|
||||
# under the License.
|
||||
|
||||
|
||||
from rally.serverprovider import provider
|
||||
from rally.deploy.serverprovider import provider
|
||||
|
||||
|
||||
class DummyProvider(provider.ProviderFactory):
|
@ -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
|
||||
|
||||
|
@ -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__)
|
@ -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):
|
@ -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()
|
||||
|
@ -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
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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()
|
@ -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']
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user