@@ -42,24 +42,42 @@ def lvm_disks(host, sr_disks_for_all_hosts, provisioning_type):
42
42
host .ssh (['pvremove' , device ])
43
43
44
44
@pytest .fixture (scope = 'package' )
45
- def pool_with_linstor (hostA2 , lvm_disk , pool_with_saved_yum_state ):
45
+ def pool_with_linstor (hostA2 , lvm_disks , pool_with_saved_yum_state ):
46
+ import concurrent .futures
46
47
pool = pool_with_saved_yum_state
47
- for host in pool .hosts :
48
+
49
+ def check_linstor_installed (host ):
48
50
if host .is_package_installed (LINSTOR_PACKAGE ):
49
51
raise Exception (
50
52
f'{ LINSTOR_PACKAGE } is already installed on host { host } . This should not be the case.'
51
53
)
52
54
53
- for host in pool .hosts :
55
+ with concurrent .futures .ThreadPoolExecutor () as executor :
56
+ executor .map (check_linstor_installed , pool .hosts )
57
+
58
+ def install_linstor (host ):
59
+ logging .info (f"Installing { LINSTOR_PACKAGE } on host { host } ..." )
54
60
host .yum_install ([LINSTOR_RELEASE_PACKAGE ])
55
61
host .yum_install ([LINSTOR_PACKAGE ], enablerepo = "xcp-ng-linstor-testing" )
56
62
# Needed because the linstor driver is not in the xapi sm-plugins list
57
63
# before installing the LINSTOR packages.
58
64
host .ssh (["systemctl" , "restart" , "multipathd" ])
59
65
host .restart_toolstack (verify = True )
60
66
67
+ with concurrent .futures .ThreadPoolExecutor () as executor :
68
+ executor .map (install_linstor , pool .hosts )
69
+
61
70
yield pool
62
71
72
+ # Need to remove this package as we have separate run of `test_create_sr_without_linstor`
73
+ # for `thin` and `thick` `provisioning_type`.
74
+ def remove_linstor (host ):
75
+ logging .info (f"Cleaning up python-linstor from host { host } ..." )
76
+ host .yum_remove (["python-linstor" ])
77
+
78
+ with concurrent .futures .ThreadPoolExecutor () as executor :
79
+ executor .map (remove_linstor , pool .hosts )
80
+
63
81
@pytest .fixture (scope = 'package' )
64
82
def linstor_sr (pool_with_linstor ):
65
83
sr = pool_with_linstor .master .sr_create ('linstor' , 'LINSTOR-SR-test' , {
0 commit comments