Merge "Add driver list to doc build"
This commit is contained in:
commit
c47d38dc94
1
.gitignore
vendored
1
.gitignore
vendored
@ -30,6 +30,7 @@ tags
|
|||||||
# Files created by Sphinx build
|
# Files created by Sphinx build
|
||||||
doc/build
|
doc/build
|
||||||
doc/source/_static/cinder.conf.sample
|
doc/source/_static/cinder.conf.sample
|
||||||
|
doc/source/drivers.rst
|
||||||
|
|
||||||
#Files created for API reference
|
#Files created for API reference
|
||||||
api-ref/build
|
api-ref/build
|
||||||
|
24
doc/ext/cinder_driverlist.py
Normal file
24
doc/ext/cinder_driverlist.py
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
# Copyright 2016 Dell Inc.
|
||||||
|
# All Rights Reserved.
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
#
|
||||||
|
|
||||||
|
from cinder import utils
|
||||||
|
|
||||||
|
|
||||||
|
def setup(app):
|
||||||
|
print('** Generating driver list...')
|
||||||
|
rv = utils.execute('./tools/generate_driver_list.py', ['docs'])
|
||||||
|
print(rv[0])
|
||||||
|
|
@ -35,6 +35,7 @@ extensions = ['sphinx.ext.autodoc',
|
|||||||
'oslosphinx',
|
'oslosphinx',
|
||||||
'stevedore.sphinxext',
|
'stevedore.sphinxext',
|
||||||
'oslo_config.sphinxconfiggen',
|
'oslo_config.sphinxconfiggen',
|
||||||
|
'ext.cinder_driverlist',
|
||||||
]
|
]
|
||||||
|
|
||||||
config_generator_config_file = '../../cinder/config/cinder-config-generator.conf'
|
config_generator_config_file = '../../cinder/config/cinder-config-generator.conf'
|
||||||
|
@ -1,6 +0,0 @@
|
|||||||
===================
|
|
||||||
Available Drivers
|
|
||||||
===================
|
|
||||||
|
|
||||||
.. list-plugins:: oslo_messaging.notify.drivers
|
|
||||||
:detailed:
|
|
@ -44,9 +44,20 @@ Developer Docs
|
|||||||
database_architecture
|
database_architecture
|
||||||
scheduler-filters
|
scheduler-filters
|
||||||
scheduler-weights
|
scheduler-weights
|
||||||
drivers
|
|
||||||
oslo-middleware
|
oslo-middleware
|
||||||
|
|
||||||
|
Drivers
|
||||||
|
=======
|
||||||
|
|
||||||
|
Cinder maintains drivers for volume backends, backup targets, and fibre
|
||||||
|
channel zone manager fabric types. The list of the available drivers can be
|
||||||
|
found here:
|
||||||
|
|
||||||
|
.. toctree::
|
||||||
|
:maxdepth: 1
|
||||||
|
|
||||||
|
drivers
|
||||||
|
|
||||||
API Extensions
|
API Extensions
|
||||||
==============
|
==============
|
||||||
|
|
||||||
|
@ -15,30 +15,55 @@
|
|||||||
"""Generate list of cinder drivers"""
|
"""Generate list of cinder drivers"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
from cinder.interface import util
|
from cinder.interface import util
|
||||||
|
|
||||||
|
|
||||||
def format_description(desc):
|
class Output(object):
|
||||||
|
|
||||||
|
def __init__(self, base_dir):
|
||||||
|
# At this point we don't care what was passed in, just a trigger
|
||||||
|
# to write this out to the doc tree for now
|
||||||
|
self.driver_file = None
|
||||||
|
if len(sys.argv) > 1:
|
||||||
|
self.driver_file = open(
|
||||||
|
'%s/doc/source/drivers.rst' % base_dir, 'w+')
|
||||||
|
self.driver_file.write('===================\n')
|
||||||
|
self.driver_file.write('Available Drivers\n')
|
||||||
|
self.driver_file.write('===================\n\n')
|
||||||
|
|
||||||
|
def __enter__(self):
|
||||||
|
return self
|
||||||
|
|
||||||
|
def __exit__(self, type, value, traceback):
|
||||||
|
self.driver_file.close()
|
||||||
|
|
||||||
|
def write(self, text):
|
||||||
|
if self.driver_file:
|
||||||
|
self.driver_file.write('%s\n' % text)
|
||||||
|
else:
|
||||||
|
print(text)
|
||||||
|
|
||||||
|
|
||||||
|
def format_description(desc, output):
|
||||||
desc = desc or '<None>'
|
desc = desc or '<None>'
|
||||||
lines = desc.rstrip('\n').split('\n')
|
lines = desc.rstrip('\n').split('\n')
|
||||||
for line in lines:
|
for line in lines:
|
||||||
print(' %s' % line)
|
output.write(' %s' % line)
|
||||||
|
|
||||||
|
|
||||||
def print_drivers(drivers, config_name):
|
def print_drivers(drivers, config_name, output):
|
||||||
# for driver in drivers.sort(key=lambda x: x.class_fqn):
|
|
||||||
for driver in sorted(drivers, key=lambda x: x.class_fqn):
|
for driver in sorted(drivers, key=lambda x: x.class_fqn):
|
||||||
print(driver.class_name)
|
output.write(driver.class_name)
|
||||||
print('-' * len(driver.class_name))
|
output.write('-' * len(driver.class_name))
|
||||||
if driver.version:
|
if driver.version:
|
||||||
print('* Version: %s' % driver.version)
|
output.write('* Version: %s' % driver.version)
|
||||||
print('* %s=%s' % (config_name, driver.class_fqn))
|
output.write('* %s=%s' % (config_name, driver.class_fqn))
|
||||||
print('* Description::')
|
output.write('* Description:')
|
||||||
print('')
|
format_description(driver.desc, output)
|
||||||
format_description(driver.desc)
|
output.write('')
|
||||||
print('')
|
output.write('')
|
||||||
print('')
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
@ -48,17 +73,18 @@ def main():
|
|||||||
os.chdir(cinder_root)
|
os.chdir(cinder_root)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
print('VOLUME DRIVERS')
|
with Output(cinder_root) as output:
|
||||||
print('==============')
|
output.write('Volume Drivers')
|
||||||
print_drivers(util.get_volume_drivers(), 'volume_driver')
|
output.write('==============')
|
||||||
|
print_drivers(util.get_volume_drivers(), 'volume_driver', output)
|
||||||
|
|
||||||
print('BACKUP DRIVERS')
|
output.write('Backup Drivers')
|
||||||
print('==============')
|
output.write('==============')
|
||||||
print_drivers(util.get_backup_drivers(), 'backup_driver')
|
print_drivers(util.get_backup_drivers(), 'backup_driver', output)
|
||||||
|
|
||||||
print('FC ZONE MANAGER DRIVERS')
|
output.write('FC Zone Manager Drivers')
|
||||||
print('=======================')
|
output.write('=======================')
|
||||||
print_drivers(util.get_fczm_drivers(), 'zone_driver')
|
print_drivers(util.get_fczm_drivers(), 'zone_driver', output)
|
||||||
finally:
|
finally:
|
||||||
os.chdir(cur_dir)
|
os.chdir(cur_dir)
|
||||||
|
|
||||||
|
3
tox.ini
3
tox.ini
@ -104,7 +104,8 @@ install_command = pip install -U --force-reinstall {opts} {packages}
|
|||||||
commands = {posargs}
|
commands = {posargs}
|
||||||
|
|
||||||
[testenv:docs]
|
[testenv:docs]
|
||||||
commands = python setup.py build_sphinx
|
commands =
|
||||||
|
python setup.py build_sphinx
|
||||||
|
|
||||||
[testenv:gendriverlist]
|
[testenv:gendriverlist]
|
||||||
sitepackages = False
|
sitepackages = False
|
||||||
|
Loading…
Reference in New Issue
Block a user