未验证 提交 25c3f93c 编写于 作者: Y YongxueHong 提交者: GitHub

Merge pull request #2215 from aliang123/1828140

blockdev_commit_install:commit during guest installation
import time
import logging
import random
from virttest import utils_test
from virttest import utils_misc
from virttest.tests import unattended_install
from provider.blockdev_commit_base import BlockDevCommitTest
class BlockdevCommitInstall(BlockDevCommitTest):
def configure_system_disk(self, tag):
pass
def run(test, params, env):
"""
Block commit base Test
1. Install guest
2. create 4 snapshots during guest installation
3. commit snapshot 3 to base
4. installation can be finished after commit
"""
def tag_for_install(vm, tag):
if vm.serial_console:
serial_output = vm.serial_console.get_output()
if tag in serial_output:
return True
logging.info("vm has not started yet")
return False
block_test = BlockdevCommitInstall(test, params, env)
args = (test, params, env)
bg = utils_test.BackgroundTest(unattended_install.run, args)
bg.start()
if bg.is_alive():
tag = params.get("tag_for_install_start", "Starting Login Service")
if utils_misc.wait_for(lambda: tag_for_install(block_test.main_vm, tag), 240, 10, 5):
logging.info("sleep random time before do snapshots")
time.sleep(random.randint(10, 120))
block_test.pre_test()
try:
block_test.commit_snapshots()
try:
bg.join(timeout=1200)
except Exception:
raise
reboot_method = params.get("reboot_method", "system_reset")
block_test.main_vm.reboot(method=reboot_method)
finally:
block_test.post_test()
else:
test.fail("Failed to install guest")
else:
test.fail("Installation failed to start")
- blockdev_commit_install:
type = blockdev_commit_install
virt_test_type = qemu
only Linux
need_install = yes
start_vm = no
image_name_image1 = "images/base_install"
boot_drive_stg = yes
medium = cdrom
installation = cdrom
kernel = vmlinuz
initrd = initrd.img
force_create_image_image1 = yes
image_aio = threads
unattended_delivery_method = cdrom
cdroms += " unattended"
index_enable = no
kill_vm = yes
shutdown_cleanly = no
storage_pools = default
storage_type_default = "directory"
storage_pool = default
snapshot_tags = sn1 sn2 sn3 sn4
image_name_sn1 = sn1
image_format_sn1 = qcow2
image_name_sn2 = sn2
image_format_sn2 = qcow2
image_name_sn3 = sn3
image_format_sn3 = qcow2
image_name_sn4 = sn4
image_format_sn4 = qcow2
device_tag = "image1"
rebase_mode = unsafe
qemu_force_use_drive_expression = no
no RHEL.5 RHEL.6 RHEL.7 RHEL.8.1
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册