Skip to content

Commit e42c20b

Browse files
committed
[Draft] Test only
Signed-off-by: Houqi (Nick) Zuo <[email protected]>
1 parent 3e7fbd7 commit e42c20b

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed

qemu/tests/cfg/multi_targets.cfg

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
- multi_targets:
2+
virt_test_type = qemu
3+
type = multi_targets
4+
start_vm = no
5+
kill_vm = yes
6+
kill_vm_gracefully = yes
7+
shutdown_cleanly = no
8+
reboot_method = shell
9+
10+
iscsi_target_backstores = bs1 bs2
11+
iscsi_target_backstores_bs1 = '{"backend": "fileio","emulated_image": "images/basefile001","emulated_image_size": "90M","attrs": "block_size=4096",}'
12+
iscsi_target_backstores_bs2 = '{"backend": "fileio","emulated_image": "images/basefile002","emulated_image_size": "50M","attrs": "block_size=4096",}'
13+
14+
t1 = iqn.xxxx:newiscsi01
15+
t2 = iqn.xxxx:newiscsi02
16+
iscsi_targets = t1 t2
17+
iscsi_targets_t1 = '{"portal_ip": ["127.0.0.1"],'
18+
iscsi_targets_t1 += '"attrs": "authentication=0 demo_mode_write_protect=0 generate_node_acls=1 cache_dynamic_acls=1",'
19+
iscsi_targets_t1 += '"binding_basckstores" : ["bs1"],}'
20+
21+
iscsi_targets_t2 = '{"portal_ip": ["127.0.0.1"],'
22+
iscsi_targets_t2 += '"binding_basckstores" : ["bs2"],}'

qemu/tests/multi_targets.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
from virttest import data_dir
2+
from virttest.iscsi import Iscsi
3+
4+
5+
def run(test, params, env):
6+
"""
7+
Usage of multi-targets iscsi.
8+
9+
10+
:param test: QEMU test object.
11+
:param params: Dictionary with the test parameters.
12+
:param env: Dictionary with test environment.
13+
"""
14+
base_dir = data_dir.get_data_dir()
15+
mgr = Iscsi.create_iSCSI(params, base_dir)
16+
mgr.export_target() # or mgr.export_target(target=xxx)
17+
mgr.login() # or iscsi.login(target=xxx)
18+
targets = mgr.query_targets() # or iscsi.query_targets(target=xxx)
19+
test.log.debug("mgr.query_targets() returns: ")
20+
test.log.debug(str(targets))
21+
22+
dev_name = mgr.get_device_names() # or iscsi.get_device_names(target=xxx)
23+
test.log.debug("mgr.get_device_names() returns: ")
24+
test.log.debug(str(dev_name))
25+
mgr.logout()
26+
27+
mgr.cleanup()

0 commit comments

Comments
 (0)