本文整理汇总了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)
示例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)
示例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