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


Python AccountDriver.create_network方法代码示例

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


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

示例1: add_os_project_network

# 需要导入模块: from service.accounts.openstack import AccountDriver [as 别名]
# 或者: from service.accounts.openstack.AccountDriver import create_network [as 别名]
def add_os_project_network(core_identity, *args, **kwargs):
    try:
        logger.debug("add_os_project_network task started at %s." % datetime.now())
        from rtwo.accounts.openstack import AccountDriver as OSAccountDriver

        account_driver = OSAccountDriver(core_identity.provider)
        account_driver.create_network(core_identity)
        logger.debug("add_os_project_network task finished at %s." % datetime.now())
    except Exception as exc:
        add_os_project_network.retry(exc=exc)
开发者ID:420reich,项目名称:atmosphere,代码行数:12,代码来源:driver.py

示例2: network_init

# 需要导入模块: from service.accounts.openstack import AccountDriver [as 别名]
# 或者: from service.accounts.openstack.AccountDriver import create_network [as 别名]
def network_init(core_identity):
    provider_creds = core_identity.provider.get_credentials()
    if 'router_name' not in provider_creds.keys():
        logger.warn("ProviderCredential 'router_name' missing:"
                    "cannot create virtual network")
        return
    os_driver = OSAccountDriver(core_identity.provider)
    (network, subnet) = os_driver.create_network(core_identity)
    return (network, subnet)
开发者ID:zhanghaihua,项目名称:atmosphere,代码行数:11,代码来源:instance.py

示例3: _create_and_attach_port

# 需要导入模块: from service.accounts.openstack import AccountDriver [as 别名]
# 或者: from service.accounts.openstack.AccountDriver import create_network [as 别名]
def _create_and_attach_port(provider, driver, instance, core_identity):
    accounts = OSAccountDriver(core_identity.provider)
    tenant_id = instance.extra['tenantId']
    network_resources = accounts.network_manager.find_tenant_resources(tenant_id)
    network = network_resources['networks']
    if not network:
        network, subnet = accounts.create_network(core_identity)
    else:
        network = network[0]
        subnet = network_resources['subnets'][0]
    #new_fixed_ip = _get_next_fixed_ip(network_resources['ports'])
    #admin = accounts.admin_driver
    #port = accounts.network_manager.create_port(
    #    instance.id, network['id'], subnet['id'], new_fixed_ip, tenant_id)
    attached_intf = driver._connection.ex_attach_interface(instance.id, network['id'])
    return attached_intf
开发者ID:hariomrana,项目名称:atmosphere,代码行数:18,代码来源:instance.py


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