本文整理汇总了Python中nova.virt.xenapi.vm_utils.VMHelper.compile_info方法的典型用法代码示例。如果您正苦于以下问题:Python VMHelper.compile_info方法的具体用法?Python VMHelper.compile_info怎么用?Python VMHelper.compile_info使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nova.virt.xenapi.vm_utils.VMHelper
的用法示例。
在下文中一共展示了VMHelper.compile_info方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: list_instances_detail
# 需要导入模块: from nova.virt.xenapi.vm_utils import VMHelper [as 别名]
# 或者: from nova.virt.xenapi.vm_utils.VMHelper import compile_info [as 别名]
def list_instances_detail(self):
"""List VM instances, returning InstanceInfo objects."""
instance_infos = []
for vm_ref in self._session.get_xenapi().VM.get_all():
vm_rec = self._session.get_xenapi().VM.get_record(vm_ref)
if not vm_rec["is_a_template"] and not vm_rec["is_control_domain"]:
name = vm_rec["name_label"]
# TODO(justinsb): This a roundabout way to map the state
openstack_format = VMHelper.compile_info(vm_rec)
state = openstack_format['state']
instance_info = driver.InstanceInfo(name, state)
instance_infos.append(instance_info)
return instance_infos
示例2: get_info
# 需要导入模块: from nova.virt.xenapi.vm_utils import VMHelper [as 别名]
# 或者: from nova.virt.xenapi.vm_utils.VMHelper import compile_info [as 别名]
def get_info(self, instance):
"""Return data about VM instance"""
vm = self._get_vm_opaque_ref(instance)
rec = self._session.get_xenapi().VM.get_record(vm)
return VMHelper.compile_info(rec)