@logging.log_task_wrapper(LOG.info, _("Enter context: `Images`"))
    def setup(self):
        image_url = self.config["image_url"]
        image_type = self.config["image_type"]
        image_container = self.config["image_container"]
        images_per_tenant = self.config["images_per_tenant"]
        image_name = self.config.get("image_name")

        for user, tenant_id in rutils.iterate_per_tenants(
                self.context["users"]):
            current_images = []
            clients = osclients.Clients(
                user["credential"],
                api_info=self.context["config"].get("api_versions"))
            glance_wrap = glance_wrapper.wrap(clients.glance, self)

            kwargs = self.config.get("image_args", {})
            if self.config.get("min_ram") is not None:
                LOG.warning("The 'min_ram' argument is deprecated; specify "
                            "arbitrary arguments with 'image_args' instead")
                kwargs["min_ram"] = self.config["min_ram"]
            if self.config.get("min_disk") is not None:
                LOG.warning("The 'min_disk' argument is deprecated; specify "
                            "arbitrary arguments with 'image_args' instead")
                kwargs["min_disk"] = self.config["min_disk"]

            for i in range(images_per_tenant):
                if image_name and i > 0:
                    cur_name = image_name + str(i)
                elif image_name:
                    cur_name = image_name
                else:
                    cur_name = self.generate_random_name()

                image = glance_wrap.create_image(
                    image_container, image_url, image_type,
                    name=cur_name, **kwargs)
                current_images.append(image.id)

            self.context["tenants"][tenant_id]["images"] = current_images
dataset/ETHPy150Open openstack/rally/rally/plugins/openstack/context/glance/images.py/ImageGenerator.setup/original