def test_get_all_volumes(self): api = VolumesApi() volumes_api = None try: volumes_api = api.get_all_volumes(system_id="test") # For the DELETE calls, there's no reponse returned and we want to set that as a valid sdk call. if volumes_api is None: volumes_api = 1 except (ApiException, IOError) as exp: # The API call went through but got a HTTP errorcode, which means the SDK works volumes_api = 1 self.assertNotEqual(volumes_api, None)
api_client = ApiClient() config.api_client = api_client storage_system = StorageSystemsApi(api_client=api_client) ssr = storage_system.get_all_storage_systems() print ssr vol_api = VolumesApi(api_client=api_client) file = open('multipath.conf', 'w') file.write('multipaths {\n') vol_a = vol_api.get_all_volumes( system_id='1c57c70c-bc5f-4f8c-a6a7-34cdb2cafc3a') vol_b = vol_api.get_all_volumes( system_id='b6856c5b-5aa6-45d6-a64d-fcefcb2bf676') volumes = vol_a + vol_b for v in volumes: file.write(' multipath {\n') file.write(' wwid 3' + v.world_wide_name.lower() + '\n') file.write(' alias ' + v.label + '\n') file.write(' }\n') file.write('}\n') file.close() pprint(volumes)
api_client = ApiClient() config.api_client = api_client storage_system = StorageSystemsApi(api_client=api_client) # Get storage system status ssr = storage_system.get_all_storage_systems() for ss in ssr: print "\n##################################\n" \ "Storage System wwn - " + ss.wwn + ", Status : " + ss.status # Get all volumes info for each storage system volume_api = VolumesApi(api_client=api_client) volumes = volume_api.get_all_volumes(system_id=ss.id) for vol in volumes: print "\n##################################\n" \ "Volume " + vol.wwn + ", info : \n" pprint(vol) # Get all volume group info for each storage system vgs = volume_api.get_all_storage_pools(system_id=ss.id) for vg in vgs: print "\n##################################\n" \ "Volume Group info for " + vg.world_wide_name pprint(vg) # Get all drives info for each storage system hardware_api = HardwareApi(api_client=api_client)