Ejemplo n.º 1
0
 def create_disk(self):
     request = CreateDiskRequest.CreateDiskRequest()
     key_list = ["ZoneId", "DiskName", "DiskCategory", "Size"]
     self.vm_params.setdefault("DiskCategory",
                               self.vm_params['DiskCategory'])
     request = self._add_params(request, key_list, self.vm_params)
     return self._send_request(request)
Ejemplo n.º 2
0
def create_disk_from_snapshot(config):
    client = config.create_api_client()
    request = CreateDiskRequest.CreateDiskRequest()
    request.set_DiskName("ml-data-disk")
    request.set_DiskCategory("cloud_ssd")
    request.set_SnapshotId(config.get('SnapshotId'))
    request.set_ZoneId(config.get(['CreateInstanceParams', 'ZoneId']))
    result = do_action(client, request)
    DiskId = result['DiskId']
    config.set('DiskId', DiskId)
Ejemplo n.º 3
0
def create_empty_disk(config):
    client = config.create_api_client()
    request = CreateDiskRequest.CreateDiskRequest()
    request.set_DiskName("ml-data-disk")
    request.set_DiskCategory("cloud_ssd")
    request.set_ZoneId(config.get(['CreateInstanceParams', 'ZoneId']))
    size = click.prompt('请设置你的磁盘大小, 单位 GB, 必须大于20:', default=30, type=int)
    request.set_Size(size)
    result = do_action(client, request)
    DiskId = result['DiskId']
    config.set('DiskId', DiskId)
Ejemplo n.º 4
0
def create_empty_disk(config):
    client = config.create_api_client()
    request = CreateDiskRequest.CreateDiskRequest()
    request.set_DiskName("ml-data-disk")
    request.set_DiskCategory("cloud_ssd")
    request.set_ZoneId(config.get(['CreateInstanceParams', 'ZoneId']))
    size = click.prompt('Set storage sizing (GB), must be more than 20 GB:',
                        default=30,
                        type=int)
    request.set_Size(size)
    result = do_action(client, request)
    DiskId = result['DiskId']
    config.set('DiskId', DiskId)