Authors: Magnus Nilsson & Matt Cowger
Requirements:
Goal is to resemble the ScaleIO API (not in detail) in a Pythonic way. Atm ScaleIO-py is in early beta stage and focus will be on getting basic features become stable (especially the to/from object mapping) before adding fancy functionality.
For bleeding edge users:
Have a look in examples directory for complete code examples.
from scaleiopy.scaleio import ScaleIO
# Logging level can be change by adjusting last parameter [DEBUG, FATAL, ERROR, CRITICAL, WARNING, INFO]. If left out of class init DEBUG is assumed
sio = ScaleIO("https://192.168.50.12/api","admin","Scaleio123",False, "ERROR)
#print all the known SDCs:
pprint(sio.sdc)
#print all the known SDSs:
pprint(sio.sds)
#print all the known Volumes:
pprint(sio.volumes)
#print all the known Protection Domains:
pprint(sio.protection_domains)
#Create a new Volume (of 8192Mb, smallest possible)
sio.create_volume_by_pd_name('testvol001', 8192, sio.get_pd_by_name('default'))
#Create Volume and Map to single SDC in one operation
sio.create_volume_by_pd_name('testvol001', 8192, sio.get_pd_by_name('default'), mapToSdc=sio.get_sdc_by_id('ce4d7e2a00000001'))
#Create Volume and Map to all SDC in one operation
sio.create_volume_by_pd_name('testvol001', 8192, sio.get_pd_by_name('default'), mapAll=True)
# method get_sdc_by_ip('ipaddr') if you want to map an Vol to SDC using its IP address
sio.map_volume_to_sdc(sio.get_volume_by_name('testvol'), sio.get_sdc_by_id('ce4d7e2a00000001'), False)
# Map Volume to all SDCs
sio.map_volume_to_sdc(sio.get_volume_by_name('testvol'), mapAll=True)
#Unmap Volume from SDC
sio.unmap_volume_from_sdc(sio.get_volume_by_name('testvol'), sio.get_sdc_by_id('ce4d7e2a00000001'))
#Delete Volume
sio.delete_volume(sio.get_volume_by_name('testvol'), 'ONLY_ME')
snapSpec = scaleio.SnapshotSpecification()
snapSpec.addVolume(sio.get_volume_by_name('volume_name'))
sio.create_snapshot(sio.get_system_id(), snapSpec)
# Consistency group Id can be found by parsing result from get_volume_by_name().
sio.delete_snapshot(sio.get_system_id(), 'consistency_group_id')
#Install cluster using 'private' IM API
#Look in examples/install-cluster-mac.py for a complete example
#print all statistics data:
pprint(sio.statistics)