@@ -20,12 +20,6 @@ def __str__(self):
20
20
)
21
21
22
22
23
- def format_drivers (nodes ):
24
- cmd = r"sudo find /dev/disk/ -path '*/by-partlabel/kikimr_*' " \
25
- r"-exec dd if=/dev/zero of={} bs=1M count=1 status=none \;"
26
- nodes .execute_async (cmd )
27
-
28
-
29
23
class Slice :
30
24
def __init__ (self , components , nodes , cluster_details , configurator , do_clear_logs , args , walle_provider ):
31
25
self .slice_kikimr_path = '/Berkanavt/kikimr/bin/kikimr'
@@ -56,9 +50,30 @@ def _clear_logs(self):
56
50
"sudo service rsyslog start;"
57
51
self .nodes .execute_async (cmd )
58
52
53
+ def _get_all_drives (self ):
54
+ result = []
55
+ for host in self .cluster_details .hosts :
56
+ for drive in host .drives :
57
+ result .append ((host .hostname , drive .path ))
58
+ return result
59
+
60
+ def _format_drives (self ):
61
+ tasks = []
62
+ for (host_name , drive_path ) in self ._get_all_drives ():
63
+ cmd = "dd if=/dev/zero of={} bs=1M count=1 status=none conv=notrunc" .format (drive_path )
64
+ tasks .extend (self .nodes .execute_async_ret (cmd , nodes = [host_name ]))
65
+ self .nodes ._check_async_execution (tasks )
66
+
67
+ def _check_drives_exist (self ):
68
+ tasks = []
69
+ for (host_name , drive_path ) in self ._get_all_drives ():
70
+ cmd = "echo 'Check existance of drive' && test -f {}" .format (drive_path )
71
+ tasks .extend (self .nodes .execute_async_ret (cmd , nodes = [host_name ]))
72
+ self .nodes ._check_async_execution (tasks )
73
+
59
74
def slice_format (self ):
60
75
self .slice_stop ()
61
- format_drivers ( self .nodes )
76
+ self ._format_drives ( )
62
77
self .slice_start ()
63
78
64
79
def slice_clear (self ):
@@ -69,7 +84,7 @@ def slice_clear(self):
69
84
self ._clear_slot (slot )
70
85
71
86
if 'kikimr' in self .components :
72
- format_drivers ( self .nodes )
87
+ self ._format_drives ( )
73
88
74
89
def _invoke_scripts (self , dynamic_cfg_path , scripts ):
75
90
for script_name in scripts :
@@ -117,7 +132,8 @@ def slice_install(self):
117
132
self ._clear_logs ()
118
133
119
134
if 'kikimr' in self .components :
120
- format_drivers (self .nodes )
135
+ self ._check_drives_exist ()
136
+ self ._format_drives ()
121
137
122
138
if 'bin' in self .components .get ('kikimr' , []):
123
139
self ._update_kikimr (self .nodes , self .configurator .kikimr_bin , self .configurator .kikimr_compressed_bin )
0 commit comments