11import pytest
22
3+ import concurrent .futures
34import logging
5+ import threading
46import time
57
68from lib .commands import SSHCommandFailed
@@ -102,16 +104,14 @@ def test_linstor_missing(self, linstor_sr: SR, host: Host) -> None:
102104 @pytest .mark .reboot
103105 @pytest .mark .small_vm
104106 @pytest .mark .upgrade_test
105- def test_linstor_sr_pool_update (self , linstor_sr , vm_on_linstor_sr ) :
107+ def test_linstor_sr_pool_update (self , linstor_sr : SR , vm_on_linstor_sr : VM ) -> None :
106108 """
107109 Perform update on the Linstor SR pool hosts while ensuring VM availability.
108110 1. Identify all hosts in the SR pool and order them with the master first.
109111 2. Update all hosts if updates are available.
110- 3. Reboot all hosts.
112+ 3. Reboot updated hosts.
111113 4. Sequentially ensure that the VM can start on all hosts.
112114 """
113- import concurrent .futures , threading
114-
115115 sr = linstor_sr
116116 vm = vm_on_linstor_sr
117117 updates_applied = []
@@ -122,7 +122,7 @@ def test_linstor_sr_pool_update(self, linstor_sr, vm_on_linstor_sr):
122122
123123 # RPU is disabled for pools with XOSTOR SRs.
124124 # LINSTOR expects that we always use satellites and controllers with the same version on all hosts.
125- def install_updates_on (host ) :
125+ def install_updates_on (host : Host ) -> None :
126126 logging .info ("Checking on host %s" , host .hostname_or_ip )
127127 if host .has_updates (enablerepo = "xcp-ng-linstor-testing" ):
128128 host .install_updates (enablerepo = "xcp-ng-linstor-testing" )
@@ -135,11 +135,13 @@ def install_updates_on(host):
135135 executor .map (install_updates_on , hosts )
136136
137137 # Reboot updated hosts
138- def reboot_updated (host ) :
138+ def reboot_updated (host : Host ) -> None :
139139 host .reboot (verify = True )
140140
141- with concurrent .futures .ThreadPoolExecutor () as executor :
142- executor .map (reboot_updated , updates_applied )
141+ if updates_applied :
142+ with concurrent .futures .ThreadPoolExecutor () as executor :
143+ executor .map (reboot_updated , updates_applied )
144+ wait_for (sr .all_pbds_attached , "Wait for PBD attached" )
143145
144146 # Ensure VM is able to boot on all the hosts
145147 for h in hosts :
0 commit comments