Exemplo n.º 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
Exemplo n.º 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)
Exemplo n.º 3
0
from scaleiopy.scaleio import ScaleIO
from pprint import pprint
import sys

# How to run:
# python create_mapall-volume.py ip-to-mdm user pass volume_name size_mb protection_domain_name storage_pool_name

# Whats this code doing:
# Create a volume of x MB [min 8192MB] inside specified protectiondomain and storagepool, then map it to all registered SDCs

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.create_volume(sys.argv[4], sys.argv[5], sio.get_pd_by_name(sys.argv[6]), sio.get_storage_pool_by_name(sys.argv[7]), enableMapAllSdcs=True)

pprint(sio.volumes)
Exemplo n.º 4
0
from scaleiopy.scaleio import ScaleIO
from scaleiopy.api.scaleio.mapping.snapshotspecification import SIO_SnapshotSpecification
from pprint import pprint
import sys

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

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.create_volume_by_pd_name(sys.argv[4], 8192, sio.get_pd_by_name(sys.argv[5]), mapAll=True)
#pprint(sio.volumes)

snapSpec = SIO_SnapshotSpecification()
snapSpec.addVolume(sio.provisioning.get_volume_by_name(sys.argv[4]))
print "**********"
print "* Volume *"
print "**********"
pprint(sio.provisioning.get_volume_by_name(sys.argv[4]))

print "**********************"
print "Snapshot specification"
print "**********************"
pprint(snapSpec)

print "* Creating Snapshot"
#print "systemId = " + str(sio.get_system_id())
#pprint (sio.get_system_id())
result = sio.provisioning.create_snapshot(sio.get_system_id(), snapSpec)
Exemplo n.º 5
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)


Exemplo n.º 6
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)
from scaleiopy.scaleio import ScaleIO
from scaleiopy.api.scaleio.mapping.snapshotspecification import SIO_SnapshotSpecification
from pprint import pprint
import sys

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

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.create_volume_by_pd_name(sys.argv[4], 8192, sio.get_pd_by_name(sys.argv[5]), mapAll=True)
#pprint(sio.volumes)


snapSpec = SIO_SnapshotSpecification()
snapSpec.addVolume(sio.provisioning.get_volume_by_name(sys.argv[4]))
print "**********"
print "* Volume *"
print "**********"
pprint (sio.provisioning.get_volume_by_name(sys.argv[4]))

print "**********************"
print "Snapshot specification"
print "**********************"
pprint (snapSpec)

print "* Creating Snapshot"
#print "systemId = " + str(sio.get_system_id())
#pprint (sio.get_system_id())
result = sio.provisioning.create_snapshot(sio.get_system_id(), snapSpec)
pprint (result)
Exemplo n.º 8
0
from scaleiopy.scaleio import ScaleIO
from pprint import pprint
import sys

# How to run:
# python create_mapall-volume.py ip-to-mdm user pass volume_name size_mb protection_domain_name storage_pool_name

# Whats this code doing:
# Create a volume of x MB [min 8192MB] inside specified protectiondomain and storagepool, then map it to all registered SDCs

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.create_volume(sys.argv[4],
                  sys.argv[5],
                  sio.get_pd_by_name(sys.argv[6]),
                  sio.get_storage_pool_by_name(sys.argv[7]),
                  enableMapAllSdcs=True)

pprint(sio.volumes)