Skip to content

Commit bd4d19e

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

File tree

2 files changed

+64
-0
lines changed

2 files changed

+64
-0
lines changed

qemu/tests/cfg/multi_targets.cfg

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
- multi_targets:
2+
virt_test_type = qemu
3+
type = multi_targets
4+
only Windows
5+
start_vm = no
6+
kill_vm = yes
7+
kill_vm_gracefully = yes
8+
shutdown_cleanly = no
9+
reboot_method = shell
10+
11+
iscsi_targets_luns = '{
12+
"luns" : {
13+
"xxxx": {
14+
"iscsi_backend": "fileio"
15+
"emulated_image": "images/basefile001",
16+
"emulated_image_size": "100M",
17+
"iscsi_lun_attrs": "block_size=4096",
18+
},
19+
"xxxx2": {
20+
"iscsi_backend": "fileio"
21+
"emulated_image": "images/basefile002",
22+
"emulated_image_size": "100M",
23+
"iscsi_lun_attrs": "block_size=4096",
24+
},
25+
},
26+
"targets" : {
27+
"iqn.xxxx:newiscsi01": {
28+
"portal_ip": "127.0.0.1",
29+
"binding_luns" : ["xxxx"],
30+
},
31+
"iqn.xxxx:newiscsi02": {
32+
"portal_ip": "127.0.0.1",
33+
"binding_luns" : ["xxxx2"],
34+
},
35+
},
36+
}'

qemu/tests/multi_targets.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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+
iscsi = Iscsi.create_iSCSI(params, base_dir)
16+
iscsi.login() # or iscsi.login(target=xxx)
17+
# iscsi.export_target()
18+
# or
19+
# iscsi.export_target(target=xxx)
20+
targets = iscsi.query_targets() # or iscsi.query_targets(target=xxx)
21+
test.log.debug("iscsi.query_targets() returns: ")
22+
test.log.debug(str(targets))
23+
24+
dev_name = iscsi.get_device_names() # or iscsi.get_device_names(target=xxx)
25+
test.log.debug("iscsi.get_device_names() returns: ")
26+
test.log.debug(str(dev_name))
27+
28+
iscsi.cleanup()

0 commit comments

Comments
 (0)