diff options
author | hgangwx@cn.ibm.com <hgangwx@cn.ibm.com> | 2015-12-09 21:23:56 +0800 |
---|---|---|
committer | kairat_kushaev <kkushaev@mirantis.com> | 2016-01-28 13:35:39 +0300 |
commit | df24e6d7ee0d4a49ecc96d5e905f2fdc21d8e9de (patch) | |
tree | 117b9619a09a084c9313181909192bcd14cad326 | |
parent | 82c8e777b47633dc86d013d626e95486a50e0386 (diff) | |
download | glance_store-df24e6d7ee0d4a49ecc96d5e905f2fdc21d8e9de.tar.gz |
Fix some inconsistency in docstrings
add colon after ":param", ":returns" and ":raises" for all such occurrences
add ":param" before some parameter description
Co-Authored-By: kairat_kushaev <kkushaev@mirantis.com>
Change-Id: I4220e2a811793cd895333f132837c7e7ecedb62b
-rw-r--r-- | glance_store/_drivers/cinder.py | 4 | ||||
-rw-r--r-- | glance_store/_drivers/filesystem.py | 38 | ||||
-rw-r--r-- | glance_store/_drivers/http.py | 4 | ||||
-rw-r--r-- | glance_store/_drivers/rbd.py | 26 | ||||
-rw-r--r-- | glance_store/_drivers/s3.py | 18 | ||||
-rw-r--r-- | glance_store/_drivers/sheepdog.py | 18 | ||||
-rw-r--r-- | glance_store/_drivers/vmware_datastore.py | 6 | ||||
-rw-r--r-- | glance_store/driver.py | 24 |
8 files changed, 69 insertions, 69 deletions
diff --git a/glance_store/_drivers/cinder.py b/glance_store/_drivers/cinder.py index dceb512..bac8ccd 100644 --- a/glance_store/_drivers/cinder.py +++ b/glance_store/_drivers/cinder.py @@ -164,9 +164,9 @@ class Store(glance_store.driver.Store): Takes a `glance_store.location.Location` object that indicates where to find the image file and returns the image size - :param location `glance_store.location.Location` object, supplied + :param location: `glance_store.location.Location` object, supplied from glance_store.location.get_location_from_uri() - :raises `glance_store.exceptions.NotFound` if image does not exist + :raises: `glance_store.exceptions.NotFound` if image does not exist :rtype int """ diff --git a/glance_store/_drivers/filesystem.py b/glance_store/_drivers/filesystem.py index 80a7a55..aad30f9 100644 --- a/glance_store/_drivers/filesystem.py +++ b/glance_store/_drivers/filesystem.py @@ -177,7 +177,7 @@ class Store(glance_store.driver.Store): write permission. :datadir is a directory path in which glance wites image files. - :raise BadStoreConfiguration exception if datadir is read-only. + :raises: BadStoreConfiguration exception if datadir is read-only. """ if not os.access(datadir, os.W_OK): msg = (_("Permission to write in %s denied") % datadir) @@ -220,7 +220,7 @@ class Store(glance_store.driver.Store): it does not exist. :directory_paths is a list of directories belonging to glance store. - :raise BadStoreConfiguration exception if creating a directory fails. + :raises: BadStoreConfiguration exception if creating a directory fails. """ for datadir in directory_paths: if os.path.exists(datadir): @@ -362,7 +362,7 @@ class Store(glance_store.driver.Store): :datadir_path is directory path. :datadir_paths is set of all directory paths. - :raise BadStoreConfiguration exception if same directory path is + :raises: BadStoreConfiguration exception if same directory path is already present in directory_paths. """ if datadir_path in directory_paths: @@ -385,10 +385,10 @@ class Store(glance_store.driver.Store): Gets directory paths and its priority from filesystem_store_datadirs option in glance-api.conf. - :datadir is directory path with its priority. - :returns datadir_path as directory path + :param datadir: is directory path with its priority. + :returns: datadir_path as directory path priority as priority associated with datadir_path - :raise BadStoreConfiguration exception if priority is invalid or + :raises: BadStoreConfiguration exception if priority is invalid or empty directory path is specified. """ priority = 0 @@ -464,9 +464,9 @@ class Store(glance_store.driver.Store): where to find the image file, and returns a tuple of generator (for reading the image file) and image_size - :param location `glance_store.location.Location` object, supplied + :param location: `glance_store.location.Location` object, supplied from glance_store.location.get_location_from_uri() - :raises `glance_store.exceptions.NotFound` if image does not exist + :raises: `glance_store.exceptions.NotFound` if image does not exist """ filepath, filesize = self._resolve_location(location) msg = _("Found image at %s. Returning in ChunkedFile.") % filepath @@ -482,9 +482,9 @@ class Store(glance_store.driver.Store): Takes a `glance_store.location.Location` object that indicates where to find the image file and returns the image size - :param location `glance_store.location.Location` object, supplied + :param location: `glance_store.location.Location` object, supplied from glance_store.location.get_location_from_uri() - :raises `glance_store.exceptions.NotFound` if image does not exist + :raises: `glance_store.exceptions.NotFound` if image does not exist :rtype int """ filepath, filesize = self._resolve_location(location) @@ -498,11 +498,11 @@ class Store(glance_store.driver.Store): Takes a `glance_store.location.Location` object that indicates where to find the image file to delete - :location `glance_store.location.Location` object, supplied + :param location: `glance_store.location.Location` object, supplied from glance_store.location.get_location_from_uri() - :raises NotFound if image does not exist - :raises Forbidden if cannot delete because of permissions + :raises: NotFound if image does not exist + :raises: Forbidden if cannot delete because of permissions """ loc = location.store_location fn = loc.path @@ -534,9 +534,9 @@ class Store(glance_store.driver.Store): free space, in priority order. If two suitable directories have the same priority, choose the one with the most free space available. - :image_size size of image being uploaded. - :returns best_datadir as directory path of the best priority datadir. - :raises exceptions.StorageFull if there is no datadir in + :param image_size: size of image being uploaded. + :returns: best_datadir as directory path of the best priority datadir. + :raises: exceptions.StorageFull if there is no datadir in self.priority_data_map that can accommodate the image. """ if not self.multiple_datadirs: @@ -577,12 +577,12 @@ class Store(glance_store.driver.Store): :param image_size: The size of the image data to write, in bytes :param verifier: An object used to verify signatures for images - :retval tuple of URL in backing store, bytes written, checksum + :retval: tuple of URL in backing store, bytes written, checksum and a dictionary with storage system specific information - :raises `glance_store.exceptions.Duplicate` if the image already + :raises: `glance_store.exceptions.Duplicate` if the image already existed - :note By default, the backend writes the image data to a file + :note:: By default, the backend writes the image data to a file `/<DATADIR>/<ID>`, where <DATADIR> is the value of the filesystem_store_datadir configuration option and <ID> is the supplied image ID. diff --git a/glance_store/_drivers/http.py b/glance_store/_drivers/http.py index 66b1686..6aab258 100644 --- a/glance_store/_drivers/http.py +++ b/glance_store/_drivers/http.py @@ -133,7 +133,7 @@ class Store(glance_store.driver.Store): where to find the image file, and returns a tuple of generator (for reading the image file) and image_size - :param location `glance_store.location.Location` object, supplied + :param location: `glance_store.location.Location` object, supplied from glance_store.location.get_location_from_uri() """ try: @@ -163,7 +163,7 @@ class Store(glance_store.driver.Store): Takes a `glance_store.location.Location` object that indicates where to find the image file, and returns the size - :param location `glance_store.location.Location` object, supplied + :param location: `glance_store.location.Location` object, supplied from glance_store.location.get_location_from_uri() """ try: diff --git a/glance_store/_drivers/rbd.py b/glance_store/_drivers/rbd.py index 2626d2e..78852bf 100644 --- a/glance_store/_drivers/rbd.py +++ b/glance_store/_drivers/rbd.py @@ -240,9 +240,9 @@ class Store(driver.Store): where to find the image file, and returns a tuple of generator (for reading the image file) and image_size - :param location `glance_store.location.Location` object, supplied + :param location: `glance_store.location.Location` object, supplied from glance_store.location.get_location_from_uri() - :raises `glance_store.exceptions.NotFound` if image does not exist + :raises: `glance_store.exceptions.NotFound` if image does not exist """ loc = location.store_location return (ImageIterator(loc.pool, loc.image, loc.snapshot, self), @@ -253,9 +253,9 @@ class Store(driver.Store): Takes a `glance_store.location.Location` object that indicates where to find the image file, and returns the size - :param location `glance_store.location.Location` object, supplied + :param location: `glance_store.location.Location` object, supplied from glance_store.location.get_location_from_uri() - :raises `glance_store.exceptions.NotFound` if image does not exist + :raises: `glance_store.exceptions.NotFound` if image does not exist """ loc = location.store_location # if there is a pool specific in the location, use it; otherwise @@ -281,9 +281,9 @@ class Store(driver.Store): make it a cloneable snapshot, so that copy-on-write volumes can be created from it. - :param image_name Image's name + :param image_name: Image's name - :retval `glance_store.rbd.StoreLocation` object + :retval: `glance_store.rbd.StoreLocation` object """ librbd = rbd.RBD() features = conn.conf_get('rbd_default_features') @@ -303,10 +303,10 @@ class Store(driver.Store): """ Delete RBD image and snapshot. - :param image_name Image's name - :param snapshot_name Image snapshot's name + :param image_name: Image's name + :param snapshot_name: Image snapshot's name - :raises NotFound if image does not exist; + :raises: NotFound if image does not exist; InUseByStore if image is in use or snapshot unprotect failed """ with self.get_connection(conffile=self.conf_file, @@ -364,9 +364,9 @@ class Store(driver.Store): :param image_size: The size of the image data to write, in bytes :param verifier: An object used to verify signatures for images - :retval tuple of URL in backing store, bytes written, checksum + :retval: tuple of URL in backing store, bytes written, checksum and a dictionary with storage system specific information - :raises `glance_store.exceptions.Duplicate` if the image already + :raises: `glance_store.exceptions.Duplicate` if the image already existed """ checksum = hashlib.md5() @@ -448,10 +448,10 @@ class Store(driver.Store): Takes a `glance_store.location.Location` object that indicates where to find the image file to delete. - :location `glance_store.location.Location` object, supplied + :param location: `glance_store.location.Location` object, supplied from glance_store.location.get_location_from_uri() - :raises NotFound if image does not exist; + :raises: NotFound if image does not exist; InUseByStore if image is in use or snapshot unprotect failed """ loc = location.store_location diff --git a/glance_store/_drivers/s3.py b/glance_store/_drivers/s3.py index 30d2881..da45122 100644 --- a/glance_store/_drivers/s3.py +++ b/glance_store/_drivers/s3.py @@ -422,9 +422,9 @@ class Store(glance_store.driver.Store): where to find the image file, and returns a tuple of generator (for reading the image file) and image_size - :param location `glance_store.location.Location` object, supplied + :param location: `glance_store.location.Location` object, supplied from glance_store.location.get_location_from_uri() - :raises `glance_store.exceptions.NotFound` if image does not exist + :raises: `glance_store.exceptions.NotFound` if image does not exist """ key = self._retrieve_key(location) cs = self.READ_CHUNKSIZE @@ -443,7 +443,7 @@ class Store(glance_store.driver.Store): where to find the image file, and returns the image_size (or 0 if unavailable) - :param location `glance_store.location.Location` object, supplied + :param location: `glance_store.location.Location` object, supplied from glance_store.location.get_location_from_uri() """ try: @@ -482,9 +482,9 @@ class Store(glance_store.driver.Store): :param image_size: The size of the image data to write, in bytes :param verifier: An object used to verify signatures for images - :retval tuple of URL in backing store, bytes written, checksum + :retval: tuple of URL in backing store, bytes written, checksum and a dictionary with storage system specific information - :raises `glance_store.exceptions.Duplicate` if the image already + :raises: `glance_store.exceptions.Duplicate` if the image already existed S3 writes the image data using the scheme: @@ -703,10 +703,10 @@ class Store(glance_store.driver.Store): Takes a `glance_store.location.Location` object that indicates where to find the image file to delete - :location `glance_store.location.Location` object, supplied + :param location: `glance_store.location.Location` object, supplied from glance_store.location.get_location_from_uri() - :raises NotFound if image does not exist + :raises: NotFound if image does not exist """ loc = location.store_location s3_conn = self._create_connection(loc) @@ -732,7 +732,7 @@ def get_bucket(conn, bucket_id): :param conn: The ``boto.s3.connection.S3Connection`` :param bucket_id: ID of the bucket to fetch - :raises ``glance_store.exceptions.NotFound`` if bucket is not found. + :raises: ``glance_store.exceptions.NotFound`` if bucket is not found. """ bucket = conn.get_bucket(bucket_id) @@ -799,7 +799,7 @@ def get_key(bucket, obj): :param bucket: The ``boto.s3.Bucket`` :param obj: Object to get the key for - :raises ``glance_store.exceptions.NotFound`` if key is not found. + :raises: ``glance_store.exceptions.NotFound`` if key is not found. """ key = bucket.get_key(obj) diff --git a/glance_store/_drivers/sheepdog.py b/glance_store/_drivers/sheepdog.py index 8a40765..0f1a9db 100644 --- a/glance_store/_drivers/sheepdog.py +++ b/glance_store/_drivers/sheepdog.py @@ -231,9 +231,9 @@ class Store(glance_store.driver.Store): where to find the image file, and returns a generator for reading the image file - :param location `glance_store.location.Location` object, supplied + :param location: `glance_store.location.Location` object, supplied from glance_store.location.get_location_from_uri() - :raises `glance_store.exceptions.NotFound` if image does not exist + :raises: `glance_store.exceptions.NotFound` if image does not exist """ loc = location.store_location @@ -249,10 +249,10 @@ class Store(glance_store.driver.Store): Takes a `glance_store.location.Location` object that indicates where to find the image file and returns the image size - :param location `glance_store.location.Location` object, supplied + :param location: `glance_store.location.Location` object, supplied from glance_store.location.get_location_from_uri() - :raises `glance_store.exceptions.NotFound` if image does not exist - :rtype int + :raises: `glance_store.exceptions.NotFound` if image does not exist + :param rtype: int """ loc = location.store_location @@ -276,8 +276,8 @@ class Store(glance_store.driver.Store): :param image_size: The size of the image data to write, in bytes :param verifier: An object used to verify signatures for images - :retval tuple of URL in backing store, bytes written, and checksum - :raises `glance_store.exceptions.Duplicate` if the image already + :retval: tuple of URL in backing store, bytes written, and checksum + :raises: `glance_store.exceptions.Duplicate` if the image already existed """ @@ -320,10 +320,10 @@ class Store(glance_store.driver.Store): Takes a `glance_store.location.Location` object that indicates where to find the image file to delete - :location `glance_store.location.Location` object, supplied + :param location: `glance_store.location.Location` object, supplied from glance_store.location.get_location_from_uri() - :raises NotFound if image does not exist + :raises: NotFound if image does not exist """ loc = location.store_location diff --git a/glance_store/_drivers/vmware_datastore.py b/glance_store/_drivers/vmware_datastore.py index 69693a4..47c9d0e 100644 --- a/glance_store/_drivers/vmware_datastore.py +++ b/glance_store/_drivers/vmware_datastore.py @@ -478,7 +478,7 @@ class Store(glance_store.Store): :param verifier: An object used to verify signatures for images :retval tuple of URL in backing store, bytes written, checksum and a dictionary with storage system specific information - :raises `glance.common.exceptions.Duplicate` if the image already + :raises: `glance.common.exceptions.Duplicate` if the image already existed `glance.common.exceptions.UnexpectedStatus` if the upload request returned an unexpected status. The expected responses @@ -581,9 +581,9 @@ class Store(glance_store.Store): """Takes a `glance_store.location.Location` object that indicates where to find the image file to delete - :location `glance_store.location.Location` object, supplied + :param location: `glance_store.location.Location` object, supplied from glance_store.location.get_location_from_uri() - :raises NotFound if image does not exist + :raises: NotFound if image does not exist """ file_path = '[%s] %s' % ( location.store_location.datastore_name, diff --git a/glance_store/driver.py b/glance_store/driver.py index eb200b4..169961b 100644 --- a/glance_store/driver.py +++ b/glance_store/driver.py @@ -108,9 +108,9 @@ class Store(capabilities.StoreCapability): where to find the image file, and returns a tuple of generator (for reading the image file) and image_size - :param location `glance_store.location.Location` object, supplied + :param location: `glance_store.location.Location` object, supplied from glance_store.location.get_location_from_uri() - :raises `glance.exceptions.NotFound` if image does not exist + :raises: `glance.exceptions.NotFound` if image does not exist """ raise NotImplementedError @@ -119,9 +119,9 @@ class Store(capabilities.StoreCapability): Takes a `glance_store.location.Location` object that indicates where to find the image file, and returns the size - :param location `glance_store.location.Location` object, supplied + :param location: `glance_store.location.Location` object, supplied from glance_store.location.get_location_from_uri() - :raises `glance_store.exceptions.NotFound` if image does not exist + :raises: `glance_store.exceptions.NotFound` if image does not exist """ raise NotImplementedError @@ -137,9 +137,9 @@ class Store(capabilities.StoreCapability): :param image_file: The image data to write, as a file-like object :param image_size: The size of the image data to write, in bytes - :retval tuple of URL in backing store, bytes written, checksum + :retval: tuple of URL in backing store, bytes written, checksum and a dictionary with storage system specific information - :raises `glance_store.exceptions.Duplicate` if the image already + :raises: `glance_store.exceptions.Duplicate` if the image already existed """ raise NotImplementedError @@ -150,9 +150,9 @@ class Store(capabilities.StoreCapability): Takes a `glance_store.location.Location` object that indicates where to find the image file to delete - :location `glance_store.location.Location` object, supplied + :param location: `glance_store.location.Location` object, supplied from glance_store.location.get_location_from_uri() - :raises `glance_store.exceptions.NotFound` if image does not exist + :raises: `glance_store.exceptions.NotFound` if image does not exist """ raise NotImplementedError @@ -162,12 +162,12 @@ class Store(capabilities.StoreCapability): Sets the read and write access control list for an image in the backend store. - :location `glance_store.location.Location` object, supplied + :param location: `glance_store.location.Location` object, supplied from glance_store.location.get_location_from_uri() - :public A boolean indicating whether the image should be public. - :read_tenants A list of tenant strings which should be granted + :param public: A boolean indicating whether the image should be public. + :param read_tenants: A list of tenant strings which should be granted read access for an image. - :write_tenants A list of tenant strings which should be granted + :param write_tenants: A list of tenant strings which should be granted write access for an image. """ raise NotImplementedError |