提交 9eeca27b 编写于 作者: X Xu Tian

qemu.tests: add new case for drive_mirroring test

negative test for cancel mirroring job that blocked by firewall;
Signed-off-by: NXu Tian <xutian@redhat.com>
上级 ee4d0db6
......@@ -136,3 +136,28 @@
before_start = "load_stress"
when_steady = "powerdown"
after_reopen ="verify_alive"
- cancel_blocked_jobs:
type = drive_mirror_cancel
cancel_timeout = 10
stop_firewall_cmd = "iptables -F"
post_command = "iptables -F"
variants:
- target_in_nfs:
target_image_type = nfs
nfs_mount_dir = "/mnt/nfs"
target_image_image1 = "${nfs_mount_dir}/target1"
nfs_mount_options = "rw"
export_dir = "/home/nfs"
export_options = "rw,no_root_squash,async"
setup_local_nfs = yes
start_firewall_cmd = "iptables -A INPUT -p tcp -d 127.0.0.1 --dport 2049 -j DROP"
- target_to_iscsi:
# target_image will ingore, target_image will generate automatically
target_image_type = iscsi
open_target_image = no
boot_target_image = yes
# Please replace below iscsi connection params before start your testing
portal_ip = "192.168.1.2"
initiator = "iqn.2010-07.test.org:kvmautotest"
start_firewall_cmd = "iptables -A INPUT -p tcp -d ${portal_ip} --dport 3260 -j DROP"
target = "iqn.2001-05.com.equallogic:0-8a0906-db31f7d03-470263b05654c204-kvm-test"
import logging
from autotest.client.shared import utils
from autotest.client.shared import error
from qemu.tests import drive_mirror
@error.context_aware
def run_drive_mirror_cancel(test, params, env):
"""
Test block mirroring functionality
1). boot vm then mirror $source_image to nfs/iscsi target
2). block nfs/iscsi serivce port via iptables rules
3). cancel block job and check it not cancel immedicatly
4). flush iptables chain then check job canceled in 10s
"""
tag = params.get("source_images", "image1")
mirror_test = drive_mirror.DriveMirror(test, params, env, tag)
try:
mirror_test.start()
error.context("Block network connection with iptables", logging.info)
utils.run(params["start_firewall_cmd"])
bg = utils.InterruptedThread(mirror_test.cancel,)
bg.start()
job = mirror_test.get_status()
if job["type"] != "mirror":
raise error.TestFail("Job cancel immediacatly")
error.context("Cleanup rules in iptables", logging.info)
utils.run(params["stop_firewall_cmd"])
bg.join(timeout=int(params["cancel_timeout"]))
finally:
mirror_test.vm.destroy()
mirror_test.clean()
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册