Exemple #1
0
 def my_connect(self, pOptions):
     status = False
     try:
         if pOptions is None or not isinstance(pOptions,
                                               emcScaleIOProtoOptions):
             pOptions = emcScaleIOProtoOptions()
         creds = None
         if isinstance(self.creds, UserCredentials):
             creds = self.creds
         if isinstance(self.creds, ProtocolCredentialsFactory):
             creds = self.creds.get(CredentialsEnum.User)
         if OMScaleIOPresent and creds:
             self.sio = ScaleIO("https://" + self.ipaddr + "/api",
                                creds.username, creds.password,
                                pOptions.verify_ssl, pOptions.debugLevel)
             status = True
     except:
         traceback.print_exc()
         status = False
     logger.debug(self.ref.name + '::connect(' + self.ipaddr + ', ' +
                  str(creds) + ")=" + str(status))
     return status
Exemple #2
0
from scaleiopy.scaleio import ScaleIO
from pprint import pprint
import sys

# How to run:
# python delete-volume.py ip-to-mdm user pass volume_name

# Whats this code doing:
# Unmaps specified volume from any SDCs using it and then delete the volume

sio = ScaleIO("https://" + sys.argv[1] + "/api",sys.argv[2],sys.argv[3],False,"ERROR") # HTTPS must be used as there seem to be an issue with 302 responses in Requests when using POST
    
sio.provisioning.delete_volume(sio.provisioning.get_volume_by_name(sys.argv[4]), 'ONLY_ME', autoUnmap=True)

pprint(sio.volumes)
Exemple #3
0
from scaleiopy.scaleio import ScaleIO
from pprint import pprint
import sys

# How to run:
# python create-snapshot-of-volume.py ip-to-gw user pass consistency_group_id

sio = ScaleIO("https://" + sys.argv[1] + "/api", sys.argv[2], sys.argv[3],
              False, "ERROR")

print "* Delete Snapshot"
result = sio.provisioning.delete_snapshot(sio.get_system_id(), sys.argv[4])
pprint(result)