Fix H404/405 violations for service clients
There is a lot of H404/405 violations in Tempest now, and that leads difficult to migrate the code to tempest-lib or the other projects' repos. This patch fixes these violations for service clients. Change-Id: Icf9f6fa4ea52a1fe72253391abf4880b1f8ed497
This commit is contained in:
parent
bf19dd1032
commit
b279084f73
@ -40,10 +40,7 @@ def handle_errors(f):
|
||||
|
||||
|
||||
class BaremetalClient(service_client.ServiceClient):
|
||||
"""
|
||||
Base Tempest REST client for Ironic API.
|
||||
|
||||
"""
|
||||
"""Base Tempest REST client for Ironic API."""
|
||||
|
||||
uri_prefix = ''
|
||||
|
||||
@ -58,8 +55,7 @@ class BaremetalClient(service_client.ServiceClient):
|
||||
return json.loads(object_str)
|
||||
|
||||
def _get_uri(self, resource_name, uuid=None, permanent=False):
|
||||
"""
|
||||
Get URI for a specific resource or object.
|
||||
"""Get URI for a specific resource or object.
|
||||
|
||||
:param resource_name: The name of the REST resource, e.g., 'nodes'.
|
||||
:param uuid: The unique identifier of an object in UUID format.
|
||||
@ -73,8 +69,7 @@ class BaremetalClient(service_client.ServiceClient):
|
||||
uuid='/%s' % uuid if uuid else '')
|
||||
|
||||
def _make_patch(self, allowed_attributes, **kw):
|
||||
"""
|
||||
Create a JSON patch according to RFC 6902.
|
||||
"""Create a JSON patch according to RFC 6902.
|
||||
|
||||
:param allowed_attributes: An iterable object that contains a set of
|
||||
allowed attributes for an object.
|
||||
@ -103,8 +98,7 @@ class BaremetalClient(service_client.ServiceClient):
|
||||
return patch
|
||||
|
||||
def _list_request(self, resource, permanent=False, **kwargs):
|
||||
"""
|
||||
Get the list of objects of the specified type.
|
||||
"""Get the list of objects of the specified type.
|
||||
|
||||
:param resource: The name of the REST resource, e.g., 'nodes'.
|
||||
"param **kw: Parameters for the request.
|
||||
@ -122,8 +116,7 @@ class BaremetalClient(service_client.ServiceClient):
|
||||
return resp, self.deserialize(body)
|
||||
|
||||
def _show_request(self, resource, uuid, permanent=False, **kwargs):
|
||||
"""
|
||||
Gets a specific object of the specified type.
|
||||
"""Gets a specific object of the specified type.
|
||||
|
||||
:param uuid: Unique identifier of the object in UUID format.
|
||||
:return: Serialized object as a dictionary.
|
||||
@ -139,8 +132,7 @@ class BaremetalClient(service_client.ServiceClient):
|
||||
return resp, self.deserialize(body)
|
||||
|
||||
def _create_request(self, resource, object_dict):
|
||||
"""
|
||||
Create an object of the specified type.
|
||||
"""Create an object of the specified type.
|
||||
|
||||
:param resource: The name of the REST resource, e.g., 'nodes'.
|
||||
:param object_dict: A Python dict that represents an object of the
|
||||
@ -158,8 +150,7 @@ class BaremetalClient(service_client.ServiceClient):
|
||||
return resp, self.deserialize(body)
|
||||
|
||||
def _delete_request(self, resource, uuid):
|
||||
"""
|
||||
Delete specified object.
|
||||
"""Delete specified object.
|
||||
|
||||
:param resource: The name of the REST resource, e.g., 'nodes'.
|
||||
:param uuid: The unique identifier of an object in UUID format.
|
||||
@ -173,8 +164,7 @@ class BaremetalClient(service_client.ServiceClient):
|
||||
return resp, body
|
||||
|
||||
def _patch_request(self, resource, uuid, patch_object):
|
||||
"""
|
||||
Update specified object with JSON-patch.
|
||||
"""Update specified object with JSON-patch.
|
||||
|
||||
:param resource: The name of the REST resource, e.g., 'nodes'.
|
||||
:param uuid: The unique identifier of an object in UUID format.
|
||||
@ -197,8 +187,7 @@ class BaremetalClient(service_client.ServiceClient):
|
||||
|
||||
@handle_errors
|
||||
def get_version_description(self, version='v1'):
|
||||
"""
|
||||
Retrieves the desctription of the API.
|
||||
"""Retrieves the desctription of the API.
|
||||
|
||||
:param version: The version of the API. Default: 'v1'.
|
||||
:return: Serialized description of API resources.
|
||||
@ -207,10 +196,7 @@ class BaremetalClient(service_client.ServiceClient):
|
||||
return self._list_request(version, permanent=True)
|
||||
|
||||
def _put_request(self, resource, put_object):
|
||||
"""
|
||||
Update specified object with JSON-patch.
|
||||
|
||||
"""
|
||||
"""Update specified object with JSON-patch."""
|
||||
uri = self._get_uri(resource)
|
||||
put_body = json.dumps(put_object)
|
||||
|
||||
|
@ -14,9 +14,7 @@ from tempest.services.baremetal import base
|
||||
|
||||
|
||||
class BaremetalClient(base.BaremetalClient):
|
||||
"""
|
||||
Base Tempest REST client for Ironic API v1.
|
||||
"""
|
||||
"""Base Tempest REST client for Ironic API v1."""
|
||||
version = '1'
|
||||
uri_prefix = 'v1'
|
||||
|
||||
@ -62,8 +60,7 @@ class BaremetalClient(base.BaremetalClient):
|
||||
|
||||
@base.handle_errors
|
||||
def show_node(self, uuid):
|
||||
"""
|
||||
Gets a specific node.
|
||||
"""Gets a specific node.
|
||||
|
||||
:param uuid: Unique identifier of the node in UUID format.
|
||||
:return: Serialized node as a dictionary.
|
||||
@ -73,8 +70,7 @@ class BaremetalClient(base.BaremetalClient):
|
||||
|
||||
@base.handle_errors
|
||||
def show_node_by_instance_uuid(self, instance_uuid):
|
||||
"""
|
||||
Gets a node associated with given instance uuid.
|
||||
"""Gets a node associated with given instance uuid.
|
||||
|
||||
:param uuid: Unique identifier of the node in UUID format.
|
||||
:return: Serialized node as a dictionary.
|
||||
@ -88,8 +84,7 @@ class BaremetalClient(base.BaremetalClient):
|
||||
|
||||
@base.handle_errors
|
||||
def show_chassis(self, uuid):
|
||||
"""
|
||||
Gets a specific chassis.
|
||||
"""Gets a specific chassis.
|
||||
|
||||
:param uuid: Unique identifier of the chassis in UUID format.
|
||||
:return: Serialized chassis as a dictionary.
|
||||
@ -99,8 +94,7 @@ class BaremetalClient(base.BaremetalClient):
|
||||
|
||||
@base.handle_errors
|
||||
def show_port(self, uuid):
|
||||
"""
|
||||
Gets a specific port.
|
||||
"""Gets a specific port.
|
||||
|
||||
:param uuid: Unique identifier of the port in UUID format.
|
||||
:return: Serialized port as a dictionary.
|
||||
@ -110,8 +104,7 @@ class BaremetalClient(base.BaremetalClient):
|
||||
|
||||
@base.handle_errors
|
||||
def show_port_by_address(self, address):
|
||||
"""
|
||||
Gets a specific port by address.
|
||||
"""Gets a specific port by address.
|
||||
|
||||
:param address: MAC address of the port.
|
||||
:return: Serialized port as a dictionary.
|
||||
@ -122,8 +115,7 @@ class BaremetalClient(base.BaremetalClient):
|
||||
return self._show_request('ports', uuid=None, uri=uri)
|
||||
|
||||
def show_driver(self, driver_name):
|
||||
"""
|
||||
Gets a specific driver.
|
||||
"""Gets a specific driver.
|
||||
|
||||
:param driver_name: Name of driver.
|
||||
:return: Serialized driver as a dictionary.
|
||||
@ -132,8 +124,7 @@ class BaremetalClient(base.BaremetalClient):
|
||||
|
||||
@base.handle_errors
|
||||
def create_node(self, chassis_id=None, **kwargs):
|
||||
"""
|
||||
Create a baremetal node with the specified parameters.
|
||||
"""Create a baremetal node with the specified parameters.
|
||||
|
||||
:param cpu_arch: CPU architecture of the node. Default: x86_64.
|
||||
:param cpus: Number of CPUs. Default: 8.
|
||||
@ -154,8 +145,7 @@ class BaremetalClient(base.BaremetalClient):
|
||||
|
||||
@base.handle_errors
|
||||
def create_chassis(self, **kwargs):
|
||||
"""
|
||||
Create a chassis with the specified parameters.
|
||||
"""Create a chassis with the specified parameters.
|
||||
|
||||
:param description: The description of the chassis.
|
||||
Default: test-chassis
|
||||
@ -168,8 +158,7 @@ class BaremetalClient(base.BaremetalClient):
|
||||
|
||||
@base.handle_errors
|
||||
def create_port(self, node_id, **kwargs):
|
||||
"""
|
||||
Create a port with the specified parameters.
|
||||
"""Create a port with the specified parameters.
|
||||
|
||||
:param node_id: The ID of the node which owns the port.
|
||||
:param address: MAC address of the port.
|
||||
@ -191,8 +180,7 @@ class BaremetalClient(base.BaremetalClient):
|
||||
|
||||
@base.handle_errors
|
||||
def delete_node(self, uuid):
|
||||
"""
|
||||
Deletes a node having the specified UUID.
|
||||
"""Deletes a node having the specified UUID.
|
||||
|
||||
:param uuid: The unique identifier of the node.
|
||||
:return: A tuple with the server response and the response body.
|
||||
@ -202,8 +190,7 @@ class BaremetalClient(base.BaremetalClient):
|
||||
|
||||
@base.handle_errors
|
||||
def delete_chassis(self, uuid):
|
||||
"""
|
||||
Deletes a chassis having the specified UUID.
|
||||
"""Deletes a chassis having the specified UUID.
|
||||
|
||||
:param uuid: The unique identifier of the chassis.
|
||||
:return: A tuple with the server response and the response body.
|
||||
@ -213,8 +200,7 @@ class BaremetalClient(base.BaremetalClient):
|
||||
|
||||
@base.handle_errors
|
||||
def delete_port(self, uuid):
|
||||
"""
|
||||
Deletes a port having the specified UUID.
|
||||
"""Deletes a port having the specified UUID.
|
||||
|
||||
:param uuid: The unique identifier of the port.
|
||||
:return: A tuple with the server response and the response body.
|
||||
@ -224,8 +210,7 @@ class BaremetalClient(base.BaremetalClient):
|
||||
|
||||
@base.handle_errors
|
||||
def update_node(self, uuid, **kwargs):
|
||||
"""
|
||||
Update the specified node.
|
||||
"""Update the specified node.
|
||||
|
||||
:param uuid: The unique identifier of the node.
|
||||
:return: A tuple with the server response and the updated node.
|
||||
@ -244,8 +229,7 @@ class BaremetalClient(base.BaremetalClient):
|
||||
|
||||
@base.handle_errors
|
||||
def update_chassis(self, uuid, **kwargs):
|
||||
"""
|
||||
Update the specified chassis.
|
||||
"""Update the specified chassis.
|
||||
|
||||
:param uuid: The unique identifier of the chassis.
|
||||
:return: A tuple with the server response and the updated chassis.
|
||||
@ -258,8 +242,7 @@ class BaremetalClient(base.BaremetalClient):
|
||||
|
||||
@base.handle_errors
|
||||
def update_port(self, uuid, patch):
|
||||
"""
|
||||
Update the specified port.
|
||||
"""Update the specified port.
|
||||
|
||||
:param uuid: The unique identifier of the port.
|
||||
:param patch: List of dicts representing json patches.
|
||||
@ -271,8 +254,7 @@ class BaremetalClient(base.BaremetalClient):
|
||||
|
||||
@base.handle_errors
|
||||
def set_node_power_state(self, node_uuid, state):
|
||||
"""
|
||||
Set power state of the specified node.
|
||||
"""Set power state of the specified node.
|
||||
|
||||
:param node_uuid: The unique identifier of the node.
|
||||
:state: desired state to set (on/off/reboot).
|
||||
@ -284,8 +266,7 @@ class BaremetalClient(base.BaremetalClient):
|
||||
|
||||
@base.handle_errors
|
||||
def validate_driver_interface(self, node_uuid):
|
||||
"""
|
||||
Get all driver interfaces of a specific node.
|
||||
"""Get all driver interfaces of a specific node.
|
||||
|
||||
:param uuid: Unique identifier of the node in UUID format.
|
||||
|
||||
@ -300,8 +281,7 @@ class BaremetalClient(base.BaremetalClient):
|
||||
|
||||
@base.handle_errors
|
||||
def set_node_boot_device(self, node_uuid, boot_device, persistent=False):
|
||||
"""
|
||||
Set the boot device of the specified node.
|
||||
"""Set the boot device of the specified node.
|
||||
|
||||
:param node_uuid: The unique identifier of the node.
|
||||
:param boot_device: The boot device name.
|
||||
@ -318,8 +298,7 @@ class BaremetalClient(base.BaremetalClient):
|
||||
|
||||
@base.handle_errors
|
||||
def get_node_boot_device(self, node_uuid):
|
||||
"""
|
||||
Get the current boot device of the specified node.
|
||||
"""Get the current boot device of the specified node.
|
||||
|
||||
:param node_uuid: The unique identifier of the node.
|
||||
|
||||
@ -331,8 +310,7 @@ class BaremetalClient(base.BaremetalClient):
|
||||
|
||||
@base.handle_errors
|
||||
def get_node_supported_boot_devices(self, node_uuid):
|
||||
"""
|
||||
Get the supported boot devices of the specified node.
|
||||
"""Get the supported boot devices of the specified node.
|
||||
|
||||
:param node_uuid: The unique identifier of the node.
|
||||
|
||||
@ -344,8 +322,7 @@ class BaremetalClient(base.BaremetalClient):
|
||||
|
||||
@base.handle_errors
|
||||
def get_console(self, node_uuid):
|
||||
"""
|
||||
Get connection information about the console.
|
||||
"""Get connection information about the console.
|
||||
|
||||
:param node_uuid: Unique identifier of the node in UUID format.
|
||||
|
||||
@ -357,8 +334,7 @@ class BaremetalClient(base.BaremetalClient):
|
||||
|
||||
@base.handle_errors
|
||||
def set_console_mode(self, node_uuid, enabled):
|
||||
"""
|
||||
Start and stop the node console.
|
||||
"""Start and stop the node console.
|
||||
|
||||
:param node_uuid: Unique identifier of the node in UUID format.
|
||||
:param enabled: Boolean value; whether to enable or disable the
|
||||
|
@ -88,8 +88,8 @@ class BotoClientBase(object):
|
||||
return self.connect_method(**self.connection_data)
|
||||
|
||||
def get_aws_credentials(self, identity_client):
|
||||
"""
|
||||
Obtain existing, or create new AWS credentials
|
||||
"""Obtain existing, or create new AWS credentials
|
||||
|
||||
:param identity_client: identity client with embedded credentials
|
||||
:return: EC2 credentials
|
||||
"""
|
||||
|
@ -160,8 +160,8 @@ class ServersClient(service_client.ServiceClient):
|
||||
return service_client.ResponseBody(resp, body)
|
||||
|
||||
def delete_password(self, server_id):
|
||||
"""
|
||||
Removes the encrypted server password from the metadata server
|
||||
"""Removes the encrypted server password from the metadata server
|
||||
|
||||
Note that this does not actually change the instance server
|
||||
password.
|
||||
"""
|
||||
@ -177,6 +177,7 @@ class ServersClient(service_client.ServiceClient):
|
||||
|
||||
def rebuild_server(self, server_id, image_ref, **kwargs):
|
||||
"""Rebuilds a server with a new image.
|
||||
|
||||
Most parameters except the following are passed to the API without
|
||||
any changes.
|
||||
:param disk_config: The name is changed to OS-DCF:diskConfig
|
||||
@ -193,6 +194,7 @@ class ServersClient(service_client.ServiceClient):
|
||||
|
||||
def resize_server(self, server_id, flavor_ref, **kwargs):
|
||||
"""Changes the flavor of a server.
|
||||
|
||||
Most parameters except the following are passed to the API without
|
||||
any changes.
|
||||
:param disk_config: The name is changed to OS-DCF:diskConfig
|
||||
@ -368,9 +370,7 @@ class ServersClient(service_client.ServiceClient):
|
||||
**kwargs)
|
||||
|
||||
def list_virtual_interfaces(self, server_id):
|
||||
"""
|
||||
List the virtual interfaces used in an instance.
|
||||
"""
|
||||
"""List the virtual interfaces used in an instance."""
|
||||
resp, body = self.get('/'.join(['servers', server_id,
|
||||
'os-virtual-interfaces']))
|
||||
body = json.loads(body)
|
||||
|
@ -20,8 +20,7 @@ from tempest.common import service_client
|
||||
class DataProcessingClient(service_client.ServiceClient):
|
||||
|
||||
def _request_and_check_resp(self, request_func, uri, resp_status):
|
||||
"""Make a request using specified request_func and check response
|
||||
status code.
|
||||
"""Make a request and check response status code.
|
||||
|
||||
It returns a ResponseBody.
|
||||
"""
|
||||
@ -30,8 +29,7 @@ class DataProcessingClient(service_client.ServiceClient):
|
||||
return service_client.ResponseBody(resp, body)
|
||||
|
||||
def _request_and_check_resp_data(self, request_func, uri, resp_status):
|
||||
"""Make a request using specified request_func and check response
|
||||
status code.
|
||||
"""Make a request and check response status code.
|
||||
|
||||
It returns pair: resp and response data.
|
||||
"""
|
||||
@ -41,8 +39,7 @@ class DataProcessingClient(service_client.ServiceClient):
|
||||
|
||||
def _request_check_and_parse_resp(self, request_func, uri,
|
||||
resp_status, *args, **kwargs):
|
||||
"""Make a request using specified request_func, check response status
|
||||
code and parse response body.
|
||||
"""Make a request, check response status code and parse response body.
|
||||
|
||||
It returns a ResponseBody.
|
||||
"""
|
||||
|
@ -46,8 +46,8 @@ class IdentityClient(service_client.ServiceClient):
|
||||
return service_client.ResponseBody(resp, body)
|
||||
|
||||
def create_tenant(self, name, **kwargs):
|
||||
"""
|
||||
Create a tenant
|
||||
"""Create a tenant
|
||||
|
||||
name (required): New tenant name
|
||||
description: Description of new tenant (default is none)
|
||||
enabled <true|false>: Initial tenant status (default is true)
|
||||
|
@ -18,9 +18,10 @@ from tempest.common import service_client
|
||||
|
||||
class BaseNetworkClient(service_client.ServiceClient):
|
||||
|
||||
"""
|
||||
Base class for Tempest REST clients for Neutron. Child classes use v2 of
|
||||
the Neutron API, since the V1 API has been removed from the code base.
|
||||
"""Base class for Tempest REST clients for Neutron.
|
||||
|
||||
Child classes use v2 of the Neutron API, since the V1 API has been
|
||||
removed from the code base.
|
||||
"""
|
||||
|
||||
version = '2.0'
|
||||
|
@ -21,9 +21,10 @@ from tempest.services.network.json import base
|
||||
|
||||
class NetworkClient(base.BaseNetworkClient):
|
||||
|
||||
"""
|
||||
Tempest REST client for Neutron. Uses v2 of the Neutron API, since the
|
||||
V1 API has been removed from the code base.
|
||||
"""Tempest REST client for Neutron.
|
||||
|
||||
Uses v2 of the Neutron API, since the V1 API has been removed from the
|
||||
code base.
|
||||
|
||||
Implements create, delete, update, list and show for the basic Neutron
|
||||
abstractions (networks, sub-networks, routers, ports and floating IP):
|
||||
@ -177,8 +178,8 @@ class NetworkClient(base.BaseNetworkClient):
|
||||
|
||||
def wait_for_resource_status(self, fetch, status, interval=None,
|
||||
timeout=None):
|
||||
"""
|
||||
@summary: Waits for a network resource to reach a status
|
||||
"""Waits for a network resource to reach a status
|
||||
|
||||
@param fetch: the callable to be used to query the resource status
|
||||
@type fecth: callable that takes no parameters and returns the resource
|
||||
@param status: the status that the resource has to reach
|
||||
@ -313,7 +314,8 @@ class NetworkClient(base.BaseNetworkClient):
|
||||
return self.list_resources(uri)
|
||||
|
||||
def update_agent(self, agent_id, agent_info):
|
||||
"""
|
||||
"""Update agent
|
||||
|
||||
:param agent_info: Agent update information.
|
||||
E.g {"admin_state_up": True}
|
||||
"""
|
||||
|
@ -19,10 +19,7 @@ import six
|
||||
|
||||
|
||||
class AttributeDict(dict):
|
||||
|
||||
"""
|
||||
Provide attribute access (dict.key) to dictionary values.
|
||||
"""
|
||||
"""Provide attribute access (dict.key) to dictionary values."""
|
||||
|
||||
def __getattr__(self, name):
|
||||
"""Allow attribute access for all keys in the dict."""
|
||||
@ -33,10 +30,9 @@ class AttributeDict(dict):
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class DeletableResource(AttributeDict):
|
||||
"""Support deletion of neutron resources (networks, subnets)
|
||||
|
||||
"""
|
||||
Support deletion of neutron resources (networks, subnets) via a
|
||||
delete() method, as is supported by keystone and nova resources.
|
||||
via a delete() method, as is supported by keystone and nova resources.
|
||||
"""
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
@ -59,8 +59,8 @@ class AccountClient(service_client.ServiceClient):
|
||||
return resp, body
|
||||
|
||||
def list_account_metadata(self):
|
||||
"""
|
||||
HEAD on the storage URL
|
||||
"""HEAD on the storage URL
|
||||
|
||||
Returns all account metadata headers
|
||||
"""
|
||||
resp, body = self.head('')
|
||||
@ -86,9 +86,7 @@ class AccountClient(service_client.ServiceClient):
|
||||
|
||||
def delete_account_metadata(self, metadata,
|
||||
metadata_prefix='X-Remove-Account-Meta-'):
|
||||
"""
|
||||
Deletes an account metadata entry.
|
||||
"""
|
||||
"""Deletes an account metadata entry."""
|
||||
|
||||
headers = {}
|
||||
for item in metadata:
|
||||
@ -103,9 +101,7 @@ class AccountClient(service_client.ServiceClient):
|
||||
delete_metadata=None,
|
||||
create_metadata_prefix='X-Account-Meta-',
|
||||
delete_metadata_prefix='X-Remove-Account-Meta-'):
|
||||
"""
|
||||
Creates and deletes an account metadata entry.
|
||||
"""
|
||||
"""Creates and deletes an account metadata entry."""
|
||||
headers = {}
|
||||
for key in create_metadata:
|
||||
headers[create_metadata_prefix + key] = create_metadata[key]
|
||||
@ -117,8 +113,8 @@ class AccountClient(service_client.ServiceClient):
|
||||
return resp, body
|
||||
|
||||
def list_account_containers(self, params=None):
|
||||
"""
|
||||
GET on the (base) storage URL
|
||||
"""GET on the (base) storage URL
|
||||
|
||||
Given valid X-Auth-Token, returns a list of all containers for the
|
||||
account.
|
||||
|
||||
|
@ -29,9 +29,9 @@ class ContainerClient(service_client.ServiceClient):
|
||||
remove_metadata=None,
|
||||
metadata_prefix='X-Container-Meta-',
|
||||
remove_metadata_prefix='X-Remove-Container-Meta-'):
|
||||
"""
|
||||
Creates a container, with optional metadata passed in as a
|
||||
dictionary
|
||||
"""Creates a container
|
||||
|
||||
with optional metadata passed in as a dictionary
|
||||
"""
|
||||
url = str(container_name)
|
||||
headers = {}
|
||||
@ -90,18 +90,16 @@ class ContainerClient(service_client.ServiceClient):
|
||||
return resp, body
|
||||
|
||||
def list_container_metadata(self, container_name):
|
||||
"""
|
||||
Retrieves container metadata headers
|
||||
"""
|
||||
"""Retrieves container metadata headers"""
|
||||
url = str(container_name)
|
||||
resp, body = self.head(url)
|
||||
self.expected_success(204, resp.status)
|
||||
return resp, body
|
||||
|
||||
def list_all_container_objects(self, container, params=None):
|
||||
"""
|
||||
Returns complete list of all objects in the container, even if
|
||||
item count is beyond 10,000 item listing limit.
|
||||
"""Returns complete list of all objects in the container
|
||||
|
||||
even if item count is beyond 10,000 item listing limit.
|
||||
Does not require any parameters aside from container name.
|
||||
"""
|
||||
# TODO(dwalleck): Rewrite using json format to avoid newlines at end of
|
||||
@ -121,8 +119,7 @@ class ContainerClient(service_client.ServiceClient):
|
||||
return objlist
|
||||
|
||||
def list_container_contents(self, container, params=None):
|
||||
"""
|
||||
List the objects in a container, given the container name
|
||||
"""List the objects in a container, given the container name
|
||||
|
||||
Returns the container object listing as a plain text list, or as
|
||||
xml or json if that option is specified via the 'format' argument.
|
||||
|
@ -149,9 +149,7 @@ class ObjectClient(service_client.ServiceClient):
|
||||
return resp, body
|
||||
|
||||
def put_object_with_chunk(self, container, name, contents, chunk_size):
|
||||
"""
|
||||
Put an object with Transfer-Encoding header
|
||||
"""
|
||||
"""Put an object with Transfer-Encoding header"""
|
||||
if self.base_url is None:
|
||||
self._set_auth()
|
||||
|
||||
@ -204,8 +202,8 @@ class ObjectClient(service_client.ServiceClient):
|
||||
|
||||
def put_object_connection(base_url, container, name, contents=None,
|
||||
chunk_size=65536, headers=None, query_string=None):
|
||||
"""
|
||||
Helper function to make connection to put object with httplib
|
||||
"""Helper function to make connection to put object with httplib
|
||||
|
||||
:param base_url: base_url of an object client
|
||||
:param container: container name that the object is in
|
||||
:param name: object name to put
|
||||
|
@ -20,9 +20,7 @@ from tempest.common import service_client
|
||||
|
||||
|
||||
class BaseVolumeHostsClient(service_client.ServiceClient):
|
||||
"""
|
||||
Client class to send CRUD Volume Hosts API requests to a Cinder endpoint
|
||||
"""
|
||||
"""Client class to send CRUD Volume Hosts API requests"""
|
||||
|
||||
def list_hosts(self, params=None):
|
||||
"""Lists all hosts."""
|
||||
@ -38,6 +36,4 @@ class BaseVolumeHostsClient(service_client.ServiceClient):
|
||||
|
||||
|
||||
class VolumeHostsClient(BaseVolumeHostsClient):
|
||||
"""
|
||||
Client class to send CRUD Volume Host API V1 requests to a Cinder endpoint
|
||||
"""
|
||||
"""Client class to send CRUD Volume Host API V1 requests"""
|
||||
|
@ -19,9 +19,7 @@ from tempest.common import service_client
|
||||
|
||||
|
||||
class BaseVolumeQuotasClient(service_client.ServiceClient):
|
||||
"""
|
||||
Client class to send CRUD Volume Quotas API requests to a Cinder endpoint
|
||||
"""
|
||||
"""Client class to send CRUD Volume Quotas API requests"""
|
||||
|
||||
TYPE = "json"
|
||||
|
||||
@ -79,6 +77,4 @@ class BaseVolumeQuotasClient(service_client.ServiceClient):
|
||||
|
||||
|
||||
class VolumeQuotasClient(BaseVolumeQuotasClient):
|
||||
"""
|
||||
Client class to send CRUD Volume Type API V1 requests to a Cinder endpoint
|
||||
"""
|
||||
"""Client class to send CRUD Volume Type API V1 requests"""
|
||||
|
@ -21,9 +21,7 @@ from tempest.common import service_client
|
||||
|
||||
|
||||
class BaseVolumeTypesClient(service_client.ServiceClient):
|
||||
"""
|
||||
Client class to send CRUD Volume Types API requests to a Cinder endpoint
|
||||
"""
|
||||
"""Client class to send CRUD Volume Types API requests"""
|
||||
|
||||
def is_resource_deleted(self, resource):
|
||||
# to use this method self.resource must be defined to respective value
|
||||
@ -69,8 +67,8 @@ class BaseVolumeTypesClient(service_client.ServiceClient):
|
||||
return service_client.ResponseBody(resp, body)
|
||||
|
||||
def create_volume_type(self, name, **kwargs):
|
||||
"""
|
||||
Creates a new Volume_type.
|
||||
"""Creates a new Volume_type.
|
||||
|
||||
name(Required): Name of volume_type.
|
||||
Following optional keyword arguments are accepted:
|
||||
extra_specs: A dictionary of values to be used as extra_specs.
|
||||
@ -113,8 +111,8 @@ class BaseVolumeTypesClient(service_client.ServiceClient):
|
||||
return service_client.ResponseBody(resp, body)
|
||||
|
||||
def create_volume_type_extra_specs(self, vol_type_id, extra_spec):
|
||||
"""
|
||||
Creates a new Volume_type extra spec.
|
||||
"""Creates a new Volume_type extra spec.
|
||||
|
||||
vol_type_id: Id of volume_type.
|
||||
extra_specs: A dictionary of values to be used as extra_specs.
|
||||
"""
|
||||
@ -134,8 +132,8 @@ class BaseVolumeTypesClient(service_client.ServiceClient):
|
||||
|
||||
def update_volume_type_extra_specs(self, vol_type_id, extra_spec_name,
|
||||
extra_spec):
|
||||
"""
|
||||
Update a volume_type extra spec.
|
||||
"""Update a volume_type extra spec.
|
||||
|
||||
vol_type_id: Id of volume_type.
|
||||
extra_spec_name: Name of the extra spec to be updated.
|
||||
extra_spec: A dictionary of with key as extra_spec_name and the
|
||||
@ -150,8 +148,8 @@ class BaseVolumeTypesClient(service_client.ServiceClient):
|
||||
return service_client.ResponseBody(resp, body)
|
||||
|
||||
def show_encryption_type(self, vol_type_id):
|
||||
"""
|
||||
Get the volume encryption type for the specified volume type.
|
||||
"""Get the volume encryption type for the specified volume type.
|
||||
|
||||
vol_type_id: Id of volume_type.
|
||||
"""
|
||||
url = "/types/%s/encryption" % str(vol_type_id)
|
||||
@ -161,8 +159,7 @@ class BaseVolumeTypesClient(service_client.ServiceClient):
|
||||
return service_client.ResponseBody(resp, body)
|
||||
|
||||
def create_encryption_type(self, vol_type_id, **kwargs):
|
||||
"""
|
||||
Create a new encryption type for the specified volume type.
|
||||
"""Create a new encryption type for the specified volume type.
|
||||
|
||||
vol_type_id: Id of volume_type.
|
||||
provider: Class providing encryption support.
|
||||
|
@ -28,6 +28,4 @@ class BaseVolumeAvailabilityZoneClient(service_client.ServiceClient):
|
||||
|
||||
|
||||
class VolumeAvailabilityZoneClient(BaseVolumeAvailabilityZoneClient):
|
||||
"""
|
||||
Volume V1 availability zone client.
|
||||
"""
|
||||
"""Volume V1 availability zone client."""
|
||||
|
@ -24,9 +24,7 @@ from tempest import exceptions
|
||||
|
||||
|
||||
class BaseBackupsClient(service_client.ServiceClient):
|
||||
"""
|
||||
Client class to send CRUD Volume backup API requests to a Cinder endpoint
|
||||
"""
|
||||
"""Client class to send CRUD Volume backup API requests"""
|
||||
|
||||
def create_backup(self, volume_id, container=None, name=None,
|
||||
description=None):
|
||||
|
@ -29,6 +29,4 @@ class BaseExtensionsClient(service_client.ServiceClient):
|
||||
|
||||
|
||||
class ExtensionsClient(BaseExtensionsClient):
|
||||
"""
|
||||
Volume V1 extensions client.
|
||||
"""
|
||||
"""Volume V1 extensions client."""
|
||||
|
@ -51,8 +51,8 @@ class BaseSnapshotsClient(service_client.ServiceClient):
|
||||
return service_client.ResponseBody(resp, body)
|
||||
|
||||
def create_snapshot(self, volume_id, **kwargs):
|
||||
"""
|
||||
Creates a new snapshot.
|
||||
"""Creates a new snapshot.
|
||||
|
||||
volume_id(Required): id of the volume.
|
||||
force: Create a snapshot even if the volume attached (Default=False)
|
||||
display_name: Optional snapshot Name.
|
||||
|
@ -23,9 +23,7 @@ from tempest.common import waiters
|
||||
|
||||
|
||||
class BaseVolumesClient(service_client.ServiceClient):
|
||||
"""
|
||||
Base client class to send CRUD Volume API requests to a Cinder endpoint
|
||||
"""
|
||||
"""Base client class to send CRUD Volume API requests"""
|
||||
|
||||
create_resp = 200
|
||||
|
||||
@ -74,8 +72,8 @@ class BaseVolumesClient(service_client.ServiceClient):
|
||||
return service_client.ResponseBody(resp, body)
|
||||
|
||||
def create_volume(self, size=None, **kwargs):
|
||||
"""
|
||||
Creates a new Volume.
|
||||
"""Creates a new Volume.
|
||||
|
||||
size: Size of volume in GB.
|
||||
Following optional keyword arguments are accepted:
|
||||
display_name: Optional Volume Name(only for V1).
|
||||
@ -339,6 +337,4 @@ class BaseVolumesClient(service_client.ServiceClient):
|
||||
|
||||
|
||||
class VolumesClient(BaseVolumesClient):
|
||||
"""
|
||||
Client class to send CRUD Volume V1 API requests to a Cinder endpoint
|
||||
"""
|
||||
"""Client class to send CRUD Volume V1 API requests"""
|
||||
|
@ -18,7 +18,5 @@ from tempest.services.volume.json.admin import volume_hosts_client
|
||||
|
||||
|
||||
class VolumeHostsV2Client(volume_hosts_client.BaseVolumeHostsClient):
|
||||
"""
|
||||
Client class to send CRUD Volume V2 API requests to a Cinder endpoint
|
||||
"""
|
||||
"""Client class to send CRUD Volume V2 API requests"""
|
||||
api_version = "v2"
|
||||
|
@ -17,7 +17,5 @@ from tempest.services.volume.json.admin import volume_quotas_client
|
||||
|
||||
|
||||
class VolumeQuotasV2Client(volume_quotas_client.BaseVolumeQuotasClient):
|
||||
"""
|
||||
Client class to send CRUD Volume V2 API requests to a Cinder endpoint
|
||||
"""
|
||||
"""Client class to send CRUD Volume V2 API requests"""
|
||||
api_version = "v2"
|
||||
|
@ -17,7 +17,5 @@ from tempest.services.volume.json.admin import volume_services_client as vs_cli
|
||||
|
||||
|
||||
class VolumesServicesV2Client(vs_cli.BaseVolumesServicesClient):
|
||||
"""
|
||||
Client class to send CRUD Volume V2 API requests to a Cinder endpoint
|
||||
"""
|
||||
"""Client class to send CRUD Volume V2 API requests"""
|
||||
api_version = "v2"
|
||||
|
@ -18,7 +18,5 @@ from tempest.services.volume.json.admin import volume_types_client
|
||||
|
||||
|
||||
class VolumeTypesV2Client(volume_types_client.BaseVolumeTypesClient):
|
||||
"""
|
||||
Client class to send CRUD Volume V2 API requests to a Cinder endpoint
|
||||
"""
|
||||
"""Client class to send CRUD Volume V2 API requests"""
|
||||
api_version = "v2"
|
||||
|
@ -17,7 +17,5 @@ from tempest.services.volume.json import backups_client
|
||||
|
||||
|
||||
class BackupsClientV2(backups_client.BaseBackupsClient):
|
||||
"""
|
||||
Client class to send CRUD Volume V2 API requests to a Cinder endpoint
|
||||
"""
|
||||
"""Client class to send CRUD Volume V2 API requests"""
|
||||
api_version = "v2"
|
||||
|
@ -17,8 +17,6 @@ from tempest.services.volume.json import volumes_client
|
||||
|
||||
|
||||
class VolumesV2Client(volumes_client.BaseVolumesClient):
|
||||
"""
|
||||
Client class to send CRUD Volume V2 API requests to a Cinder endpoint
|
||||
"""
|
||||
"""Client class to send CRUD Volume V2 API requests"""
|
||||
api_version = "v2"
|
||||
create_resp = 202
|
||||
|
Loading…
Reference in New Issue
Block a user