本文整理汇总了Python中core.models.Instance.os_manager方法的典型用法代码示例。如果您正苦于以下问题:Python Instance.os_manager方法的具体用法?Python Instance.os_manager怎么用?Python Instance.os_manager使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core.models.Instance
的用法示例。
在下文中一共展示了Instance.os_manager方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: add_instance
# 需要导入模块: from core.models import Instance [as 别名]
# 或者: from core.models.Instance import os_manager [as 别名]
def add_instance(auth, fields):
user = authenticate(username=auth.get('username'),
password=auth.get('password'))
images = _get_images(fields.get('image'))
slices = _get_slices(fields.get('slice'))
deployment_networks = _get_deployment_networks(fields.get('deploymentNetwork'))
nodes = _get_nodes(fields.get('node'))
if images: fields['image'] = images[0]
if slices: fields['slice'] = slices[0]
if deployment_networks: fields['deploymentNetwork'] = deployment_networks[0]
if nodes: fields['node'] = nodes[0]
instance = Instance(**fields)
auth['tenant'] = instance.slice.name
instance.os_manager = OpenStackManager(auth=auth, caller = user)
instance.save()
return instance