How to use the rally.task.utils.wait_for_status function in rally

To help you get started, we’ve selected a few rally examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github openstack / rally-openstack / rally_openstack / scenarios / heat / utils.py View on Github external
def _suspend_stack(self, stack):
        """Suspend given stack.

        :param stack: stack that needs to be suspended
        """

        self.clients("heat").actions.suspend(stack.id)
        utils.wait_for_status(
            stack,
            ready_statuses=["SUSPEND_COMPLETE"],
            failure_statuses=["SUSPEND_FAILED", "ERROR"],
            update_resource=utils.get_from_manager(),
            timeout=CONF.openstack.heat_stack_suspend_timeout,
            check_interval=CONF.openstack.heat_stack_suspend_poll_interval)
github openstack / rally / rally / plugins / openstack / scenarios / nova / utils.py View on Github external
def _resize(self, server, flavor):
        server.resize(flavor)
        utils.wait_for_status(
            server,
            ready_statuses=["VERIFY_RESIZE"],
            update_resource=utils.get_from_manager(),
            timeout=CONF.openstack.nova_server_resize_timeout,
            check_interval=CONF.openstack.nova_server_resize_poll_interval
        )
github openstack / rally-openstack / rally_openstack / scenarios / nova / utils.py View on Github external
def _stop_server(self, server):
        """Stop the given server.

        Issues a stop on the given server and waits for the server
        to become SHUTOFF.

        :param server: The server to stop.
        """
        server.stop()
        utils.wait_for_status(
            server,
            ready_statuses=["SHUTOFF"],
            update_resource=utils.get_from_manager(),
            timeout=CONF.openstack.nova_server_stop_timeout,
            check_interval=CONF.openstack.nova_server_stop_poll_interval
        )
github openstack / rally / rally / plugins / openstack / verification / tempest / context.py View on Github external
def _cleanup_images(self):
        image_service = image.Image(self.clients)
        for image_obj in self._created_images:
            LOG.debug("Deleting image '%s'." % image_obj.name)
            self.clients.glance().images.delete(image_obj.id)
            task_utils.wait_for_status(
                image_obj, ["deleted", "pending_delete"],
                check_deletion=True,
                update_resource=image_service.get_image,
                timeout=conf.CONF.openstack.glance_image_delete_timeout,
                check_interval=conf.CONF.openstack.
                glance_image_delete_poll_interval)
            LOG.debug("Image '%s' has been deleted." % image_obj.name)
            self._remove_opt_value_from_config("compute", image_obj.id)
github openstack / rally / rally / plugins / openstack / services / image / glance_v1.py View on Github external
kwargs["copy_from"] = image_location

            image_obj = self._clients.glance("1").images.create(
                name=image_name,
                container_format=container_format,
                disk_format=disk_format,
                is_public=is_public,
                min_disk=min_disk,
                min_ram=min_ram,
                properties=properties,
                **kwargs)

            rutils.interruptable_sleep(CONF.openstack.
                                       glance_image_create_prepoll_delay)

            image_obj = utils.wait_for_status(
                image_obj, ["active"],
                update_resource=self.get_image,
                timeout=CONF.openstack.glance_image_create_timeout,
                check_interval=CONF.openstack.glance_image_create_poll_interval
            )

        finally:
            if "data" in kwargs:
                kwargs["data"].close()

        return image_obj
github openstack / rally-openstack / rally_openstack / scenarios / nova / utils.py View on Github external
def _delete_image(self, image):
        """Delete the given image.

        Returns when the image is actually deleted.

        :param image: Image object
        """
        LOG.warning("Method '_delete_image' of NovaScenario class is "
                    "deprecated since Rally 0.10.0. Use GlanceUtils instead.")
        glance = image_service.Image(self._clients,
                                     atomic_inst=self.atomic_actions())
        glance.delete_image(image.id)
        check_interval = CONF.openstack.nova_server_image_delete_poll_interval
        with atomic.ActionTimer(self, "glance.wait_for_delete"):
            utils.wait_for_status(
                image,
                ready_statuses=["deleted", "pending_delete"],
                check_deletion=True,
                update_resource=glance.get_image,
                timeout=CONF.openstack.nova_server_image_delete_timeout,
                check_interval=check_interval
            )
github openstack / rally-openstack / rally_openstack / scenarios / nova / utils.py View on Github external
def _delete_server(self, server, force=False):
        """Delete the given server.

        Returns when the server is actually deleted.

        :param server: Server object
        :param force: If True, force_delete will be used instead of delete.
        """
        atomic_name = ("nova.%sdelete_server") % (force and "force_" or "")
        with atomic.ActionTimer(self, atomic_name):
            if force:
                server.force_delete()
            else:
                server.delete()

            utils.wait_for_status(
                server,
                ready_statuses=["deleted"],
                check_deletion=True,
                update_resource=utils.get_from_manager(),
                timeout=CONF.openstack.nova_server_delete_timeout,
                check_interval=CONF.openstack.nova_server_delete_poll_interval
            )
github openstack / rally / rally / plugins / openstack / scenarios / nova / utils.py View on Github external
def _delete_servers(self, servers, force=False):
        """Delete multiple servers.

        :param servers: A list of servers to delete
        :param force: If True, force_delete will be used instead of delete.
        """
        atomic_name = ("nova.%sdelete_servers") % (force and "force_" or "")
        with atomic.ActionTimer(self, atomic_name):
            for server in servers:
                if force:
                    server.force_delete()
                else:
                    server.delete()

            for server in servers:
                utils.wait_for_status(
                    server,
                    ready_statuses=["deleted"],
                    check_deletion=True,
                    update_resource=utils.get_from_manager(),
                    timeout=CONF.openstack.nova_server_delete_timeout,
                    check_interval=(
                        CONF.openstack.nova_server_delete_poll_interval)
                )
github openstack / rally / rally / plugins / openstack / scenarios / nova / utils.py View on Github external
def _pause_server(self, server):
        """Pause the live server.

        Returns when the server is actually paused and is in the "PAUSED"
        state.

        :param server: Server object
        """
        server.pause()
        self.sleep_between(CONF.openstack.nova_server_pause_prepoll_delay)
        utils.wait_for_status(
            server,
            ready_statuses=["PAUSED"],
            update_resource=utils.get_from_manager(),
            timeout=CONF.openstack.nova_server_pause_timeout,
            check_interval=CONF.openstack.nova_server_pause_poll_interval
        )