e7b40242f8
This is the start of an effort to both validate that drivers fully implement the expected minimum requirements as well as to create a clear place for driver developers to learn what needs to be implemented and get documentation explaining what is expected for each method. This also enables us to create tooling for documenting the available drivers and their capabilities, to some degree. A follow up patch will show some of what I'm thinking there, but it will make it possible to write scripts for different needs. This is somewhat a cleanup attempt to the ABC work that was started a while back. This does not aim to replace that effort, but give a mechanism for some of the things expected out of that effort that ended up not being possible with how it evolved. In most cases we do not really care if a driver is inherited from a certain base class, just that it conforms to the given interface. The interface/inheritance work really centers around two separate things: * Ensuring drivers conform to an expected interface * Allowing code reuse and common implementation This is really for the first item. Additional work is needed to complete the ABC work we've done, but that really focuses on the second item, and is out of scope for the intent of this patch. Change-Id: I4168225126fe88c31712d94f0a130e9e7ede3446
57 lines
1.7 KiB
Python
Executable File
57 lines
1.7 KiB
Python
Executable File
#! /usr/bin/env python
|
|
#
|
|
# 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.
|
|
|
|
"""Generate list of cinder drivers"""
|
|
|
|
from cinder.interface import util
|
|
|
|
|
|
def format_description(desc):
|
|
desc = desc or '<None>'
|
|
lines = desc.rstrip('\n').split('\n')
|
|
for line in lines:
|
|
print(' %s' % line)
|
|
|
|
|
|
def print_drivers(drivers, config_name):
|
|
# for driver in drivers.sort(key=lambda x: x.class_fqn):
|
|
for driver in sorted(drivers, key=lambda x: x.class_fqn):
|
|
print(driver.class_name)
|
|
print('-' * len(driver.class_name))
|
|
if driver.version:
|
|
print('* Version: %s' % driver.version)
|
|
print('* %s=%s' % (config_name, driver.class_fqn))
|
|
print('* Description:')
|
|
format_description(driver.desc)
|
|
print('')
|
|
print('')
|
|
|
|
|
|
def main():
|
|
print('VOLUME DRIVERS')
|
|
print('==============')
|
|
print_drivers(util.get_volume_drivers(), 'volume_driver')
|
|
|
|
print('BACKUP DRIVERS')
|
|
print('==============')
|
|
print_drivers(util.get_backup_drivers(), 'backup_driver')
|
|
|
|
print('FC ZONE MANAGER DRIVERS')
|
|
print('=======================')
|
|
print_drivers(util.get_fczm_drivers(), 'zone_driver')
|
|
|
|
|
|
if __name__ == '__main__':
|
|
main()
|