当前位置: 首页>>代码示例>>Python>>正文


Python VDC.get_storage_profile方法代码示例

本文整理汇总了Python中pyvcloud.vcd.vdc.VDC.get_storage_profile方法的典型用法代码示例。如果您正苦于以下问题:Python VDC.get_storage_profile方法的具体用法?Python VDC.get_storage_profile怎么用?Python VDC.get_storage_profile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyvcloud.vcd.vdc.VDC的用法示例。


在下文中一共展示了VDC.get_storage_profile方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_0002_add_vm

# 需要导入模块: from pyvcloud.vcd.vdc import VDC [as 别名]
# 或者: from pyvcloud.vcd.vdc.VDC import get_storage_profile [as 别名]
 def test_0002_add_vm(self):
     logged_in_org = self.client.get_org()
     org = Org(self.client, resource=logged_in_org)
     vdc_resource = org.get_vdc(self.config['vcd']['vdc'])
     vdc = VDC(self.client, href=vdc_resource.get('href'))
     assert self.config['vcd']['vdc'] == vdc.get_resource().get('name')
     vapp_resource = vdc.get_vapp(self.config['vcd']['vapp'])
     assert vapp_resource.get('name') == self.config['vcd']['vapp']
     vapp = VApp(self.client, resource=vapp_resource)
     catalog_item = org.get_catalog_item(self.config['vcd']['catalog'],
                                         self.config['vcd']['template'])
     source_vapp_resource = self.client.get_resource(
         catalog_item.Entity.get('href'))
     spec = {'source_vm_name': self.config['vcd']['vm'],
             'vapp': source_vapp_resource}
     spec['target_vm_name'] = self.config['vcd']['hostname']
     spec['hostname'] = self.config['vcd']['hostname']
     spec['network'] = self.config['vcd']['network']
     spec['ip_allocation_mode'] = self.config['vcd']['ip_allocation_mode']
     spec['storage_profile'] = vdc.get_storage_profile(
         self.config['vcd']['storage_profile'])
     vms = [spec]
     result = vapp.add_vms(vms)
     task = self.client.get_task_monitor().wait_for_status(
                         task=result,
                         timeout=60,
                         poll_frequency=2,
                         fail_on_statuses=None,
                         expected_target_statuses=[
                             TaskStatus.SUCCESS,
                             TaskStatus.ABORTED,
                             TaskStatus.ERROR,
                             TaskStatus.CANCELED],
                         callback=None)
     assert task.get('status') == TaskStatus.SUCCESS.value
开发者ID:rdbwebster,项目名称:pyvcloud,代码行数:37,代码来源:vcd_vapp_vm.py

示例2: test_020_get_storage_profile_by_name

# 需要导入模块: from pyvcloud.vcd.vdc import VDC [as 别名]
# 或者: from pyvcloud.vcd.vdc.VDC import get_storage_profile [as 别名]
    def test_020_get_storage_profile_by_name(self):
        logged_in_org = self.client.get_org()
        org = Org(self.client, resource=logged_in_org)
        vdc_resource = org.get_vdc(self.config['vcd']['vdc'])
        vdc = VDC(self.client, resource=vdc_resource)

        profile = vdc.get_storage_profile(
            self.config['vcd']['storage_profile_1_name'])

        assert profile.get('name') == \
            self.config['vcd']['storage_profile_1_name']
开发者ID:rdbwebster,项目名称:pyvcloud,代码行数:13,代码来源:vcd_storage_profile.py

示例3: add_vm

# 需要导入模块: from pyvcloud.vcd.vdc import VDC [as 别名]
# 或者: from pyvcloud.vcd.vdc.VDC import get_storage_profile [as 别名]
def add_vm(ctx, name, source_vapp, source_vm, catalog, target_vm, hostname,
           network, ip_allocation_mode, storage_profile, password_auto,
           accept_all_eulas):
    try:
        restore_session(ctx, vdc_required=True)
        client = ctx.obj['client']
        in_use_org_href = ctx.obj['profiles'].get('org_href')
        org = Org(client, in_use_org_href)
        vdc_href = ctx.obj['profiles'].get('vdc_href')
        vdc = VDC(client, href=vdc_href)
        source_vapp_resource = None
        if catalog is None:
            source_vapp_resource = vdc.get_vapp(source_vapp)
        else:
            catalog_item = org.get_catalog_item(catalog, source_vapp)
            source_vapp_resource = client.get_resource(
                catalog_item.Entity.get('href'))
        assert source_vapp_resource is not None
        vapp_resource = vdc.get_vapp(name)
        vapp = VApp(client, resource=vapp_resource)
        spec = {'source_vm_name': source_vm, 'vapp': source_vapp_resource}
        if target_vm is not None:
            spec['target_vm_name'] = target_vm
        if hostname is not None:
            spec['hostname'] = hostname
        if network is not None:
            spec['network'] = network
            spec['ip_allocation_mode'] = ip_allocation_mode
        if storage_profile is not None:
            spec['storage_profile'] = vdc.get_storage_profile(storage_profile)
        if password_auto is not None:
            spec['password_auto'] = password_auto
        task = vapp.add_vms([spec], all_eulas_accepted=accept_all_eulas)
        stdout(task, ctx)
    except Exception as e:
        stderr(e, ctx)
开发者ID:vmware,项目名称:vca-cli,代码行数:38,代码来源:vapp.py

示例4: get_storage_profile

# 需要导入模块: from pyvcloud.vcd.vdc import VDC [as 别名]
# 或者: from pyvcloud.vcd.vdc.VDC import get_storage_profile [as 别名]
    def get_storage_profile(self, profile_name):
        target_vdc = self.params.get('target_vdc')
        org_resource = Org(self.client, resource=self.client.get_org())
        vdc_resource = VDC(self.client, resource=org_resource.get_vdc(target_vdc))

        return vdc_resource.get_storage_profile(profile_name)
开发者ID:equinix-ms,项目名称:ansible-module-vcloud-director,代码行数:8,代码来源:vcd_vapp_vm.py


注:本文中的pyvcloud.vcd.vdc.VDC.get_storage_profile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。