Replace the usage of 'manager' with 'os_primary'

Alias 'manager' has been moved to 'os_primary' in version Pike,
and it will be removed in version Queens. This patch is to replace
the usage of 'manager' with 'os_primary'.

Change-Id: I5301287b3c6265a6f235d63b3665199065bde0d4
This commit is contained in:
jeremy.zhang 2017-05-25 21:29:57 +08:00
parent 7203f58c97
commit 0343be5259
3 changed files with 26 additions and 32 deletions

View File

@ -145,7 +145,7 @@ class TokensV3TestJSON(base.BaseIdentityV3AdminTest):
@decorators.idempotent_id('08ed85ce-2ba8-4864-b442-bcc61f16ae89')
def test_get_available_project_scopes(self):
manager_project_id = self.manager.credentials.project_id
manager_project_id = self.os_primary.credentials.project_id
admin_user_id = self.os_admin.credentials.user_id
admin_role_id = self.get_role_by_name(CONF.identity.admin_role)['id']

View File

@ -47,40 +47,40 @@ class ScenarioTest(tempest.test.BaseTestCase):
def setup_clients(cls):
super(ScenarioTest, cls).setup_clients()
# Clients (in alphabetical order)
cls.flavors_client = cls.manager.flavors_client
cls.flavors_client = cls.os_primary.flavors_client
cls.compute_floating_ips_client = (
cls.manager.compute_floating_ips_client)
cls.os_primary.compute_floating_ips_client)
if CONF.service_available.glance:
# Check if glance v1 is available to determine which client to use.
if CONF.image_feature_enabled.api_v1:
cls.image_client = cls.manager.image_client
cls.image_client = cls.os_primary.image_client
elif CONF.image_feature_enabled.api_v2:
cls.image_client = cls.manager.image_client_v2
cls.image_client = cls.os_primary.image_client_v2
else:
raise lib_exc.InvalidConfiguration(
'Either api_v1 or api_v2 must be True in '
'[image-feature-enabled].')
# Compute image client
cls.compute_images_client = cls.manager.compute_images_client
cls.keypairs_client = cls.manager.keypairs_client
cls.compute_images_client = cls.os_primary.compute_images_client
cls.keypairs_client = cls.os_primary.keypairs_client
# Nova security groups client
cls.compute_security_groups_client = (
cls.manager.compute_security_groups_client)
cls.os_primary.compute_security_groups_client)
cls.compute_security_group_rules_client = (
cls.manager.compute_security_group_rules_client)
cls.servers_client = cls.manager.servers_client
cls.interface_client = cls.manager.interfaces_client
cls.os_primary.compute_security_group_rules_client)
cls.servers_client = cls.os_primary.servers_client
cls.interface_client = cls.os_primary.interfaces_client
# Neutron network client
cls.networks_client = cls.manager.networks_client
cls.ports_client = cls.manager.ports_client
cls.routers_client = cls.manager.routers_client
cls.subnets_client = cls.manager.subnets_client
cls.floating_ips_client = cls.manager.floating_ips_client
cls.security_groups_client = cls.manager.security_groups_client
cls.networks_client = cls.os_primary.networks_client
cls.ports_client = cls.os_primary.ports_client
cls.routers_client = cls.os_primary.routers_client
cls.subnets_client = cls.os_primary.subnets_client
cls.floating_ips_client = cls.os_primary.floating_ips_client
cls.security_groups_client = cls.os_primary.security_groups_client
cls.security_group_rules_client = (
cls.manager.security_group_rules_client)
cls.volumes_client = cls.manager.volumes_v2_client
cls.snapshots_client = cls.manager.snapshots_v2_client
cls.os_primary.security_group_rules_client)
cls.volumes_client = cls.os_primary.volumes_v2_client
cls.snapshots_client = cls.os_primary.snapshots_v2_client
# ## Test functions library
#
@ -133,7 +133,7 @@ class ScenarioTest(tempest.test.BaseTestCase):
# Needed for the cross_tenant_traffic test:
if clients is None:
clients = self.manager
clients = self.os_primary
if name is None:
name = data_utils.rand_name(self.__class__.__name__ + "-server")

View File

@ -13,7 +13,6 @@
# License for the specific language governing permissions and limitations
# under the License.
from tempest import config
from tempest.lib import decorators
from tempest.lib import exceptions
@ -35,15 +34,6 @@ class TestServerMultinode(manager.ScenarioTest):
raise cls.skipException(
"Less than 2 compute nodes, skipping multinode tests.")
@classmethod
def setup_clients(cls):
super(TestServerMultinode, cls).setup_clients()
# Use admin client by default
cls.manager = cls.os_admin
# this is needed so that we can use the availability_zone:host
# scheduler hint, which is admin_only by default
cls.servers_client = cls.os_admin.servers_client
@decorators.idempotent_id('9cecbe35-b9d4-48da-a37e-7ce70aa43d30')
@decorators.attr(type='smoke')
@test.services('compute', 'network')
@ -74,9 +64,13 @@ class TestServerMultinode(manager.ScenarioTest):
for host in hosts[:CONF.compute.min_compute_nodes]:
# by getting to active state here, this means this has
# landed on the host in question.
# in order to use the availability_zone:host scheduler hint,
# admin client is need here.
inst = self.create_server(
clients=self.os_admin,
availability_zone='%(zone)s:%(host_name)s' % host)
server = self.servers_client.show_server(inst['id'])['server']
server = self.os_admin.servers_client.show_server(
inst['id'])['server']
# ensure server is located on the requested host
self.assertEqual(host['host_name'], server['OS-EXT-SRV-ATTR:host'])
servers.append(server)