Exemple #1
0
def create_snapshot(config):
    client = config.create_api_client()
    request = CreateSnapshotRequest.CreateSnapshotRequest()
    request.set_DiskId(config.get('DiskId'))
    result = do_action(client, request)
    SnapshotId= result['SnapshotId']
    config.set('SnapshotId', SnapshotId)
Exemple #2
0
    def create_snapshot(self, disk_id, snap_name, tags, description):
        request = CreateSnapshotRequest.CreateSnapshotRequest()
        request.set_DiskId(disk_id)
        request.set_SnapshotName(snap_name)
        request.set_Tags(tags)
        request.set_Description(description)

        response = self.client.do_action_with_exception(request)
        response_dic = json.loads(response)
        return response_dic
Exemple #3
0
 def create_snapshot(self, disk_id):
     request = CreateSnapshotRequest.CreateSnapshotRequest()
     request.set_action_name('CreateSnapshot')
     request.set_DiskId(disk_id)
     try:
         response = self.asc_client.do_action_with_exception(request)
     except acs_exception.exceptions.ServerException as err:
         log.error('\t Fail to create snapshot: %s' % str(err))
         return None
     snapshot = json.loads(response.decode())
     log.info('\t Snapshot created for disk %s' % disk_id)
     return snapshot
Exemple #4
0
 def create_Snapshots(self, DiskId, SnapshotName):
     try:
         request = CreateSnapshotRequest.CreateSnapshotRequest()
         request.set_accept_format('json')
         request.set_action_name('CreateSnapshot')
         request.set_DiskId(DiskId)
         request.set_SnapshotName(SnapshotName)
         results = json.loads(self.client.do_action_with_exception(request))
         return results['SnapshotId']
     except Exception as e:
         logging.info(e)
         return {}