@@ -1830,7 +1830,7 @@ def attach(self, sr_uuid, vdi_uuid):
1830
1830
return self ._attach_using_http_nbd ()
1831
1831
1832
1832
# Ensure we have a path...
1833
- self ._create_chain_paths (self .uuid )
1833
+ self .sr . _vhdutil . create_chain_paths (self .uuid )
1834
1834
1835
1835
self .attached = True
1836
1836
return VDI .VDI .attach (self , self .sr .uuid , self .uuid )
@@ -2357,7 +2357,7 @@ def _snapshot(self, snap_type, cbtlog=None, cbt_consistency=None):
2357
2357
raise xs_errors .XenError ('SnapshotChainTooLong' )
2358
2358
2359
2359
# 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 )
2361
2361
2362
2362
volume_path = self .path
2363
2363
if not util .pathexists (volume_path ):
@@ -2820,37 +2820,6 @@ def _detach_using_http_nbd(self):
2820
2820
self ._kill_persistent_nbd_server (volume_name )
2821
2821
self ._kill_persistent_http_server (volume_name )
2822
2822
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
-
2854
2823
# ------------------------------------------------------------------------------
2855
2824
2856
2825
0 commit comments