How to use the rally.task.utils.get_from_manager 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 / rally / plugins / openstack / scenarios / heat / utils.py View on Github external
"files": files or {},
            "environment": environment or {}
        }

        # heat client returns body instead manager object, so we should
        # get manager object using stack_id
        stack_id = self.clients("heat").stacks.create(**kw)["stack"]["id"]
        stack = self.clients("heat").stacks.get(stack_id)

        self.sleep_between(CONF.openstack.heat_stack_create_prepoll_delay)

        stack = utils.wait_for_status(
            stack,
            ready_statuses=["CREATE_COMPLETE"],
            failure_statuses=["CREATE_FAILED", "ERROR"],
            update_resource=utils.get_from_manager(),
            timeout=CONF.openstack.heat_stack_create_timeout,
            check_interval=CONF.openstack.heat_stack_create_poll_interval)

        return stack
github openstack / rally-openstack / rally_openstack / scenarios / nova / utils.py View on Github external
def _rebuild_server(self, server, image, **kwargs):
        """Rebuild a server with a new image.

        :param server: The server to rebuild.
        :param image: The new image to rebuild the server with.
        :param kwargs: Optional additional arguments to pass to the rebuild
        """
        server.rebuild(image, **kwargs)
        self.sleep_between(CONF.openstack.nova_server_rebuild_prepoll_delay)
        utils.wait_for_status(
            server,
            ready_statuses=["ACTIVE"],
            update_resource=utils.get_from_manager(),
            timeout=CONF.openstack.nova_server_rebuild_timeout,
            check_interval=CONF.openstack.nova_server_rebuild_poll_interval
        )
github openstack / rally-openstack / rally_openstack / scenarios / manila / utils.py View on Github external
def _shrink_share(self, share, new_size):
        """Shrink the given share

        :param share: :class:`Share`
        :param new_size: new size of the share
        """
        share.shrink(new_size)
        utils.wait_for_status(
            share,
            ready_statuses=["available"],
            update_resource=utils.get_from_manager(),
            timeout=CONF.openstack.manila_share_create_timeout,
            check_interval=CONF.openstack.manila_share_create_poll_interval)
github openstack / rally / rally / plugins / openstack / scenarios / cinder / utils.py View on Github external
:param volume: volume object
        :param new_size: new volume size in GB, or
                         dictionary, must contain two values:
                             min - minimum size volumes will be created as;
                             max - maximum size volumes will be created as.
                        Notice: should be bigger volume size
        """

        if isinstance(new_size, dict):
            new_size = random.randint(new_size["min"], new_size["max"])

        volume.extend(volume, new_size)
        volume = bench_utils.wait_for_status(
            volume,
            ready_statuses=["available"],
            update_resource=bench_utils.get_from_manager(),
            timeout=CONF.openstack.cinder_volume_create_timeout,
            check_interval=CONF.openstack.cinder_volume_create_poll_interval
        )
github openstack / rally / rally / plugins / openstack / scenarios / nova / utils.py View on Github external
def _do_server_reboot(self, server, reboottype):
        server.reboot(reboot_type=reboottype)
        self.sleep_between(CONF.openstack.nova_server_pause_prepoll_delay)
        utils.wait_for_status(
            server,
            ready_statuses=["ACTIVE"],
            update_resource=utils.get_from_manager(),
            timeout=CONF.openstack.nova_server_reboot_timeout,
            check_interval=CONF.openstack.nova_server_reboot_poll_interval
        )
github openstack / rally / rally / plugins / openstack / scenarios / nova / utils.py View on Github external
def _shelve_server(self, server):
        """Shelve the given server.

        Returns when the server is actually shelved and is in the
        "SHELVED_OFFLOADED" state.

        :param server: Server object
        """
        server.shelve()
        self.sleep_between(CONF.openstack.nova_server_pause_prepoll_delay)
        utils.wait_for_status(
            server,
            ready_statuses=["SHELVED_OFFLOADED"],
            update_resource=utils.get_from_manager(),
            timeout=CONF.openstack.nova_server_shelve_timeout,
            check_interval=CONF.openstack.nova_server_shelve_poll_interval
        )
github openstack / rally-openstack / rally_openstack / scenarios / nova / utils.py View on Github external
def _start_server(self, server):
        """Start the given server.

        A start will be issued for the given server upon which time
        this method will wait for it to become ACTIVE.

        :param server: The server to start and wait to become ACTIVE.
        """
        server.start()
        utils.wait_for_status(
            server,
            ready_statuses=["ACTIVE"],
            update_resource=utils.get_from_manager(),
            timeout=CONF.openstack.nova_server_start_timeout,
            check_interval=CONF.openstack.nova_server_start_poll_interval
        )
github openstack / rally-openstack / rally_openstack / scenarios / manila / utils.py View on Github external
"share_networks", [])
            if share_networks and not kwargs.get("share_network"):
                kwargs["share_network"] = share_networks[
                    self.context["iteration"] % len(share_networks)]["id"]

        if not kwargs.get("name"):
            kwargs["name"] = self.generate_random_name()

        share = self.clients("manila").shares.create(
            share_proto, size, **kwargs)

        self.sleep_between(CONF.openstack.manila_share_create_prepoll_delay)
        share = utils.wait_for_status(
            share,
            ready_statuses=["available"],
            update_resource=utils.get_from_manager(),
            timeout=CONF.openstack.manila_share_create_timeout,
            check_interval=CONF.openstack.manila_share_create_poll_interval,
        )
        return share
github openstack / rally / rally / plugins / openstack / scenarios / magnum / utils.py View on Github external
:param node_count: the cluster node count
        :param kwargs: optional additional arguments for cluster creation
        :returns: magnum cluster
        """

        name = self.generate_random_name()
        cluster = self.clients("magnum").clusters.create(
            name=name, cluster_template_id=cluster_template,
            node_count=node_count, **kwargs)

        common_utils.interruptable_sleep(
            CONF.openstack.magnum_cluster_create_prepoll_delay)
        cluster = utils.wait_for_status(
            cluster,
            ready_statuses=["CREATE_COMPLETE"],
            update_resource=utils.get_from_manager(),
            timeout=CONF.openstack.magnum_cluster_create_timeout,
            check_interval=CONF.openstack.magnum_cluster_create_poll_interval,
            id_attr="uuid"
        )
        return cluster
github openstack / rally / rally / plugins / openstack / scenarios / nova / utils.py View on Github external
def _associate_floating_ip(self, server, address, fixed_address=None):
        """Add floating IP to an instance

        :param server: The :class:`Server` to add an IP to.
        :param address: The ip address or FloatingIP to add to the instance
        :param fixed_address: The fixedIP address the FloatingIP is to be
               associated with (optional)
        """
        server.add_floating_ip(address, fixed_address=fixed_address)
        utils.wait_for(server,
                       is_ready=self.check_ip_address(address),
                       update_resource=utils.get_from_manager())
        # Update server data
        server.addresses = server.manager.get(server.id).addresses