@@ -11,7 +11,7 @@ use crate::{
11
11
use clap:: Parser ;
12
12
use ic_base_types:: SubnetId ;
13
13
use ic_recovery:: {
14
- cli:: { consent_given, read_optional} ,
14
+ cli:: { consent_given, read_optional, wait_for_confirmation } ,
15
15
error:: { RecoveryError , RecoveryResult } ,
16
16
recovery_iterator:: RecoveryIterator ,
17
17
recovery_state:: { HasRecoveryState , RecoveryState } ,
@@ -22,9 +22,10 @@ use ic_recovery::{
22
22
use ic_registry_routing_table:: CanisterIdRange ;
23
23
use ic_state_manager:: manifest:: { manifest_from_path, manifest_hash} ;
24
24
use serde:: { Deserialize , Serialize } ;
25
- use slog:: Logger ;
25
+ use slog:: { info , warn , Logger } ;
26
26
use strum:: { EnumMessage , IntoEnumIterator } ;
27
27
use strum_macros:: { EnumIter , EnumString } ;
28
+ use url:: Url ;
28
29
29
30
use std:: { iter:: Peekable , net:: IpAddr , path:: PathBuf } ;
30
31
@@ -282,6 +283,31 @@ impl RecoveryIterator<StepType, StepTypeIter> for SubnetSplitting {
282
283
fn read_step_params ( & mut self , step_type : StepType ) {
283
284
match step_type {
284
285
StepType :: HaltSourceSubnetAtCupHeight => {
286
+ let url = match self . recovery . registry_helper . latest_registry_version ( ) {
287
+ Ok ( registry_version) => {
288
+ format ! (
289
+ "https://grafana.mainnet.dfinity.network/d/cB-qtJX4k/subnet-splitting-pre-flight?var-datasource=IC+Metrics&var-ic=mercury&var-ic_subnet={}&var-registry_version={}" ,
290
+ self . params. destination_subnet_id, registry_version
291
+ )
292
+ }
293
+ Err ( err) => {
294
+ warn ! (
295
+ self . logger,
296
+ "Failed to get the latest registry version: {}" , err
297
+ ) ;
298
+ format ! (
299
+ "https://grafana.mainnet.dfinity.network/d/cB-qtJX4k/subnet-splitting-pre-flight?var-datasource=IC+Metrics&var-ic=mercury&var-ic_subnet={}" ,
300
+ self . params. destination_subnet_id
301
+ )
302
+ }
303
+ } ;
304
+
305
+ print_url_and_ask_for_confirmation (
306
+ & self . logger ,
307
+ url,
308
+ "Please check the dashboard to see if it is safe to begin subnet splitting" ,
309
+ ) ;
310
+
285
311
if self . params . pub_key . is_none ( ) {
286
312
self . params . pub_key = read_optional (
287
313
& self . logger ,
@@ -320,6 +346,34 @@ impl RecoveryIterator<StepType, StepTypeIter> for SubnetSplitting {
320
346
}
321
347
}
322
348
349
+ StepType :: UnhaltDestinationSubnet | StepType :: CompleteCanisterMigration => {
350
+ let url = match self . recovery . registry_helper . latest_registry_version ( ) {
351
+ Ok ( registry_version) => {
352
+ format ! (
353
+ "https://grafana.mainnet.dfinity.network/d/K08U69_4k/subnet-splitting?var-datasource=IC+Metrics&var-ic=mercury&var-ic_subnet={}&var-registry_version={}" ,
354
+ self . params. source_subnet_id, registry_version
355
+ )
356
+ }
357
+ Err ( err) => {
358
+ warn ! (
359
+ self . logger,
360
+ "Failed to get the latest registry version: {}" , err
361
+ ) ;
362
+ format ! (
363
+ "https://grafana.mainnet.dfinity.network/d/K08U69_4k/subnet-splitting?var-datasource=IC+Metrics&var-ic=mercury&var-ic_subnet={}" ,
364
+ self . params. source_subnet_id,
365
+ )
366
+ }
367
+ } ;
368
+
369
+ print_url_and_ask_for_confirmation (
370
+ & self . logger ,
371
+ url,
372
+ "Please check the dashboard to see if it is safe to unhalt the \
373
+ destination subnet and/or remove the canister migrations entry",
374
+ ) ;
375
+ }
376
+
323
377
_ => ( ) ,
324
378
}
325
379
}
@@ -453,3 +507,20 @@ impl HasRecoveryState for SubnetSplitting {
453
507
} )
454
508
}
455
509
}
510
+
511
+ fn print_url_and_ask_for_confirmation (
512
+ logger : & Logger ,
513
+ url : String ,
514
+ text_to_display : impl std:: fmt:: Display ,
515
+ ) {
516
+ match Url :: parse ( & url) {
517
+ Ok ( url) => {
518
+ info ! ( logger, "{}" , text_to_display) ;
519
+ info ! ( logger, "{}" , url) ;
520
+ wait_for_confirmation ( logger) ;
521
+ }
522
+ Err ( err) => {
523
+ warn ! ( logger, "Failed to parse url {}: {}" , url, err) ;
524
+ }
525
+ }
526
+ }
0 commit comments