本文整理汇总了Python中cfme.infrastructure.virtual_machines.Vm.publish_to_template方法的典型用法代码示例。如果您正苦于以下问题:Python Vm.publish_to_template方法的具体用法?Python Vm.publish_to_template怎么用?Python Vm.publish_to_template使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cfme.infrastructure.virtual_machines.Vm
的用法示例。
在下文中一共展示了Vm.publish_to_template方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_vm_genealogy
# 需要导入模块: from cfme.infrastructure.virtual_machines import Vm [as 别名]
# 或者: from cfme.infrastructure.virtual_machines.Vm import publish_to_template [as 别名]
def test_vm_genealogy(
setup_provider, vm_name, provider_crud, provisioning, soft_assert, provider_mgmt, request):
"""Tests vm geneaology
Metadata:
test_flag: geneaology, provision
"""
original_template = provisioning["template"]
original_vm = Vm(vm_name, provider_crud, template_name=original_template)
original_vm.create_on_provider()
request.addfinalizer(
lambda: provider_mgmt.delete_vm(original_vm.name)
if provider_mgmt.does_vm_exist(original_vm.name) else None)
provider_mgmt.wait_vm_steady(original_vm.name)
first_template = original_vm.publish_to_template("{}x".format(vm_name))
soft_assert(isinstance(first_template, Template), "first_template is not a template!")
request.addfinalizer(
lambda: provider_mgmt.delete_vm(first_template.name)
if first_template.name in provider_mgmt.list_template() else None)
second_vm = Vm(
"{}x".format(first_template.name), provider_crud, template_name=first_template.name)
second_vm.create_on_provider()
request.addfinalizer(
lambda: provider_mgmt.delete_vm(second_vm.name)
if provider_mgmt.does_vm_exist(second_vm.name) else None)
soft_assert(isinstance(second_vm, Vm), "second_vm is a template!")
second_vm_ancestors = second_vm.genealogy.ancestors
# IT SEEMS IT "BREAKS" THE CHAIN WHEN THE VM IS CLONED TO A TEMPLATE
# soft_assert(original_vm.name in second_vm_ancestors, "{} is not in {}'s ancestors".format(
# original_vm.name, second_vm.name))
soft_assert(first_template.name in second_vm_ancestors, "{} is not in {}'s ancestors".format(
first_template.name, second_vm.name))