In this post I´ll go through the basics of how to use ScaleIO-py. Lets start with the Hello World example to demonstrate we can connect to ScaleIO and verify that all is working properly. In order for this to work you should already have a working ScaleIO cluster running.

The very first thing we need to do is to instantiate a ‘ScaleIO’ object which we´ll use for all further interaction with ScaleIO using its REST API.

Below code example will connect to your ScaleIO cluster and print out system, sdc, sds, volumes and protection domain information using pprint to make the JSON data output look at bit nicer and easier to read.

from scaleiopy import scaleio
from pprint import pprint

sio = scaleio.ScaleIO("https://" + "your-ip" + "/api", "username", "password" ,verify_ssl=False)
pprint(sio.system)
pprint(sio.sdc)
pprint(sio.sds)
pprint(sio.volumes)
pprint(sio.protection_domains)

The ScaleIO class take three mandatory parameters ‘scaleio.ScaleIO(url-tog-gateway, username, password)’ and optional parameters passed to the class as kwargs. Only ‘verify_ssl’ is interpreted. Its sole purpose is to disable ssl certification validation.

Once you have logged in to ScaleIO you can start retrieving information from the cluster. No data is cached, so wheever you interact with the remote API there´s is one or more requests executed inside the ScaleIO class. To get information of all ScaleIO Data Servers (SDS) you can use pprint on the sds object. It´ll issue a get request and returns a JSON array that contain information of each SDS in your cluster.

pprint (sio.sds)

There´s a examples directory in git that contain many more examples of how to use ScaleIO-py.

In the next part I´ll go through how to create Volumes and how the different data structures look like that ScaleIO API return when interacting with it.


swevm

Here I will write about things close to my heart and passion. It won't necessarily be all technical but most likely.