From e4e61905ed3404b2b6568bb0a42547da0e7fc710 Mon Sep 17 00:00:00 2001 From: Goutham Pacha Ravi Date: Thu, 19 May 2016 21:01:46 -0400 Subject: [PATCH] Fix tox errors and warnings in the devref Formatting errors have crept into the manila devref and have been accumulating over time. It would be nice to fix these as part of the devref cleanup. Closes-Bug: #1583850 Partially-implements: bp improve-manila-developer-docs Change-Id: I7ec954e720b4b88a21e265cd71ea598ea9a5213b --- doc/source/adminref/quick_start.rst | 2 +- doc/source/devref/ganesha.rst | 2 +- doc/source/devref/hpe_3par_driver.rst | 6 +- doc/source/devref/scheduler.rst | 4 +- manila/scheduler/filters/share_replication.py | 10 +-- manila/scheduler/host_manager.py | 71 ++++++++++--------- manila/scheduler/rpcapi.py | 4 +- manila/share/driver.py | 25 +++++-- manila/share/drivers/hitachi/hds_hnas.py | 46 ++++++------ manila/share/drivers/huawei/huawei_nas.py | 2 +- 10 files changed, 94 insertions(+), 78 deletions(-) diff --git a/doc/source/adminref/quick_start.rst b/doc/source/adminref/quick_start.rst index 6ffdad8ebb..a8d65a46a8 100644 --- a/doc/source/adminref/quick_start.rst +++ b/doc/source/adminref/quick_start.rst @@ -170,7 +170,7 @@ Result:: +-------------+----------------------------------+ -4) Create the Share Filesystems service API endpoints:: +4) Create the Share Filesystems service API endpoints: .. code-block:: console diff --git a/doc/source/devref/ganesha.rst b/doc/source/devref/ganesha.rst index 9abd2f3c7a..ecda5e4614 100644 --- a/doc/source/devref/ganesha.rst +++ b/doc/source/devref/ganesha.rst @@ -185,7 +185,7 @@ Known Restrictions - The library does not support network segmented multi-tenancy model but instead works over a flat network, where the tenants share a network. -.. _ganesha_known_issues +.. _ganesha_known_issues: Known Issues ------------ diff --git a/doc/source/devref/hpe_3par_driver.rst b/doc/source/devref/hpe_3par_driver.rst index c24a5933eb..1a3e530272 100644 --- a/doc/source/devref/hpe_3par_driver.rst +++ b/doc/source/devref/hpe_3par_driver.rst @@ -14,7 +14,7 @@ under the License. HPE 3PAR Driver -============== +=============== The HPE 3PAR manila driver provides NFS and CIFS shared file systems to OpenStack using HPE 3PAR's File Persona capabilities. @@ -69,7 +69,7 @@ On the HPE 3PAR array: - The array class and hardware configuration must support File Persona Pre-Configuration on the HPE 3PAR --------------------------------- +--------------------------------- - HPE 3PAR File Persona must be initialized and started (:code:`startfs`) - A File Provisioning Group (FPG) must be created for use with manila @@ -232,7 +232,7 @@ the original functionality is honored and the file tree remains untouched. be specified to create further customization. The :mod:`manila.share.drivers.hpe.hpe_3par_driver` Module -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. automodule:: manila.share.drivers.hpe.hpe_3par_driver :noindex: diff --git a/doc/source/devref/scheduler.rst b/doc/source/devref/scheduler.rst index 1c1a2fc5d4..9c678daa36 100644 --- a/doc/source/devref/scheduler.rst +++ b/doc/source/devref/scheduler.rst @@ -49,10 +49,10 @@ The :mod:`manila.scheduler.host_manager` Module :show-inheritance: -The :mod:`manila.scheduler.rcpapi` Module +The :mod:`manila.scheduler.rpcapi` Module ----------------------------------------- -.. automodule:: manila.scheduler.rcpapi +.. automodule:: manila.scheduler.rpcapi :noindex: :members: :undoc-members: diff --git a/manila/scheduler/filters/share_replication.py b/manila/scheduler/filters/share_replication.py index c912710d36..685769dd8a 100644 --- a/manila/scheduler/filters/share_replication.py +++ b/manila/scheduler/filters/share_replication.py @@ -27,13 +27,15 @@ class ShareReplicationFilter(base_host.BaseHostFilter): """Return True if 'active' replica's host can replicate with host. Design of this filter: + - Share replication is symmetric. All backends that can - replicate between each other must share the same - 'replication_domain'. + replicate between each other must share the same + 'replication_domain'. - For scheduling a share that can be replicated in the future, - this filter checks for 'replication_domain' capability. + this filter checks for 'replication_domain' capability. - For scheduling a replica, it checks for the - 'replication_domain' compatibility. + 'replication_domain' compatibility. + """ active_replica_host = filter_properties.get('request_spec', {}).get( 'active_replica_host') diff --git a/manila/scheduler/host_manager.py b/manila/scheduler/host_manager.py index 2339941fce..9473c51d4d 100644 --- a/manila/scheduler/host_manager.py +++ b/manila/scheduler/host_manager.py @@ -149,46 +149,47 @@ class HostState(object): """Update information about a host from its share_node info. 'capability' is the status info reported by share backend, a typical - capability looks like this: + capability looks like this:: - capability = { - 'share_backend_name': 'Local NFS', #\ - 'vendor_name': 'OpenStack', # backend level - 'driver_version': '1.0', # mandatory/fixed - 'storage_protocol': 'NFS', #/ stats&capabilities + capability = { + 'share_backend_name': 'Local NFS', #\ + 'vendor_name': 'OpenStack', # backend level + 'driver_version': '1.0', # mandatory/fixed + 'storage_protocol': 'NFS', #/ stats&capabilities - 'active_shares': 10, #\ - 'IOPS_provisioned': 30000, # optional custom - 'fancy_capability_1': 'eat', # stats & capabilities - 'fancy_capability_2': 'drink', #/ + 'active_shares': 10, #\ + 'IOPS_provisioned': 30000, # optional custom + 'fancy_capability_1': 'eat', # stats & capabilities + 'fancy_capability_2': 'drink', #/ - 'pools': [ - {'pool_name': '1st pool', #\ - 'total_capacity_gb': 500, # mandatory stats for - 'free_capacity_gb': 230, # pools - 'allocated_capacity_gb': 270, # | - 'qos': 'False', # | - 'reserved_percentage': 0, #/ + 'pools':[ + { + 'pool_name': '1st pool', #\ + 'total_capacity_gb': 500, # mandatory stats + 'free_capacity_gb': 230, # for pools + 'allocated_capacity_gb': 270, # | + 'qos': 'False', # | + 'reserved_percentage': 0, #/ - 'dying_disks': 100, #\ - 'super_hero_1': 'spider-man', # optional custom - 'super_hero_2': 'flash', # stats & capabilities - 'super_hero_3': 'neoncat' #/ - }, - {'pool_name': '2nd pool', - 'total_capacity_gb': 1024, - 'free_capacity_gb': 1024, - 'allocated_capacity_gb': 0, - 'qos': 'False', - 'reserved_percentage': 0, + 'dying_disks': 100, #\ + 'super_hero_1': 'spider-man', # optional custom + 'super_hero_2': 'flash', # stats & + 'super_hero_3': 'neoncat', # capabilities + 'super_hero_4': 'green lantern', #/ + }, + { + 'pool_name': '2nd pool', + 'total_capacity_gb': 1024, + 'free_capacity_gb': 1024, + 'allocated_capacity_gb': 0, + 'qos': 'False', + 'reserved_percentage': 0, - 'dying_disks': 200, - 'super_hero_1': 'superman', - 'super_hero_2': ' ', - 'super_hero_2': 'Hulk', - } - ] - } + 'dying_disks': 200, + 'super_hero_1': 'superman', + 'super_hero_2': 'Hulk', + }] + } """ self.update_capabilities(capability, service) diff --git a/manila/scheduler/rpcapi.py b/manila/scheduler/rpcapi.py index a79e9499bd..f40b603b28 100644 --- a/manila/scheduler/rpcapi.py +++ b/manila/scheduler/rpcapi.py @@ -32,8 +32,8 @@ class SchedulerAPI(object): 1.0 - Initial version. 1.1 - Add get_pools method - 1.2 - Introduce Share Instances: - Replace create_share() - > create_share_instance() + 1.2 - Introduce Share Instances. Replace ``create_share()`` with + ``create_share_instance()`` 1.3 - Add create_consistency_group method 1.4 - Add migrate_share_to_host method 1.5 - Add create_share_replica diff --git a/manila/share/driver.py b/manila/share/driver.py index 163ecb7a54..ae8a14f572 100644 --- a/manila/share/driver.py +++ b/manila/share/driver.py @@ -680,14 +680,27 @@ class ShareDriver(object): the failure. :param snapshot: ShareSnapshotInstance model with ShareSnapshot data. - Example: - {'id': , 'snapshot_id': < snapshot id>, - 'provider_location': , ......} + + Example:: + { + 'id': , + 'snapshot_id': < snapshot id>, + 'provider_location': , + ... + } + :param driver_options: Optional driver-specific options provided - by admin. Example: - {'key': 'value', ......} + by admin. + + Example:: + + { + 'key': 'value', + ... + } + :return: model_update dictionary with required key 'size', - which should contain size of the share snapshot. + which should contain size of the share snapshot. """ raise NotImplementedError() diff --git a/manila/share/drivers/hitachi/hds_hnas.py b/manila/share/drivers/hitachi/hds_hnas.py index 5e5060f1b7..3cf41bebe5 100644 --- a/manila/share/drivers/hitachi/hds_hnas.py +++ b/manila/share/drivers/hitachi/hds_hnas.py @@ -140,15 +140,15 @@ class HDSHNASDriver(driver.ShareDriver): :param context: The `context.RequestContext` object for the request :param share: Share that will have its access rules updated. :param access_rules: All access rules for given share. This list - is enough to update the access rules for given share. + is enough to update the access rules for given share. :param add_rules: Empty List or List of access rules which should be - added. access_rules already contains these rules. Not used by this - driver. + added. access_rules already contains these rules. Not used by this + driver. :param delete_rules: Empty List or List of access rules which should be - removed. access_rules doesn't contain these rules. Not used by - this driver. + removed. access_rules doesn't contain these rules. Not used by + this driver. :param share_server: Data structure with share server information. - Not used by this driver. + Not used by this driver. """ try: @@ -186,9 +186,9 @@ class HDSHNASDriver(driver.ShareDriver): :param context: The `context.RequestContext` object for the request :param share: Share that will be created. :param share_server: Data structure with share server information. - Not used by this driver. + Not used by this driver. :returns: Returns a path of EVS IP concatenate with the path - of share in the filesystem (e.g. ['172.24.44.10:/shares/id']). + of share in the filesystem (e.g. ['172.24.44.10:/shares/id']). """ LOG.debug("Creating share in HNAS: %(shr)s.", {'shr': share['id']}) @@ -210,7 +210,7 @@ class HDSHNASDriver(driver.ShareDriver): :param context: The `context.RequestContext` object for the request :param share: Share that will be deleted. :param share_server: Data structure with share server information. - Not used by this driver. + Not used by this driver. """ share_id = self._get_hnas_share_id(share['id']) @@ -225,7 +225,7 @@ class HDSHNASDriver(driver.ShareDriver): :param context: The `context.RequestContext` object for the request :param snapshot: Snapshot that will be created. :param share_server: Data structure with share server information. - Not used by this driver. + Not used by this driver. """ share_id = self._get_hnas_share_id(snapshot['share_id']) @@ -242,8 +242,8 @@ class HDSHNASDriver(driver.ShareDriver): :param context: The `context.RequestContext` object for the request :param snapshot: Snapshot that will be deleted. - :param share_server:Data structure with share server information. - Not used by this driver. + :param share_server: Data structure with share server information. + Not used by this driver. """ share_id = self._get_hnas_share_id(snapshot['share_id']) @@ -262,11 +262,11 @@ class HDSHNASDriver(driver.ShareDriver): :param context: The `context.RequestContext` object for the request :param share: Information about the new share. :param snapshot: Information about the snapshot that will be copied - to new share. + to new share. :param share_server: Data structure with share server information. - Not used by this driver. + Not used by this driver. :returns: Returns a path of EVS IP concatenate with the path - of new share in the filesystem (e.g. ['172.24.44.10:/shares/id']). + of new share in the filesystem (e.g. ['172.24.44.10:/shares/id']). """ LOG.debug("Creating a new share from snapshot: %(ss_id)s.", {'ss_id': snapshot['id']}) @@ -284,9 +284,9 @@ class HDSHNASDriver(driver.ShareDriver): :param context: The `context.RequestContext` object for the request :param share: Share that will be checked. :param share_server: Data structure with share server information. - Not used by this driver. + Not used by this driver. :returns: Returns a list of EVS IP concatenated with the path - of share in the filesystem (e.g. ['172.24.44.10:/shares/id']). + of share in the filesystem (e.g. ['172.24.44.10:/shares/id']). """ LOG.debug("Ensuring share in HNAS: %(shr)s.", {'shr': share['id']}) @@ -308,7 +308,7 @@ class HDSHNASDriver(driver.ShareDriver): :param share: Share that will be extended. :param new_size: New size of share. :param share_server: Data structure with share server information. - Not used by this driver. + Not used by this driver. """ share_id = self._get_hnas_share_id(share['id']) @@ -365,7 +365,7 @@ class HDSHNASDriver(driver.ShareDriver): :param share: Share that will be managed. :param driver_options: Empty dict or dict with 'volume_id' option. :returns: Returns a dict with size of share managed - and its location (your path in file-system). + and its location (your path in file-system). """ share_id = self._get_hnas_share_id(share['id']) @@ -426,7 +426,7 @@ class HDSHNASDriver(driver.ShareDriver): :param share: Share that will be shrunk. :param new_size: New size of share. :param share_server: Data structure with share server information. - Not used by this driver. + Not used by this driver. """ share_id = self._get_hnas_share_id(share['id']) @@ -453,7 +453,7 @@ class HDSHNASDriver(driver.ShareDriver): :param share_id: ID of share that will be created. :param share_size: Size limit of share. :returns: Returns a path of /shares/share_id if the export was - created successfully. + created successfully. """ path = '/shares/' + share_id @@ -559,7 +559,7 @@ class HDSHNASDriver(driver.ShareDriver): :param share_id: ID of share that will be managed. :returns: Returns a dict with size of share managed - and its location (your path in file-system). + and its location (your path in file-system). """ self._ensure_share(share_id) @@ -619,7 +619,7 @@ class HDSHNASDriver(driver.ShareDriver): set a quota limit for it and export. :param share: a dict from new share. :param snapshot: a dict from snapshot that will be copied to - new share. + new share. :returns: Returns the path for new share. """ dest_path = '/shares/' + share['id'] diff --git a/manila/share/drivers/huawei/huawei_nas.py b/manila/share/drivers/huawei/huawei_nas.py index e053d6d24a..5133481353 100644 --- a/manila/share/drivers/huawei/huawei_nas.py +++ b/manila/share/drivers/huawei/huawei_nas.py @@ -43,7 +43,7 @@ class HuaweiNasDriver(driver.ShareDriver): """Huawei Share Driver. Executes commands relating to Shares. - API version history: + API version history:: 1.0 - Initial version. 1.1 - Add shrink share.