Esempio n. 1
0
 def __init__(self, context=None, admin_clients=None, clients=None):
     super(CinderBasic, self).__init__(context, admin_clients, clients)
     if hasattr(self, "_admin_clients"):
         self.admin_cinder = block.BlockStorage(
             self._admin_clients,
             name_generator=self.generate_random_name,
             atomic_inst=self.atomic_actions())
     if hasattr(self, "_clients"):
         self.cinder = block.BlockStorage(
             self._clients,
             name_generator=self.generate_random_name,
             atomic_inst=self.atomic_actions())
 def _get_service_with_fake_impl(self):
     path = "rally_openstack.common.services.storage.block"
     path = "%s.BlockStorage.discover_impl" % path
     with mock.patch(path) as mock_discover:
         mock_discover.return_value = mock.MagicMock(), None
         service = block.BlockStorage(self.clients)
     return service
Esempio n. 3
0
 def pre_process(self, resource_spec, config):
     resource_id = resource_spec.get("id")
     if not resource_id:
         cinder = block.BlockStorage(self._clients)
         resource_id = types._id_from_name(resource_config=resource_spec,
                                           resources=cinder.list_types(),
                                           typename="volume_type")
     return resource_id
Esempio n. 4
0
 def setup(self):
     admin_clients = osclients.Clients(
         self.context.get("admin", {}).get("credential"))
     cinder_service = block.BlockStorage(
         admin_clients,
         name_generator=self.generate_random_name,
         atomic_inst=self.atomic_actions())
     self.context["volume_types"] = []
     for vtype_name in self.config:
         LOG.debug("Creating Cinder volume type %s" % vtype_name)
         vtype = cinder_service.create_volume_type(vtype_name)
         self.context["volume_types"].append({
             "id": vtype.id,
             "name": vtype_name
         })
Esempio n. 5
0
    def setup(self):
        size = self.config["size"]
        volume_type = self.config.get("type", None)
        volumes_per_tenant = self.config["volumes_per_tenant"]

        for user, tenant_id in self._iterate_per_tenants():
            self.context["tenants"][tenant_id].setdefault("volumes", [])
            clients = osclients.Clients(user["credential"])
            cinder_service = block.BlockStorage(
                clients,
                name_generator=self.generate_random_name,
                atomic_inst=self.atomic_actions())
            for i in range(volumes_per_tenant):
                vol = cinder_service.create_volume(size,
                                                   volume_type=volume_type)
                self.context["tenants"][tenant_id]["volumes"].append(
                    vol._as_dict())