@@ -18,6 +18,7 @@ def add_options(p):
18
18
p .add_argument ('--enable-pdisk-encryption-keys-changes' , action = 'store_true' , help = 'Enable changes of PDisk encryption keys' )
19
19
p .add_argument ('--enable-kill-tablets' , action = 'store_true' , help = 'Enable tablet killer' )
20
20
p .add_argument ('--enable-kill-blob-depot' , action = 'store_true' , help = 'Enable BlobDepot killer' )
21
+ p .add_argument ('--enable-restart-pdisks' , action = 'store_true' , help = 'Enable PDisk restarter' )
21
22
p .add_argument ('--kill-signal' , type = str , default = 'KILL' , help = 'Kill signal to send to restart node' )
22
23
23
24
@@ -144,6 +145,19 @@ def do_restart(node_id):
144
145
if args .enable_pdisk_encryption_keys_changes :
145
146
remove_old_pdisk_keys (pdisk_keys , pdisk_key_versions , node_id )
146
147
148
+ def do_restart_pdisk (node_id , pdisk_id ):
149
+ assert can_act_on_vslot (node_id , pdisk_id )
150
+ request = common .kikimr_bsconfig .TConfigRequest (IgnoreDegradedGroupsChecks = True )
151
+ cmd = request .Command .add ().RestartPDisk
152
+ cmd .TargetPDiskId .NodeId = node_id
153
+ cmd .TargetPDiskId .PDiskId = pdisk_id
154
+ try :
155
+ response = common .invoke_bsc_request (request )
156
+ except Exception as e :
157
+ raise Exception ('failed to perform restart request: %s' % e )
158
+ if not response .Success :
159
+ raise Exception ('Unexpected error from BSC: %s' % response .ErrorDescription )
160
+
147
161
def do_evict (vslot_id ):
148
162
assert can_act_on_vslot (* vslot_id )
149
163
try :
@@ -230,13 +244,16 @@ def do_kill_blob_depot():
230
244
wipes = []
231
245
readonlies = []
232
246
unreadonlies = []
247
+ pdisk_restarts = []
233
248
234
249
for vslot in base_config .VSlot :
235
250
if common .is_dynamic_group (vslot .GroupId ):
236
251
vslot_id = common .get_vslot_id (vslot .VSlotId )
237
252
vdisk_id = '[%08x:%d:%d:%d]' % (vslot .GroupId , vslot .FailRealmIdx , vslot .FailDomainIdx , vslot .VDiskIdx )
238
253
if vslot_id in vslot_readonly and not args .disable_readonly :
239
254
unreadonlies .append (('un-readonly vslot id: %s, vdisk id: %s' % (vslot_id , vdisk_id ), (do_readonly , vslot , False )))
255
+ if can_act_on_vslot (* vslot_id [:2 ]) and args .enable_restart_pdisks :
256
+ pdisk_restarts .append (('restart pdisk node_id: %d, pdisk_id: %d' % vslot_id [:2 ], (do_restart_pdisk , * vslot_id [:2 ])))
240
257
if can_act_on_vslot (* vslot_id ) and (recent_restarts or args .disable_restarts ):
241
258
if not args .disable_evicts :
242
259
evicts .append (('evict vslot id: %s, vdisk id: %s' % (vslot_id , vdisk_id ), (do_evict , vslot_id )))
@@ -258,6 +275,8 @@ def pick(v):
258
275
possible_actions .append (('readonly' , (pick , readonlies )))
259
276
if unreadonlies :
260
277
possible_actions .append (('un-readonly' , (pick , unreadonlies )))
278
+ if pdisk_restarts :
279
+ possible_actions .append (('restart-pdisk' , (pick , pdisk_restarts )))
261
280
262
281
restarts = []
263
282
0 commit comments