@@ -169,7 +169,7 @@ def __init__(self, session, linstor):
169169 self ._session = session
170170 self ._linstor = linstor
171171
172- def create_chain_paths (self , vdi_uuid , readonly = False ):
172+ def create_chain_paths (self , vdi_uuid , readonly = False , cb_openers = None ):
173173 # OPTIMIZE: Add a limit_to_first_allocated_block param to limit vhdutil calls.
174174 # Useful for the snapshot code algorithm.
175175
@@ -192,9 +192,10 @@ def check_volume_usable():
192192 time .sleep (2 )
193193 continue
194194 if e .errno == errno .EROFS or e .errno == errno .EMEDIUMTYPE :
195- util .SMlog ('Volume not attachable because used. Openers: {}' .format (
196- self ._linstor .get_volume_openers (vdi_uuid )
197- ))
195+ openers = self ._linstor .get_volume_openers (vdi_uuid )
196+ util .SMlog (f'Volume not attachable because RO. Openers: { openers } ' )
197+ if cb_openers :
198+ cb_openers (vdi_uuid , openers )
198199 raise
199200 break
200201 util .retry (check_volume_usable , 15 , 2 )
@@ -554,7 +555,7 @@ def _call_method(self, local_method, remote_method, device_path, use_parent, *ar
554555 # B.3. Call!
555556 def remote_call ():
556557 try :
557- all_openers = self ._linstor .get_volume_openers (openers_uuid )
558+ openers = self ._linstor .get_volume_openers (openers_uuid )
558559 except Exception as e :
559560 raise xs_errors .XenError (
560561 'VDIUnavailable' ,
@@ -563,8 +564,8 @@ def remote_call():
563564 )
564565
565566 no_host_found = True
566- for hostname , openers in all_openers .items ():
567- if not openers :
567+ for hostname , host_openers in all_openers .items ():
568+ if not host_openers :
568569 continue
569570
570571 host_ref = self ._find_host_ref_from_hostname (hosts , hostname )
0 commit comments