def create_disk(client):
    logging.info('INIT create_disk')

    logged_in_org = client.get_org()
    org = Org(client, resource=logged_in_org)
    v = org.get_vdc('OVD2')
    if v is None:
        raise errors.VDCNotFoundError(vappInfo.vdc)
    vdc = VDC(client, href=v.get('href'))

    #task=vdc.delete_disk('disk01')

    result = vdc.add_disk('disk02', "100")
    logging.info('DONE create_disk %s', result)

    task = client.get_task_monitor().wait_for_status(
        task=result.Tasks.Task[0],
        timeout=60,
        poll_frequency=2,
        fail_on_status=None,
        expected_target_statuses=[
            TaskStatus.SUCCESS, TaskStatus.ABORTED, TaskStatus.ERROR,
            TaskStatus.CANCELED
        ],
        callback=task_callback)
    st = task.get('status')
    if st == TaskStatus.SUCCESS.value:
        logging.info("__LOG__ created DISK")
        #cresult.created = True
    else:
        raise errors.VCDDiskCreationError(
            etree.tostring(task, pretty_print=True))
def create_disk(client):
    logging.info('INIT create_disk')

    logged_in_org = client.get_org()
    org = Org(client, resource=logged_in_org)
    v = org.get_vdc('OVD2')
    if v is None:
        raise errors.VDCNotFoundError(vappInfo.vdc)
    vdc = VDC(client, href=v.get('href'))

    #task=vdc.delete_disk('disk01')

    result = vdc.add_disk('disk02', "100")
    logging.info('DONE create_disk %s', result)

    task = client.get_task_monitor().wait_for_status(task=result.Tasks.Task[0],
                                                     timeout=60,
                                                     poll_frequency=2,
                                                     fail_on_status=None,
                                                     expected_target_statuses=[
                                                         TaskStatus.SUCCESS,
                                                         TaskStatus.ABORTED,
                                                         TaskStatus.ERROR,
                                                         TaskStatus.CANCELED
                                                     ],
                                                     callback=task_callback)
    st = task.get('status')
    if st == TaskStatus.SUCCESS.value:
        logging.info("__LOG__ created DISK")
        #cresult.created = True
    else:
        raise errors.VCDDiskCreationError(
            etree.tostring(task, pretty_print=True))
Пример #3
0
    def test_012_add_disk(self):

        logged_in_org = self.client.get_org()

        org = Org(self.client, resource=logged_in_org)
        v = org.get_vdc(self.config['vcd']['vdc'])
        vdc = VDC(self.client, href=v.get('href'))

        taskObj = vdc.add_disk(self.config['vcd']['disk'], 10 * 1024 * 1024,
                               None, None, '10 MB Disk')
Пример #4
0
    def test_012_add_disk(self):

        logged_in_org = self.client.get_org()

        org = Org(self.client, resource=logged_in_org)
        v = org.get_vdc(self.config['vcd']['vdc'])
        vdc = VDC(self.client, href=v.get('href'))

        #taskObj = vdc.add_disk(self.config['vcd']['disk'], "10", None, None, '10 MB Disk', self.config['vcd']['storage_profile'])
        taskObj = vdc.add_disk(self.config['vcd']['disk'], "10", None, None,
                               '10 MB Disk')
Пример #5
0
def create(ctx, name, size, description, storage_profile):
    try:
        client = ctx.obj['client']
        vdc_href = ctx.obj['profiles'].get('vdc_href')
        vdc = VDC(client, href=vdc_href)
        disk_resource = vdc.add_disk(name=name,
                                     size=size,
                                     description=description,
                                     storage_profile_name=storage_profile)
        stdout(disk_resource.Tasks.Task[0], ctx)
    except Exception as e:
        stderr(e, ctx)