Update logging of users context
Change-Id: I76e493d371a98097853176c5e6c7f7251fbb35ba
This commit is contained in:
parent
108269ae16
commit
57904bd652
@ -16,6 +16,15 @@ Changelog
|
||||
.. Release notes for existing releases are MUTABLE! If there is something that
|
||||
was missed or can be improved, feel free to change it!
|
||||
|
||||
unreleased
|
||||
----------
|
||||
|
||||
Changed
|
||||
~~~~~~~
|
||||
|
||||
* Improved logging message for the number of used threads while creating
|
||||
keystone users and projects/tenants at *users@openstack* context.
|
||||
|
||||
[1.5.0] - 2019-05-29
|
||||
--------------------
|
||||
|
||||
@ -243,8 +252,8 @@ Fixed
|
||||
|
||||
[1.0.0] - 2018-03-28
|
||||
--------------------
|
||||
Start a fork of `rally/plugins/openstack module of original OpenStack Rally
|
||||
project
|
||||
A start of a fork from `rally/plugins/openstack module of original OpenStack
|
||||
Rally project
|
||||
<https://github.com/openstack/rally/tree/0.11.1/rally/plugins/openstack>`_
|
||||
|
||||
Added
|
||||
@ -271,7 +280,7 @@ Changed
|
||||
<https://github.com/openstack/python-novaclient/blob/10.0.0/releasenotes/notes/remove-virt-interfaces-add-rm-fixed-floating-398c905d9c91cca8.yaml>`_.
|
||||
These actions should be performed via neutronclient now. It is not as simple
|
||||
as it was via Nova-API and you can find more neutron-related atomic actions
|
||||
in results of scenarios.
|
||||
in results of workloads.
|
||||
|
||||
Removed
|
||||
~~~~~~~
|
||||
|
@ -161,9 +161,7 @@ class UserGenerator(context.Context):
|
||||
if default:
|
||||
clients.neutron().delete_security_group(default[0]["id"])
|
||||
|
||||
def _create_tenants(self):
|
||||
threads = self.config["resource_management_workers"]
|
||||
|
||||
def _create_tenants(self, threads):
|
||||
tenants = collections.deque()
|
||||
|
||||
def publish(queue):
|
||||
@ -189,9 +187,8 @@ class UserGenerator(context.Context):
|
||||
|
||||
return tenants_dict
|
||||
|
||||
def _create_users(self):
|
||||
def _create_users(self, threads):
|
||||
# NOTE(msdubov): This should be called after _create_tenants().
|
||||
threads = self.config["resource_management_workers"]
|
||||
users_per_tenant = self.config["users_per_tenant"]
|
||||
default_role = cfg.CONF.openstack.keystone_default_role
|
||||
|
||||
@ -274,11 +271,13 @@ class UserGenerator(context.Context):
|
||||
|
||||
def create_users(self):
|
||||
"""Create tenants and users, using the broker pattern."""
|
||||
threads = self.config["resource_management_workers"]
|
||||
|
||||
threads = min(self.config["resource_management_workers"],
|
||||
self.config["tenants"])
|
||||
|
||||
LOG.debug("Creating %(tenants)d tenants using %(threads)s threads"
|
||||
% {"tenants": self.config["tenants"], "threads": threads})
|
||||
self.context["tenants"] = self._create_tenants()
|
||||
self.context["tenants"] = self._create_tenants(threads)
|
||||
|
||||
if len(self.context["tenants"]) < self.config["tenants"]:
|
||||
raise exceptions.ContextSetupFailure(
|
||||
@ -286,9 +285,10 @@ class UserGenerator(context.Context):
|
||||
msg="Failed to create the requested number of tenants.")
|
||||
|
||||
users_num = self.config["users_per_tenant"] * self.config["tenants"]
|
||||
threads = min(self.config["resource_management_workers"], users_num)
|
||||
LOG.debug("Creating %(users)d users using %(threads)s threads"
|
||||
% {"users": users_num, "threads": threads})
|
||||
self.context["users"] = self._create_users()
|
||||
self.context["users"] = self._create_users(threads)
|
||||
for user in self.context["users"]:
|
||||
self.context["tenants"][user["tenant_id"]]["users"].append(user)
|
||||
|
||||
|
@ -345,7 +345,7 @@ class UserGeneratorForNewUsersTestCase(test.ScenarioTestCase):
|
||||
def test__create_tenants(self, mock_identity):
|
||||
self.context["config"]["users"]["tenants"] = 1
|
||||
user_generator = users.UserGenerator(self.context)
|
||||
tenants = user_generator._create_tenants()
|
||||
tenants = user_generator._create_tenants(1)
|
||||
self.assertEqual(1, len(tenants))
|
||||
id, tenant = tenants.popitem()
|
||||
self.assertIn("name", tenant)
|
||||
@ -356,7 +356,7 @@ class UserGeneratorForNewUsersTestCase(test.ScenarioTestCase):
|
||||
user_generator = users.UserGenerator(self.context)
|
||||
user_generator.context["tenants"] = {"t1": {"id": "t1", "name": "t1"},
|
||||
"t2": {"id": "t2", "name": "t2"}}
|
||||
users_ = user_generator._create_users()
|
||||
users_ = user_generator._create_users(4)
|
||||
self.assertEqual(4, len(users_))
|
||||
for user in users_:
|
||||
self.assertIn("id", user)
|
||||
@ -369,7 +369,7 @@ class UserGeneratorForNewUsersTestCase(test.ScenarioTestCase):
|
||||
user_generator = users.UserGenerator(self.context)
|
||||
user_generator.context["tenants"] = {"t1": {"id": "t1", "name": "t1"},
|
||||
"t2": {"id": "t2", "name": "t2"}}
|
||||
users_ = user_generator._create_users()
|
||||
users_ = user_generator._create_users(4)
|
||||
self.assertEqual(4, len(users_))
|
||||
for user in users_:
|
||||
self.assertIn("id", user)
|
||||
@ -517,7 +517,7 @@ class UserGeneratorForNewUsersTestCase(test.ScenarioTestCase):
|
||||
}
|
||||
|
||||
user_generator = users.UserGenerator(config)
|
||||
users_ = user_generator._create_users()
|
||||
users_ = user_generator._create_users(2)
|
||||
|
||||
for user in users_:
|
||||
self.assertEqual("internal", user["credential"].endpoint_type)
|
||||
@ -540,7 +540,7 @@ class UserGeneratorForNewUsersTestCase(test.ScenarioTestCase):
|
||||
}
|
||||
|
||||
user_generator = users.UserGenerator(config)
|
||||
users_ = user_generator._create_users()
|
||||
users_ = user_generator._create_users(2)
|
||||
|
||||
for user in users_:
|
||||
self.assertEqual("public", user["credential"].endpoint_type)
|
||||
|
Loading…
x
Reference in New Issue
Block a user