How to use the rally.task.atomic.action_timer 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 / designate / utils.py View on Github external
    @atomic.action_timer("designate.delete_server")
    def _delete_server(self, server_id):
        """Delete Server.

        :param server_id: unicode server ID
        """
        self.admin_clients("designate").servers.delete(server_id)
github openstack / rally-openstack / rally_openstack / services / image / glance_v2.py View on Github external
    @atomic.action_timer("glance_v2.upload_data")
    def upload_data(self, image_id, image_location):
        """Upload the data for an image.

        :param image_id: Image ID to upload data to.
        :param image_location: Location of the data to upload to.
        """
        image_location = os.path.expanduser(image_location)
        image_data = None
        response = None
        try:
            if os.path.isfile(image_location):
                image_data = open(image_location, "rb")
            else:
                response = requests.get(image_location, stream=True)
                image_data = response.raw
            self._clients.glance("2").images.upload(image_id, image_data)
github openstack / rally / rally / plugins / openstack / scenarios / nova / utils.py View on Github external
    @atomic.action_timer("nova.unpause_server")
    def _unpause_server(self, server):
        """Unpause the paused server.

        Returns when the server is actually unpaused and is in the "ACTIVE"
        state.

        :param server: Server object
        """
        server.unpause()
        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_unpause_timeout,
            check_interval=CONF.openstack.nova_server_unpause_poll_interval
github openstack / rally-openstack / rally_openstack / scenarios / manila / utils.py View on Github external
    @atomic.action_timer("manila.create_share")
    def _create_share(self, share_proto, size=1, **kwargs):
        """Create a share.

        :param share_proto: share protocol for new share,
            available values are NFS, CIFS, GlusterFS, HDFS and CEPHFS.
        :param size: size of a share in GB
        :param snapshot_id: ID of the snapshot
        :param name: name of new share
        :param description: description of a share
        :param metadata: optional metadata to set on share creation
        :param share_network: either instance of ShareNetwork or str with ID
        :param share_type: either instance of ShareType or str with ID
        :param is_public: defines whether to set share as public or not.
        :returns: instance of :class:`Share`
        """
        if self.context:
github openstack / rally / rally / plugins / openstack / scenarios / ceilometer / utils.py View on Github external
    @atomic.action_timer("ceilometer.get_resource")
    def _get_resource(self, resource_id):
        """Retrieve details about one resource."""
        return self.clients("ceilometer").resources.get(resource_id)
github openstack / rally-openstack / rally_openstack / services / loadbalancer / octavia.py View on Github external
    @atomic.action_timer("octavia.l7rule_list")
    def l7rule_list(self, l7policy_id, **kwargs):
        """List all l7rules for a l7policy

        :param kwargs:
            Parameters to filter on
        :return:
            List of l7policies
        """
        return self._clients.octavia().l7rule_list(l7policy_id, **kwargs)
github openstack / rally / rally / plugins / openstack / services / identity / keystone_v2.py View on Github external
    @atomic.action_timer("keystone_v2.revoke_role")
    def revoke_role(self, role_id, user_id, tenant_id):
        self._clients.keystone("2").roles.remove_user_role(user=user_id,
                                                           role=role_id,
                                                           tenant=tenant_id)
github openstack / rally / rally / plugins / openstack / scenarios / neutron / utils.py View on Github external
    @atomic.action_timer("neutron.update_healthmonitor")
    def _update_v1_healthmonitor(self, healthmonitor,
                                 **healthmonitor_update_args):
        """Update neutron healthmonitor.

        :param healthmonitor: neutron lb healthmonitor dict
        :param healthmonitor_update_args: POST /lb/healthmonitors
        update options
        :returns: updated neutron lb healthmonitor dict
        """
        body = {"health_monitor": healthmonitor_update_args}
        return self.clients("neutron").update_health_monitor(
            healthmonitor["health_monitor"]["id"], body)
github openstack / rally-openstack / rally_openstack / services / storage / cinder_v3.py View on Github external
    @atomic.action_timer("cinder_v3.list_types")
    def list_types(self, search_opts=None, is_public=None):
        """Lists all volume types."""
        return (self._get_client()
                .volume_types.list(search_opts=search_opts,
                                   is_public=is_public))
github openstack / rally / rally / plugins / openstack / scenarios / neutron / utils.py View on Github external
    @atomic.action_timer("neutron.delete_bgpvpn_router_assoc")
    def _delete_bgpvpn_router_assoc(self, bgpvpn, router_assoc):
        """Delete the specified BGP VPN router association

        :param bgpvpn: dict, bgpvpn
        :param router_assoc: dict, router
        :return dict: router_association
        """
        return self.clients("neutron").delete_bgpvpn_router_assoc(
            bgpvpn["bgpvpn"]["id"], router_assoc["router_association"]["id"])