@@ -1830,7 +1830,7 @@ def attach(self, sr_uuid, vdi_uuid):
18301830 return self ._attach_using_http_nbd ()
18311831
18321832 # Ensure we have a path...
1833- self ._create_chain_paths (self .uuid )
1833+ self .sr . _vhdutil . create_chain_paths (self .uuid )
18341834
18351835 self .attached = True
18361836 return VDI .VDI .attach (self , self .sr .uuid , self .uuid )
@@ -2357,7 +2357,7 @@ def _snapshot(self, snap_type, cbtlog=None, cbt_consistency=None):
23572357 raise xs_errors .XenError ('SnapshotChainTooLong' )
23582358
23592359 # Ensure we have a valid path if we don't have a local diskful.
2360- self ._create_chain_paths (self .uuid )
2360+ self .sr . _vhdutil . create_chain_paths (self .uuid )
23612361
23622362 volume_path = self .path
23632363 if not util .pathexists (volume_path ):
@@ -2820,37 +2820,6 @@ def _detach_using_http_nbd(self):
28202820 self ._kill_persistent_nbd_server (volume_name )
28212821 self ._kill_persistent_http_server (volume_name )
28222822
2823- def _create_chain_paths (self , vdi_uuid ):
2824- # OPTIMIZE: Add a limit_to_first_allocated_block param to limit vhdutil calls.
2825- # Useful for the snapshot code algorithm.
2826-
2827- while vdi_uuid :
2828- path = self ._linstor .get_device_path (vdi_uuid )
2829- if not util .pathexists (path ):
2830- raise xs_errors .XenError (
2831- 'VDIUnavailable' , opterr = 'Could not find: {}' .format (path )
2832- )
2833-
2834- # Diskless path can be created on the fly, ensure we can open it.
2835- def check_volume_usable ():
2836- while True :
2837- try :
2838- with open (path , 'r+' ):
2839- pass
2840- except IOError as e :
2841- if e .errno == errno .ENODATA :
2842- time .sleep (2 )
2843- continue
2844- if e .errno == errno .EROFS :
2845- util .SMlog ('Volume not attachable because RO. Openers: {}' .format (
2846- self .sr ._linstor .get_volume_openers (vdi_uuid )
2847- ))
2848- raise
2849- break
2850- util .retry (check_volume_usable , 15 , 2 )
2851-
2852- vdi_uuid = self .sr ._vhdutil .get_vhd_info (vdi_uuid ).parentUuid
2853-
28542823# ------------------------------------------------------------------------------
28552824
28562825
0 commit comments