From 58bd5b0179d1c2e4ac0dd92f6a9b8d4ab45155fa Mon Sep 17 00:00:00 2001
From: Tom Barron <tpb@dyncloud.net>
Date: Fri, 3 Mar 2017 09:38:22 -0500
Subject: [PATCH] Unblock gate failure on docs build

Our form of todo extension does not work with sphinx 1.5.2.

Remove it to unblock gate: we can add todos back in later with
more current methods.  Also clean up some dangling cross-references
in the doc.

Co-Authored-By: Valeriy Ponomaryov <vponomaryov@mirantis.com>
Change-Id: If74b9e32ad2b5d8d70da60895d85588ff993797e
---
 doc/ext/manila_todo.py                      | 116 --------------------
 doc/source/conf.py                          |   1 -
 doc/source/devref/fakes.rst                 |   2 -
 doc/source/devref/index.rst                 |   1 -
 doc/source/devref/launchpad.rst             |   1 -
 doc/source/devref/scheduler.rst             |  10 --
 doc/source/devref/share.rst                 |   3 -
 doc/source/devref/share_migration.rst       |   2 +
 doc/source/devref/unit_tests.rst            |  16 ++-
 doc/source/index.rst                        |   5 -
 manila/scheduler/rpcapi.py                  |   6 +-
 manila/share/driver.py                      |  21 ++--
 manila/share/drivers/hitachi/hnas/driver.py |  90 ++++++++++++++-
 manila/share/drivers/hpe/hpe_3par_driver.py |   7 +-
 manila/share/drivers/huawei/huawei_nas.py   |   2 +-
 manila/share/drivers/zfsonlinux/driver.py   |  12 +-
 tox.ini                                     |   2 +
 17 files changed, 129 insertions(+), 168 deletions(-)
 delete mode 100644 doc/ext/manila_todo.py

diff --git a/doc/ext/manila_todo.py b/doc/ext/manila_todo.py
deleted file mode 100644
index 0d40837301..0000000000
--- a/doc/ext/manila_todo.py
+++ /dev/null
@@ -1,116 +0,0 @@
-#  Licensed under the Apache License, Version 2.0 (the "License"); you may
-#  not use this file except in compliance with the License. You may obtain
-#  a copy of the License at
-#
-#       http://www.apache.org/licenses/LICENSE-2.0
-#
-#  Unless required by applicable law or agreed to in writing, software
-#  distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-#  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-#  License for the specific language governing permissions and limitations
-#  under the License.
-
-# This is a hack of the builtin todo extension, to make the todo_list
-# more user friendly
-
-from six import moves
-from sphinx.ext.todo import *
-import re
-
-
-def _(s):
-    return s
-
-
-def process_todo_nodes(app, doctree, fromdocname):
-    if not app.config['todo_include_todos']:
-        for node in doctree.traverse(todo_node):
-            node.parent.remove(node)
-
-    # Replace all todolist nodes with a list of the collected todos.
-    # Augment each todo with a backlink to the original location.
-    env = app.builder.env
-
-    if not hasattr(env, 'todo_all_todos'):
-        env.todo_all_todos = []
-
-    # remove the item that was added in the constructor, since I'm tired of
-    # reading through docutils for the proper way to construct an empty list
-    lists = []
-    for i in moves.range(5):
-        lists.append(nodes.bullet_list("", nodes.Text('', '')))
-        lists[i].remove(lists[i][0])
-        lists[i]['classes'].append('todo_list')
-
-    for node in doctree.traverse(todolist):
-        if not app.config['todo_include_todos']:
-            node.replace_self([])
-            continue
-
-        for todo_info in env.todo_all_todos:
-            para = nodes.paragraph()
-            filename = env.doc2path(todo_info['docname'], base=None)
-
-            # Create a reference
-            newnode = nodes.reference('', '')
-
-            line_info = todo_info['lineno']
-            link = _('%(filename)s, line %(line_info)d') % locals()
-            innernode = nodes.emphasis(link, link)
-            newnode['refdocname'] = todo_info['docname']
-
-            try:
-                newnode['refuri'] = app.builder.get_relative_uri(
-                    fromdocname, todo_info['docname'])
-                newnode['refuri'] += '#' + todo_info['target']['refid']
-            except NoUri:
-                # ignore if no URI can be determined, e.g. for LaTeX output
-                pass
-
-            newnode.append(innernode)
-            para += newnode
-            para['classes'].append('todo_link')
-
-            todo_entry = todo_info['todo']
-
-            env.resolve_references(todo_entry, todo_info['docname'],
-                                   app.builder)
-
-            item = nodes.list_item('', para)
-            todo_entry[1]['classes'].append('details')
-
-            comment = todo_entry[1]
-
-            m = re.match(r"^P(\d)", comment.astext())
-            priority = 5
-            if m:
-                priority = int(m.group(1))
-                if priority < 0:
-                    priority = 1
-                if priority > 5:
-                    priority = 5
-
-            item['classes'].append('todo_p' + str(priority))
-            todo_entry['classes'].append('todo_p' + str(priority))
-
-            item.append(comment)
-
-            lists[priority - 1].insert(0, item)
-
-        node.replace_self(lists)
-
-
-def setup(app):
-    app.add_config_value('todo_include_todos', False, False)
-
-    app.add_node(todolist)
-    app.add_node(todo_node,
-                 html=(visit_todo_node, depart_todo_node),
-                 latex=(visit_todo_node, depart_todo_node),
-                 text=(visit_todo_node, depart_todo_node))
-
-    app.add_directive('todo', Todo)
-    app.add_directive('todolist', TodoList)
-    app.connect('doctree-read', process_todos)
-    app.connect('doctree-resolved', process_todo_nodes)
-    app.connect('env-purge-doc', purge_todos)
diff --git a/doc/source/conf.py b/doc/source/conf.py
index a1e364941f..ad33d13d66 100644
--- a/doc/source/conf.py
+++ b/doc/source/conf.py
@@ -43,7 +43,6 @@ sys.path.insert(0, os.path.abspath('./'))
 # or your custom ones.
 
 extensions = ['sphinx.ext.autodoc',
-              'ext.manila_todo',
               'sphinx.ext.coverage',
               'sphinx.ext.ifconfig',
               'sphinx.ext.graphviz',
diff --git a/doc/source/devref/fakes.rst b/doc/source/devref/fakes.rst
index 8a31707c40..b0051371bc 100644
--- a/doc/source/devref/fakes.rst
+++ b/doc/source/devref/fakes.rst
@@ -18,8 +18,6 @@
 Fake Drivers
 ============
 
-.. todo:: document general info about fakes
-
 When the real thing isn't available and you have some development to do these
 fake implementations of various drivers let you get on with your day.
 
diff --git a/doc/source/devref/index.rst b/doc/source/devref/index.rst
index b39367b50d..a3e19bdc2e 100644
--- a/doc/source/devref/index.rst
+++ b/doc/source/devref/index.rst
@@ -122,7 +122,6 @@ Share backends
    hitachi_hnas_driver
    hpe_3par_driver
    tegile_driver
-   maprfs_native_driver
 
 Indices and tables
 ------------------
diff --git a/doc/source/devref/launchpad.rst b/doc/source/devref/launchpad.rst
index daf7e65ffe..612dd83d8a 100644
--- a/doc/source/devref/launchpad.rst
+++ b/doc/source/devref/launchpad.rst
@@ -13,7 +13,6 @@ OpenStack-related sites. These sites include:
 
  * `Wiki`_
  * Gerrit (see :doc:`gerrit`)
- * Jenkins (see :doc:`jenkins`)
 
 Mailing list
 ------------
diff --git a/doc/source/devref/scheduler.rst b/doc/source/devref/scheduler.rst
index 9c678daa36..96d24eb736 100644
--- a/doc/source/devref/scheduler.rst
+++ b/doc/source/devref/scheduler.rst
@@ -163,16 +163,6 @@ The :mod:`manila.scheduler.filters.capacity` Filter
     :show-inheritance:
 
 
-The :mod:`manila.scheduler.filters.consistency_group` Filter
-------------------------------------------------------------
-
-.. automodule:: manila.scheduler.filters.consistency_group
-    :noindex:
-    :members:
-    :undoc-members:
-    :show-inheritance:
-
-
 The :mod:`manila.scheduler.filters.extra_specs_ops` Filter
 ----------------------------------------------------------
 
diff --git a/doc/source/devref/share.rst b/doc/source/devref/share.rst
index ee1fabeb14..a9ae7fa1af 100644
--- a/doc/source/devref/share.rst
+++ b/doc/source/devref/share.rst
@@ -18,9 +18,6 @@
 Shared Filesystems
 ==================
 
-.. todo:: rework
-
-
 The :mod:`manila.share.manager` Module
 --------------------------------------
 
diff --git a/doc/source/devref/share_migration.rst b/doc/source/devref/share_migration.rst
index 31df4ba221..f3fb75017a 100644
--- a/doc/source/devref/share_migration.rst
+++ b/doc/source/devref/share_migration.rst
@@ -332,10 +332,12 @@ Share Migration driver-assisted interfaces:
 -------------------------------------------
 
 .. autoclass:: manila.share.driver.ShareDriver
+    :noindex:
     :members: migration_check_compatibility, migration_start, migration_continue, migration_complete, migration_cancel, migration_get_progress
 
 Share Migration host-assisted interfaces:
 -----------------------------------------
 
 .. autoclass:: manila.share.driver.ShareDriver
+    :noindex:
     :members:  connection_get_info
diff --git a/doc/source/devref/unit_tests.rst b/doc/source/devref/unit_tests.rst
index 96a1135bc3..7d4052d039 100644
--- a/doc/source/devref/unit_tests.rst
+++ b/doc/source/devref/unit_tests.rst
@@ -4,7 +4,7 @@ Unit Tests
 Manila contains a suite of unit tests, in the manila/tests directory.
 
 Any proposed code change will be automatically rejected by the OpenStack
-Jenkins server [#f1]_ if the change causes unit test failures.
+Jenkins server if the change causes unit test failures.
 
 Running the tests
 -----------------
@@ -92,7 +92,7 @@ Virtualenv
 ----------
 
 By default, the tests use the Python packages installed inside a
-virtualenv [#f2]_. (This is equivalent to using the ``-V, --virtualenv`` flag).
+virtualenv [#f1]_. (This is equivalent to using the ``-V, --virtualenv`` flag).
 If the virtualenv does not exist, it will be created the first time the tests are run.
 
 If you wish to recreate the virtualenv, call ``run_tests.sh`` with the flag::
@@ -119,7 +119,7 @@ If you do not wish to use a virtualenv at all, use the flag::
 Database
 --------
 
-Some of the unit tests make queries against an sqlite database [#f3]_. By
+Some of the unit tests make queries against an sqlite database [#f2]_. By
 default, the test database (``tests.sqlite``) is deleted and recreated each
 time ``run_tests.sh`` is invoked (This is equivalent to using the
 ``-r, --recreate-db`` flag). To reduce testing time if a database already
@@ -137,7 +137,7 @@ Gotchas
 **Running Tests from Shared Folders**
 
 If you are running the unit tests from a shared folder, you may see tests start
-to fail or stop completely as a result of Python lockfile issues [#f4]_. You
+to fail or stop completely as a result of Python lockfile issues [#f3]_. You
 can get around this by manually setting or updating the following line in
 ``manila/tests/conf_fixture.py``::
 
@@ -148,12 +148,10 @@ a shared folder.
 
 .. rubric:: Footnotes
 
-.. [#f1] See :doc:`jenkins`.
-
-.. [#f2] See :doc:`development.environment` for more details about the use of
+.. [#f1] See :doc:`development.environment` for more details about the use of
    virtualenv.
 
-.. [#f3] There is an effort underway to use a fake DB implementation for the
+.. [#f2] There is an effort underway to use a fake DB implementation for the
    unit tests. See https://lists.launchpad.net/openstack/msg05604.html
 
-.. [#f4] See Vish's comment in this bug report: https://bugs.launchpad.net/manila/+bug/882933
+.. [#f3] See Vish's comment in this bug report: https://bugs.launchpad.net/manila/+bug/882933
diff --git a/doc/source/index.rst b/doc/source/index.rst
index e18f04e9bf..d30a1bd6b7 100644
--- a/doc/source/index.rst
+++ b/doc/source/index.rst
@@ -66,11 +66,6 @@ Information
 
    glossary
 
-Outstanding Documentation Tasks
-===============================
-
-.. todolist::
-
 Indices and tables
 ==================
 
diff --git a/manila/scheduler/rpcapi.py b/manila/scheduler/rpcapi.py
index 2503dbfb94..912148be95 100644
--- a/manila/scheduler/rpcapi.py
+++ b/manila/scheduler/rpcapi.py
@@ -78,12 +78,16 @@ class SchedulerAPI(object):
         """Casts an rpc to the scheduler to create a share group.
 
         Example of 'request_spec' argument value::
+
             {
-                'share_group_type_id': ,
+
+                'share_group_type_id': 'fake_share_group_type_id',
                 'share_group_id': 'some_fake_uuid',
                 'share_types': [models.ShareType],
                 'resource_type': models.ShareGroup,
+
             }
+
         """
         request_spec_p = jsonutils.to_primitive(request_spec)
         call_context = self.client.prepare(version='1.8')
diff --git a/manila/share/driver.py b/manila/share/driver.py
index b873521698..bd0a52932b 100644
--- a/manila/share/driver.py
+++ b/manila/share/driver.py
@@ -731,17 +731,24 @@ class ShareDriver(object):
         :param delete_rules: Empty List or List of access rules which should be
                removed. access_rules doesn't contain these rules.
         :param share_server: None or Share server model
-        :returns: None, or a dictionary of updates in the format:
+        :returns: None, or a dictionary of updates in the format::
 
             {
+
                 '09960614-8574-4e03-89cf-7cf267b0bd08': {
-                        'access_key': 'alice31493e5441b8171d2310d80e37e',
-                        'state': 'error',
-                    },
+
+                    'access_key': 'alice31493e5441b8171d2310d80e37e',
+                    'state': 'error',
+
+                },
+
                 '28f6eabb-4342-486a-a7f4-45688f0c0295': {
-                        'access_key': 'bob0078aa042d5a7325480fd13228b',
-                        'state': 'active',
-                    },
+
+                    'access_key': 'bob0078aa042d5a7325480fd13228b',
+                    'state': 'active',
+
+                },
+
             }
 
         The top level keys are 'access_id' fields of the access rules that
diff --git a/manila/share/drivers/hitachi/hnas/driver.py b/manila/share/drivers/hitachi/hnas/driver.py
index de863d0000..9be11c3a88 100644
--- a/manila/share/drivers/hitachi/hnas/driver.py
+++ b/manila/share/drivers/hitachi/hnas/driver.py
@@ -89,12 +89,15 @@ CONF.register_opts(hitachi_hnas_opts)
 class HitachiHNASDriver(driver.ShareDriver):
     """Manila HNAS Driver implementation.
 
-    1.0.0 - Initial Version.
-    2.0.0 - Refactoring, bugfixes, implemented Share Shrink and Update Access.
-    3.0.0 - New driver location, implemented support for CIFS protocol.
-    3.1.0 - Added admin network export location support.
-    4.0.0 - Added mountable snapshots, revert-to-snapshot and manage snapshots
-            features support.
+    Driver versions::
+
+        1.0.0 - Initial Version.
+        2.0.0 - Refactoring, bugfixes, implemented Share Shrink and
+                Update Access.
+        3.0.0 - New driver location, implemented support for CIFS protocol.
+        3.1.0 - Added admin network export location support.
+        4.0.0 - Added mountable snapshots, revert-to-snapshot and
+                manage snapshots features support.
     """
 
     def __init__(self, *args, **kwargs):
@@ -318,31 +321,45 @@ class HitachiHNASDriver(driver.ShareDriver):
             Example for NFS::
 
             [
+
               {
+
                 'path': '172.24.44.10:/shares/id',
                 'metadata': {},
                 'is_admin_only': False
+
               },
+
               {
+
                 'path': '192.168.0.10:/shares/id',
                 'metadata': {},
                 'is_admin_only': True
+
               }
+
             ]
 
             Example for CIFS::
 
             [
+
               {
+
                 'path': '\\172.24.44.10\id',
                 'metadata': {},
                 'is_admin_only': False
+
               },
+
               {
+
                 'path': '\\192.168.0.10\id',
                 'metadata': {},
                 'is_admin_only': True
+
               }
+
             ]
 
         """
@@ -445,31 +462,45 @@ class HitachiHNASDriver(driver.ShareDriver):
             Example for NFS::
 
             [
+
               {
+
                 'path': '172.24.44.10:/shares/id',
                 'metadata': {},
                 'is_admin_only': False
+
               },
+
               {
+
                 'path': '192.168.0.10:/shares/id',
                 'metadata': {},
                 'is_admin_only': True
+
               }
+
             ]
 
             Example for CIFS::
 
             [
+
               {
+
                 'path': '\\172.24.44.10\id',
                 'metadata': {},
                 'is_admin_only': False
+
               },
+
               {
+
                 'path': '\\192.168.0.10\id',
                 'metadata': {},
                 'is_admin_only': True
+
               }
+
             ]
 
         """
@@ -501,31 +532,45 @@ class HitachiHNASDriver(driver.ShareDriver):
             Example for NFS::
 
             [
+
               {
+
                 'path': '172.24.44.10:/shares/id',
                 'metadata': {},
                 'is_admin_only': False
+
               },
+
               {
+
                 'path': '192.168.0.10:/shares/id',
                 'metadata': {},
                 'is_admin_only': True
+
               }
+
             ]
 
             Example for CIFS::
 
             [
+
               {
+
                 'path': '\\172.24.44.10\id',
                 'metadata': {},
                 'is_admin_only': False
+
               },
+
               {
+
                 'path': '\\192.168.0.10\id',
                 'metadata': {},
                 'is_admin_only': True
+
               }
+
             ]
 
         """
@@ -610,37 +655,55 @@ class HitachiHNASDriver(driver.ShareDriver):
             Example for NFS::
 
             {
+
               'size': 10,
               'export_locations': [
+
                 {
+
                   'path': '172.24.44.10:/shares/id',
                   'metadata': {},
                   'is_admin_only': False
+
                 },
+
                 {
+
                   'path': '192.168.0.10:/shares/id',
                   'metadata': {},
                   'is_admin_only': True
+
                 }
+
               ]
+
             }
 
             Example for CIFS::
 
             {
+
               'size': 10,
               'export_locations': [
+
                 {
+
                   'path': '\\172.24.44.10\id',
                   'metadata': {},
                   'is_admin_only': False
+
                 },
+
                 {
+
                   'path': '\\192.168.0.10\id',
                   'metadata': {},
                   'is_admin_only': True
+
                 }
+
               ]
+
             }
 
         """
@@ -1171,32 +1234,47 @@ class HitachiHNASDriver(driver.ShareDriver):
             Example for NFS::
 
             [
+
               {
+
                 'path': '172.24.44.10:/snapshots/id',
                 'metadata': {},
                 'is_admin_only': False
+
               },
+
               {
+
                 'path': '192.168.0.10:/snapshots/id',
                 'metadata': {},
                 'is_admin_only': True
+
               }
+
             ]
 
             Example for CIFS::
 
             [
+
               {
+
                 'path': '\\172.24.44.10\id',
                 'metadata': {},
                 'is_admin_only': False
+
               },
+
               {
+
                 'path': '\\192.168.0.10\id',
                 'metadata': {},
                 'is_admin_only': True
+
               }
+
             ]
+
         """
         LOG.debug("Ensuring snapshot in HNAS: %(snap)s.",
                   {'snap': snapshot['id']})
diff --git a/manila/share/drivers/hpe/hpe_3par_driver.py b/manila/share/drivers/hpe/hpe_3par_driver.py
index 6f3bffd72b..8aa40a279a 100644
--- a/manila/share/drivers/hpe/hpe_3par_driver.py
+++ b/manila/share/drivers/hpe/hpe_3par_driver.py
@@ -42,8 +42,10 @@ class FPG(types.String, types.IPAddress):
 
     Used to represent multiple pools per backend values.
     Converts configuration value to an FPGs value.
-    FPGs value format:
+    FPGs value format::
+
         FPG name, IP address 1, IP address 2, ..., IP address 4
+
     where FPG name is a string value,
     IP address is of type types.IPAddress
 
@@ -199,7 +201,8 @@ class HPE3ParShareDriver(driver.ShareDriver):
 
     Supports NFS and CIFS protocols on arrays with File Persona.
 
-    Version history:
+    Version history::
+
         1.0.0 - Begin Liberty development (post-Kilo)
         1.0.1 - Report thin/dedup/hp_flash_cache capabilities
         1.0.2 - Add share server/share network support
diff --git a/manila/share/drivers/huawei/huawei_nas.py b/manila/share/drivers/huawei/huawei_nas.py
index 2398b3345e..17e06e29aa 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.
-    Driver version history:
+    Driver version history::
 
         1.0 - Initial version.
         1.1 - Add shrink share.
diff --git a/manila/share/drivers/zfsonlinux/driver.py b/manila/share/drivers/zfsonlinux/driver.py
index cb69e8160c..7f5d09d0f6 100644
--- a/manila/share/drivers/zfsonlinux/driver.py
+++ b/manila/share/drivers/zfsonlinux/driver.py
@@ -787,9 +787,15 @@ class ZFSonLinuxShareDriver(zfs_utils.ExecuteMixin, driver.ShareDriver):
 
         :param snapshot_instance: SnapshotInstance data
         :param driver_options: expects only one optional key 'size'.
-        :return: dict with share snapshot instance fields for update, example:
-            {'size': 1,
-             'provider_location': 'path/to/some/dataset@some_snapshot_tag'}
+        :return: dict with share snapshot instance fields for update, example::
+
+            {
+
+                'size': 1,
+                'provider_location': 'path/to/some/dataset@some_snapshot_tag',
+
+            }
+
         """
         snapshot_size = int(driver_options.get("size", 0))
         old_provider_location = snapshot_instance.get("provider_location")
diff --git a/tox.ini b/tox.ini
index a218293791..2563242b0b 100644
--- a/tox.ini
+++ b/tox.ini
@@ -63,7 +63,9 @@ commands =
 commands = {posargs}
 
 [testenv:docs]
+whitelist_externals = rm
 commands =
+  rm -rf doc/build
   python setup.py build_sphinx
   doc8 --ignore D001 --ignore-path .tox --ignore-path doc/build --ignore-path manila.egg-info -e txt -e rst