def output_dict(): """Output the results as a JSON dict.""" driver_list = [] drivers = util.get_volume_drivers() for driver in drivers: driver_list.append(collect_driver_info(driver)) print(json.dumps(driver_list))
def output_dict(): import pprint driver_list = [] drivers = util.get_volume_drivers() for driver in drivers: driver_list.append(collect_driver_info(driver)) pprint.pprint(driver_list)
def output_dict(): """Output the results as a json dict.""" driver_list = [] drivers = util.get_volume_drivers() for driver in drivers: driver_list.append(collect_driver_info(driver)) print(json.dumps(driver_list))
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')
def output_str(cinder_root, args): with Output(cinder_root, args.output_list) as output: output.write('Volume Drivers') output.write('==============') print_drivers(util.get_volume_drivers(), 'volume_driver', output) output.write('Backup Drivers') output.write('==============') print_drivers(util.get_backup_drivers(), 'backup_driver', output) output.write('FC Zone Manager Drivers') output.write('=======================') print_drivers(util.get_fczm_drivers(), 'zone_driver', output)
def list_drivers(queue): cwd = os.getcwd() # Go to the parent directory directory where Cinder is installed os.chdir(utils.__file__.rsplit(os.sep, 2)[0]) try: drivers = cinder_interface_util.get_volume_drivers() mapping = {d.class_name: vars(d) for d in drivers} # Drivers contain class instances which are not serializable for driver in mapping.values(): driver.pop('cls', None) if 'driver_options' in driver: driver['driver_options'] = convert_oslo_config( driver['driver_options']) finally: os.chdir(cwd) queue.put(mapping)
def list_drivers(queue, output_version): cwd = os.getcwd() # Go to the parent directory directory where Cinder is installed os.chdir(utils.__file__.rsplit(os.sep, 2)[0]) try: drivers = cinder_interface_util.get_volume_drivers() mapping = {d.class_name: vars(d) for d in drivers} for driver in mapping.values(): driver.pop('cls', None) if 'driver_options' in driver: driver['driver_options'] = [ convert_oslo_config(opt, output_version) for opt in driver['driver_options'] ] fix_cinderlib_options(driver, output_version) finally: os.chdir(cwd) queue.put(mapping)
def main(): tools_dir = os.path.dirname(os.path.abspath(__file__)) cinder_root = os.path.dirname(tools_dir) cur_dir = os.getcwd() os.chdir(cinder_root) try: 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') finally: os.chdir(cur_dir)
def main(): tools_dir = os.path.dirname(os.path.abspath(__file__)) cinder_root = os.path.dirname(tools_dir) cur_dir = os.getcwd() os.chdir(cinder_root) try: with Output(cinder_root) as output: output.write('Volume Drivers') output.write('==============') print_drivers(util.get_volume_drivers(), 'volume_driver', output) output.write('Backup Drivers') output.write('==============') print_drivers(util.get_backup_drivers(), 'backup_driver', output) output.write('FC Zone Manager Drivers') output.write('=======================') print_drivers(util.get_fczm_drivers(), 'zone_driver', output) finally: os.chdir(cur_dir)
def output_str(cinder_root, args): with Output(cinder_root, args.output_list) as output: output.write('Volume Drivers') output.write('==============') supported_drivers, unsupported_drivers = filter_drivers( util.get_volume_drivers()) output.write('Supported Drivers') output.write('-----------------') output.write('') print_drivers(supported_drivers, 'volume_driver', output, '~') output.write('Unsupported Drivers') output.write('-------------------') output.write('') print_drivers(unsupported_drivers, 'volume_driver', output, '~') output.write('Backup Drivers') output.write('==============') print_drivers(util.get_backup_drivers(), 'backup_driver', output) output.write('FC Zone Manager Drivers') output.write('=======================') print_drivers(util.get_fczm_drivers(), 'zone_driver', output)
def test_get_volume_drivers(self): # Just ensure that it doesn't raise an exception drivers = util.get_volume_drivers() self.assertNotEqual(0, len(drivers)) for driver in drivers: self.assertIsInstance(driver, util.DriverInfo)
# 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. # import ddt from cinder.interface import util from cinder.interface import volume_driver from cinder import test VOLUME_DRIVERS = util.get_volume_drivers() @ddt.ddt class TestVolumeDrivers(test.TestCase): def test_volume_driver_decorator(self): """Sanity check on the decorator. The interface code is somewhat implicitly tested. We don't need unit tests for all of that code, but as a minimum we should make sure it returns at least one registered driver, else the compliance test will never even run. """ self.assertGreater(len(VOLUME_DRIVERS), 0) @ddt.data(*VOLUME_DRIVERS)
# 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. # import ddt from cinder.interface import util from cinder.interface import volume_driver from cinder import test VOLUME_DRIVERS = util.get_volume_drivers() @ddt.ddt class TestVolumeDrivers(test.TestCase): def test_volume_driver_decorator(self): """Sanity check on the decorator. The interface code is somewhat implicitly tested. We don't need unit tests for all of that code, but as a minimum we should make sure it returns at least one registered driver, else the compliance test will never even run. """ self.assertGreater(len(VOLUME_DRIVERS), 0)