本文整理匯總了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))