]> git.proxmox.com Git - ceph.git/blob - ceph/qa/tasks/ceph_iscsi_client.py
import quincy beta 17.1.0
[ceph.git] / ceph / qa / tasks / ceph_iscsi_client.py
1 """
2 Set up ceph-iscsi client.
3 """
4 import logging
5 import contextlib
6 from textwrap import dedent
7
8 log = logging.getLogger(__name__)
9
10
11 @contextlib.contextmanager
12 def task(ctx, config):
13 """
14 Set up ceph-iscsi client.
15
16 tasks:
17 ceph_iscsi_client:
18 clients: [client.1]
19 """
20 log.info('Setting up ceph-iscsi client...')
21 for role in config['clients']:
22 (remote,) = (ctx.cluster.only(role).remotes.keys())
23
24 conf = dedent('''
25 InitiatorName=iqn.1994-05.com.redhat:client
26 ''')
27 path = "/etc/iscsi/initiatorname.iscsi"
28 remote.sudo_write_file(path, conf, mkdir=True)
29
30 # the restart is needed after the above change is applied
31 remote.run(args=['sudo', 'systemctl', 'restart', 'iscsid'])
32
33 remote.run(args=['sudo', 'modprobe', 'dm_multipath'])
34 remote.run(args=['sudo', 'mpathconf', '--enable'])
35 conf = dedent('''
36 devices {
37 device {
38 vendor "LIO-ORG"
39 product "TCMU device"
40 hardware_handler "1 alua"
41 path_grouping_policy "failover"
42 path_selector "queue-length 0"
43 failback 60
44 path_checker tur
45 prio alua
46 prio_args exclusive_pref_bit
47 fast_io_fail_tmo 25
48 no_path_retry queue
49 }
50 }
51 ''')
52 path = "/etc/multipath.conf"
53 remote.sudo_write_file(path, conf, append=True)
54 remote.run(args=['sudo', 'systemctl', 'start', 'multipathd'])
55
56 yield