Esempio n. 1
0
 def test__list_volumes(self, mock_clients):
     volumes_list = mock.Mock()
     mock_clients("cinder").volumes.list.return_value = volumes_list
     scenario = utils.CinderScenario()
     return_volumes_list = scenario._list_volumes()
     self.assertEqual(volumes_list, return_volumes_list)
     self._test_atomic_action_timer(scenario.atomic_actions(),
                                    'cinder.list_volumes')
Esempio n. 2
0
 def setUp(self):
     super(CinderScenarioTestCase, self).setUp()
     self.res_is = mockpatch.Patch(BM_UTILS + ".resource_is")
     self.get_fm = mockpatch.Patch(BM_UTILS + '.get_from_manager')
     self.wait_for = mockpatch.Patch(CINDER_UTILS + ".bench_utils.wait_for")
     self.wait_for_delete = mockpatch.Patch(CINDER_UTILS +
                                            ".bench_utils.wait_for_delete")
     self.useFixture(self.wait_for)
     self.useFixture(self.wait_for_delete)
     self.useFixture(self.res_is)
     self.useFixture(self.get_fm)
     self.gfm = self.get_fm.mock
     self.useFixture(mockpatch.Patch('time.sleep'))
     self.scenario = utils.CinderScenario()
Esempio n. 3
0
    def setup(self):
        size = self.config["size"]
        volumes_per_tenant = self.config["volumes_per_tenant"]

        for user, tenant_id in rutils.iterate_per_tenants(
                self.context["users"]):
            self.context["tenants"][tenant_id].setdefault("volumes", list())
            clients = osclients.Clients(user["endpoint"])
            cinder_util = cinder_utils.CinderScenario(clients=clients)
            for i in range(volumes_per_tenant):
                rnd_name = scenario_base.Scenario._generate_random_name(
                                                    prefix="ctx_rally_volume_")
                vol = cinder_util._create_volume(size, display_name=rnd_name)
                self.context["tenants"][tenant_id]["volumes"].append(vol._info)
Esempio n. 4
0
    def setup(self):
        size = self.config["size"]
        current_tenants = []

        for user in self.context["users"]:
            if user["tenant_id"] not in current_tenants:
                current_tenants.append(user["tenant_id"])
                clients = osclients.Clients(user["endpoint"])
                cinder_util = cinder_utils.CinderScenario(clients=clients)
                volume = cinder_util._create_volume(size)
                self.context["volumes"].append({"volume_id": volume.id,
                                                "endpoint": user["endpoint"],
                                                "tenant_id": user[
                                                    "tenant_id"]})