@@ -607,86 +607,6 @@ def cmd_kdump_num_dumps(verbose, num_dumps):
607
607
kdump_memory = get_kdump_memory ()
608
608
save_config (kdump_enabled , kdump_memory , num_dumps )
609
609
610
- ## Command: Display kdump status
611
- def cmd_kdump_status ():
612
- print ('Kdump Administrative Mode: ' , end = '' )
613
- kdump_enabled = get_kdump_administrative_mode ()
614
- if kdump_enabled :
615
- print ('Enabled' )
616
- else :
617
- print ('Disabled' )
618
-
619
- print ('Kdump Operational State: ' , end = '' )
620
- (rc , lines , err_str ) = run_command ("/usr/sbin/kdump-config status" , use_shell = False );
621
- if len (lines ) >= 1 and ": ready to kdump" in lines [0 ]:
622
- use_kdump_in_cfg = read_use_kdump ()
623
- if use_kdump_in_cfg :
624
- print ('Ready' )
625
- else :
626
- print ('Not Ready' )
627
- elif not kdump_enabled :
628
- print ('Disabled' )
629
- else :
630
- print ('Ready after Reboot' )
631
-
632
- ## Get the current number of kernel dump files stored
633
- #
634
- # @param The number of kdump files stored in /var/crash
635
- def get_nb_dumps_in_var_crash ():
636
- (rc , lines , err_str ) = run_command ("find /var/crash/ -name 'kdump.*'" , use_shell = False );
637
- if rc == 0 :
638
- return len (lines )
639
- return 0
640
-
641
- ## Command: Display kdump files
642
- def cmd_kdump_files ():
643
- nb_dumps = get_nb_dumps_in_var_crash ()
644
- if nb_dumps == 0 :
645
- print ("No kernel core dump files" )
646
- else :
647
- (rc1 , lines1 , err_str ) = run_command ("find /var/crash/ -name 'dmesg.*'" , use_shell = False );
648
- lines1 .sort (reverse = True )
649
- (rc2 , lines2 , err_str ) = run_command ("find /var/crash/ -name 'kdump.*'" , use_shell = False );
650
- lines2 .sort (reverse = True )
651
- print ("Record Key Filename" )
652
- print ("-------------------------------------------------------------" )
653
- for n in range (len (lines1 )):
654
- print ("%6d %s %s\n %s" % (n + 1 , lines1 [n ][11 :23 ], lines1 [n ], lines2 [n ]))
655
-
656
- ## Command: Display kdump file (kernel log)
657
- #
658
- # @param num_lines Number of last lines displayed
659
- # @param filename Name or index of the kernel log file (dmesg)
660
- def cmd_kdump_file (num_lines , filename ):
661
- fname = None
662
- nb_dumps = get_nb_dumps_in_var_crash ()
663
- if nb_dumps == 0 :
664
- print ("Kernel crash log not found" )
665
- else :
666
- (rc , lines , err_str ) = run_command ("find /var/crash/ -name 'dmesg.*'" , use_shell = False );
667
- if rc == 0 and nb_dumps == len (lines ):
668
- if filename .isdigit () and len (filename ) <= 2 :
669
- num = int (filename )
670
- if num < 1 or num > nb_dumps :
671
- if nb_dumps == 1 :
672
- print ("Invalid record number - Should be 1" )
673
- else :
674
- print ("Invalid record number - Should be between 1 and %d" % nb_dumps )
675
- sys .exit (1 )
676
- fname = sorted (lines , reverse = True )[num - 1 ]
677
- else :
678
- lines .sort (reverse = True )
679
- for x in lines :
680
- if x .find (filename ) != - 1 :
681
- fname = x
682
- break
683
- if fname is None :
684
- print ("Invalid key" )
685
- sys .exit (1 )
686
- (rc , lines , err_str ) = run_command ("/usr/bin/tail -n %d %s" % (num_lines , fname ), use_shell = False );
687
- if rc == 0 :
688
- print ('File: %s' % fname )
689
- print ('\n ' .join (lines ))
690
610
691
611
def main ():
692
612
@@ -714,10 +634,6 @@ def main():
714
634
parser .add_argument ('--disable' , action = 'store_true' ,
715
635
help = 'Disable kdump' )
716
636
717
- # kdump status on Current Image
718
- parser .add_argument ('--status' , action = 'store_true' ,
719
- help = 'Show kdump status' )
720
-
721
637
# kdump status on Current Image
722
638
parser .add_argument ('--status-json' , action = 'store_true' ,
723
639
help = 'Show kdump status in json format' )
@@ -726,7 +642,6 @@ def main():
726
642
parser .add_argument ('--kdump-records-json' , action = 'store_true' ,
727
643
help = 'Show kdump records in json format' )
728
644
729
- # kdump config on Current Image
730
645
# kdump config on Current Image
731
646
parser .add_argument ('--config-json' , action = 'store_true' ,
732
647
help = 'Show kdump config in json format' )
@@ -739,14 +654,6 @@ def main():
739
654
parser .add_argument ('--memory' , nargs = '?' , type = str , action = 'store' , default = False ,
740
655
help = 'Amount of memory reserved for the capture kernel' )
741
656
742
- # Capture kernel files
743
- parser .add_argument ('--files' , action = 'store_true' ,
744
- help = 'Show stored capture kernel files' )
745
-
746
- # Capture kernel file
747
- parser .add_argument ('--file' , nargs = 1 , type = str ,
748
- help = 'Show stored capture kernel file' )
749
-
750
657
# Show more information (used for sonic-kdump-config status)
751
658
parser .add_argument ("-v" , "--verbose" , action = 'store_true' ,
752
659
help = 'displays detailed kdump status information. Used with status command.' )
@@ -776,12 +683,6 @@ def main():
776
683
cmd_kdump_memory (options .verbose , options .memory )
777
684
elif options .num_dumps != False :
778
685
cmd_kdump_num_dumps (options .verbose , options .num_dumps )
779
- elif options .status :
780
- cmd_kdump_status ()
781
- elif options .files != False :
782
- cmd_kdump_files ()
783
- elif options .file :
784
- cmd_kdump_file (options .lines , options .file [0 ])
785
686
elif options .dump_db :
786
687
cmd_dump_db ()
787
688
elif options .status_json :
0 commit comments