Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Show] Update the subcommands of Kdump. #1682

Merged
merged 11 commits into from
Aug 22, 2021

Conversation

yozhao101
Copy link
Contributor

@yozhao101 yozhao101 commented Jun 17, 2021

Signed-off-by: Yong Zhao yozhao@microsoft.com

What I did

This PR fixed the following issues:

  • Initially we need add prefix sudo when ran the show command of Kdump. This is unnecessary.

  • I re-organized the logic of implementing show command and also update the script sonic-kdump-config.

How I did it

Since the script sonic-kdump-config can only be executed by root user, I moved some functions from this file to
the kdump.py such that we do not need run the show command with sudo.

How to verify it

I verified this change on the DuT str-msn2700-03.

Previous command output (if the output of a command-line utility has changed)

  • Before the Kdump is enabled:

      admin@str-msn2700-03:~$ sudo show kdump
      Usage: show kdump [OPTIONS] COMMAND [ARGS]...
      Show kdump configuration, status and information
      
      Options:
      -?, -h, --help Show this message and exit.
      
      Commands:
      enabled          Show if kdump is enabled or disabled
      files              Show kdump kernel core dump files
      log                Show kdump kernel core dump file kernel log
      memory        Show kdump memory information
      num_dumps     Show kdump max number of dump files
      status               Show kdump status
    
      admin@str-msn2700-03:~$ sudo show kdump status
      Kdump Administrative Mode: Disabled
      Kdump Operational State: Disabled
      Memory Reserved: 0M-2G:256M,2G-4G:320M,4G-8G:384M,8G-:448M
      Maximum number of Kernel Core files Stored: 3
      No kernel core dump files
    
      admin@str-msn2700-03:~$ sudo show kdump num_dumps
      Maximum number of Kernel Core files Stored: 3
      
      admin@str-msn2700-03:~$ sudo show kdump memory
      Memory Reserved: 0M-2G:256M,2G-4G:320M,4G-8G:384M,8G-:448M
      
      admin@str-msn2700-03:~$ sudo show kdump files
      No kernel core dump files
      
      admin@str-msn2700-03:~$ sudo show kdump log
      Usage: show kdump log [OPTIONS] RECORD <lines>
      Try "show kdump log -h" for help.
      Error: Missing argument "RECORD".
    
  • After the Kdump is enabled:

      admin@str-msn2700-03:$ sudo show kdump status
      Kdump Administrative Mode: Enabled
      Kdump Operational State: Ready after Reboot
      Memory Reserved: 0M-2G:256M,2G-4G:320M,4G-8G:384M,8G-:448M
      Maximum number of Kernel Core files Stored: 3
      No kernel core dump files
    
  • After device was rebooted and Kernel crash was triggered twice manually:

    admin@str-msn2700-03:~$ sudo show kdump status
    Kdump Administrative Mode: Enabled
    Kdump Operational State: Ready
    Memory Reserved: 0M-2G:256M,2G-4G:320M,4G-8G:384M,8G-:448M
    Maximum number of Kernel Core files Stored: 3
    No kernel core dump files
    
    admin@str-msn2700-03:~$ sudo show kdump status
    Kdump Administrative Mode: Enabled
    Kdump Operational State: Ready
    Memory Reserved: 0M-2G:256M,2G-4G:320M,4G-8G:384M,8G-:448M
    Maximum number of Kernel Core files Stored: 3
    Record          Key            Filename
    -------------------------------------------------------------
    1 202106242344 /var/crash/202106242344/dmesg.202106242344
                   /var/crash/202106242344/kdump.202106242344
    2 202106242337 /var/crash/202106242337/dmesg.202106242337
                   /var/crash/202106242337/kdump.202106242337
    
    admin@str-msn2700-03:~$ sudo show kdump files
    Record          Key            Filename
    -------------------------------------------------------------
    1 202106242344 /var/crash/202106242344/dmesg.202106242344
                   /var/crash/202106242344/kdump.202106242344
    2 202106242337 /var/crash/202106242337/dmesg.202106242337
                   /var/crash/202106242337/kdump.202106242337
    
    admin@str-msn2700-03:~$ sudo show kdump log 1 10
    File: /var/crash/202106242344/dmesg.202106242344
    [ 157.642053] RSP: 002b:00007fff1beee708 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
    [ 157.732635] RAX: ffffffffffffffda RBX: 0000000000000002 RCX: 00007fc3887d4504
    [ 157.818015] RDX: 0000000000000002 RSI: 000055d388eceb40 RDI: 0000000000000001
    [ 157.903401] RBP: 000055d388eceb40 R08: 000000000000000a R09: 00007fc3888255f0
    [ 157.988784] R10: 000000000000000a R11: 0000000000000246 R12: 00007fc3888a6760
    [ 158.074166] R13: 0000000000000002 R14: 00007fc3888a1760 R15: 0000000000000002
    [ 158.159553] Modules linked in: nft_chain_route_ipv6(E) nft_chain_route_ipv4(E) xt_TCPMSS(E) dummy(E) team_mode_loadbalance(E) team(E) sx_bfd(OE) sx_netdev(OE) psample(E) sx_core(OE) 8021q(E) garp(E) mrp(E) mst_pciconf(OE) mst_pci(OE) xt_hl(E) xt_tcpudp(E) ip6_tables(E) nft_compat(E) nft_chain_nat_ipv4(E) nf_nat_ipv4(E) nft_counter(E) xt_conntrack(E) nf_nat(E) jc42(E) nf_conntrack_netlink(E) nf_conntrack(E) nf_defrag_ipv6(E) nf_defrag_ipv4(E) libcrc32c(E) xfrm_user(E) xfrm_algo(E) mlxsw_minimal(E) mlxsw_i2c(E) i2c_mux_reg(E) i2c_mux(E) i2c_mlxcpld(E) leds_mlxreg(E) mlxreg_io(E) mlxreg_hotplug(E) mei_wdt(E) evdev(E) intel_rapl(E) x86_pkg_temp_thermal(E) intel_powerclamp(E) kvm_intel(E) mlx_platform(E) kvm(E) irqbypass(E) crct10dif_pclmul(E) crc32_pclmul(E) ghash_clmulni_intel(E) intel_cstate(E) intel_uncore(E)
    [ 159.016731] intel_rapl_perf(E) pcspkr(E) sg(E) iTCO_wdt(E) iTCO_vendor_support(E) mei_me(E) mei(E) bonding(E) pcc_cpufreq(E) video(E) button(E) ebt_vlan(E) ebtable_broute(E) bridge(E) stp(E) llc(E) ebtable_nat(E) ebtable_filter(E) ebtables(E) nf_tables(E) nfnetlink(E) xdpe12284(E) at24(E) ledtrig_timer(E) tmp102(E) lm75(E) drm(E) coretemp(E) max1363(E) industrialio_triggered_buffer(E) kfifo_buf(E) industrialio(E) tps53679(E) fuse(E) pmbus(E) pmbus_core(E) i2c_dev(E) configfs(E) ip_tables(E) x_tables(E) autofs4(E) loop(E) ext4(E) crc16(E) mbcache(E) jbd2(E) crc32c_generic(E) fscrypto(E) ecb(E) crypto_simd(E) cryptd(E) glue_helper(E) aes_x86_64(E) nvme(E) nvme_core(E) nls_utf8(E) nls_cp437(E) nls_ascii(E) vfat(E) fat(E) overlay(E) squashfs(E) zstd_decompress(E) xxhash(E) sd_mod(E) gpio_ich(E) ahci(E)
    [ 159.864532] libahci(E) mlxsw_core(E) devlink(E) ehci_pci(E) ehci_hcd(E) crc32c_intel(E) libata(E) i2c_i801(E) scsi_mod(E) usbcore(E) usb_common(E) lpc_ich(E) mfd_core(E) e1000e(E) fan(E) thermal(E)
    [ 160.075846] CR2: 0000000000000000
    

New command output (if the output of a command-line utility has changed)

  • Before the Kdump is enabled:

    admin@str-msn2700-03:~$ show kdump
    Usage: show kdump [OPTIONS] COMMAND [ARGS]...
    
    Show kdump configuration, dump files and dmesg logs
    
    Options:
    -?, -h, --help Show this message and exit.
    
    Commands:
    config     Show the configuration of Linux kernel dump
    files     Show kernel core dump and dmesg files
    logging     Show last 10 lines of kernel dmesg file
    
    admin@str-msn2700-03:$ show kdump config
    Kdump administrative mode: Disabled
    Kdump operational mode: Unready
    Kdump memory researvation: 0M-2G:256M,2G-4G:320M,4G-8G:384M,8G-:448M
    Maximum number of Kdump files: 3
    
    admin@str-msn2700-03:~$ show kdump files
            Kernel core dump files                 Kernel dmesg files
    -----------------------------------    -------------------------------
    No kernel core dump file available!    No kernel dmesg file available!
    
    admin@str-msn2700-03:~$ show kdump logging
    No kernel dmesg file available!
    
  • After Kdump is enabled:

    admin@str-msn2700-03:$ show kdump config
    Kdump administrative mode: Enabled
    Kdump operational mode: Ready after reboot
    Kdump memory researvation: 0M-2G:256M,2G-4G:320M,4G-8G:384M,8G-:448M
    Maximum number of Kdump files: 3
    
  • After device was rebooted and Kernel crash was triggered twice manually:

    admin@str-msn2700-03:$ show kdump config
    Kdump administrative mode: Enabled
    Kdump operational mode: Ready
    Kdump memory researvation: 0M-2G:256M,2G-4G:320M,4G-8G:384M,8G-:448M
    Maximum number of Kdump files: 3
    
    admin@str-msn2700-03:~$ show kdump files
                 Kernel core dump files                    Kernel dmesg files
    ------------------------------------------ ------------------------------------------
    /var/crash/202106242344/kdump.202106242344 /var/crash/202106242344/dmesg.202106242344
    /var/crash/202106242337/kdump.202106242337 /var/crash/202106242337/dmesg.202106242337
    
    admin@str-msn2700-03:~$ show kdump logging
    [ 157.642053] RSP: 002b:00007fff1beee708 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
    [ 157.732635] RAX: ffffffffffffffda RBX: 0000000000000002 RCX: 00007fc3887d4504
    [ 157.818015] RDX: 0000000000000002 RSI: 000055d388eceb40 RDI: 0000000000000001
    [ 157.903401] RBP: 000055d388eceb40 R08: 000000000000000a R09: 00007fc3888255f0
    [ 157.988784] R10: 000000000000000a R11: 0000000000000246 R12: 00007fc3888a6760
    [ 158.074166] R13: 0000000000000002 R14: 00007fc3888a1760 R15: 0000000000000002
    [ 158.159553] Modules linked in: nft_chain_route_ipv6(E) nft_chain_route_ipv4(E) xt_TCPMSS(E) dummy(E) team_mode_loadbalance(E) team(E) sx_bfd(OE) sx_netdev(OE) psample(E) sx_core(OE) 8021q(E) garp(E) mrp(E) mst_pciconf(OE) mst_pci(OE) xt_hl(E) xt_tcpudp(E) ip6_tables(E) nft_compat(E) nft_chain_nat_ipv4(E) nf_nat_ipv4(E) nft_counter(E) xt_conntrack(E) nf_nat(E) jc42(E) nf_conntrack_netlink(E) nf_conntrack(E) nf_defrag_ipv6(E) nf_defrag_ipv4(E) libcrc32c(E) xfrm_user(E) xfrm_algo(E) mlxsw_minimal(E) mlxsw_i2c(E) i2c_mux_reg(E) i2c_mux(E) i2c_mlxcpld(E) leds_mlxreg(E) mlxreg_io(E) mlxreg_hotplug(E) mei_wdt(E) evdev(E) intel_rapl(E) x86_pkg_temp_thermal(E) intel_powerclamp(E) kvm_intel(E) mlx_platform(E) kvm(E) irqbypass(E) crct10dif_pclmul(E) crc32_pclmul(E) ghash_clmulni_intel(E) intel_cstate(E) intel_uncore(E)
    [ 159.016731] intel_rapl_perf(E) pcspkr(E) sg(E) iTCO_wdt(E) iTCO_vendor_support(E) mei_me(E) mei(E) bonding(E) pcc_cpufreq(E) video(E) button(E) ebt_vlan(E) ebtable_broute(E) bridge(E) stp(E) llc(E) ebtable_nat(E) ebtable_filter(E) ebtables(E) nf_tables(E) nfnetlink(E) xdpe12284(E) at24(E) ledtrig_timer(E) tmp102(E) lm75(E) drm(E) coretemp(E) max1363(E) industrialio_triggered_buffer(E) kfifo_buf(E) industrialio(E) tps53679(E) fuse(E) pmbus(E) pmbus_core(E) i2c_dev(E) configfs(E) ip_tables(E) x_tables(E) autofs4(E) loop(E) ext4(E) crc16(E) mbcache(E) jbd2(E) crc32c_generic(E) fscrypto(E) ecb(E) crypto_simd(E) cryptd(E) glue_helper(E) aes_x86_64(E) nvme(E) nvme_core(E) nls_utf8(E) nls_cp437(E) nls_ascii(E) vfat(E) fat(E) overlay(E) squashfs(E) zstd_decompress(E) xxhash(E) sd_mod(E) gpio_ich(E) ahci(E)
    [ 159.864532] libahci(E) mlxsw_core(E) devlink(E) ehci_pci(E) ehci_hcd(E) crc32c_intel(E) libata(E) i2c_i801(E) scsi_mod(E) usbcore(E) usb_common(E) lpc_ich(E) mfd_core(E) e1000e(E) fan(E) thermal(E)
    [ 160.075846] CR2: 0000000000000000
    
    admin@str-msn2700-03:~$ show kdump logging dmesg.202106242337
    [ 654.120195] RSP: 002b:00007ffe697690f8 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
    [ 654.210778] RAX: ffffffffffffffda RBX: 0000000000000002 RCX: 00007fcfca27b504
    [ 654.296157] RDX: 0000000000000002 RSI: 000055a6e4d1b3f0 RDI: 0000000000000001
    [ 654.381543] RBP: 000055a6e4d1b3f0 R08: 000000000000000a R09: 00007fcfca2cc5f0
    [ 654.466925] R10: 000000000000000a R11: 0000000000000246 R12: 00007fcfca34d760
    [ 654.552310] R13: 0000000000000002 R14: 00007fcfca348760 R15: 0000000000000002
    [ 654.637694] Modules linked in: binfmt_misc(E) nft_chain_route_ipv6(E) nft_chain_route_ipv4(E) xt_TCPMSS(E) dummy(E) team_mode_loadbalance(E) team(E) sx_bfd(OE) sx_netdev(OE) psample(E) sx_core(OE) 8021q(E) garp(E) mrp(E) mst_pciconf(OE) mst_pci(OE) xt_hl(E) xt_tcpudp(E) ip6_tables(E) nft_chain_nat_ipv4(E) nf_nat_ipv4(E) nft_compat(E) nft_counter(E) xt_conntrack(E) nf_nat(E) jc42(E) nf_conntrack_netlink(E) nf_conntrack(E) nf_defrag_ipv6(E) nf_defrag_ipv4(E) libcrc32c(E) xfrm_user(E) xfrm_algo(E) mlxsw_minimal(E) mlxsw_i2c(E) i2c_mux_reg(E) i2c_mux(E) mlxreg_hotplug(E) mlxreg_io(E) i2c_mlxcpld(E) leds_mlxreg(E) mei_wdt(E) evdev(E) intel_rapl(E) x86_pkg_temp_thermal(E) intel_powerclamp(E) kvm_intel(E) kvm(E) mlx_platform(E) irqbypass(E) crct10dif_pclmul(E) crc32_pclmul(E) ghash_clmulni_intel(E) intel_cstate(E)
    [ 655.493833] intel_uncore(E) intel_rapl_perf(E) pcspkr(E) sg(E) iTCO_wdt(E) iTCO_vendor_support(E) mei_me(E) mei(E) bonding(E) video(E) button(E) pcc_cpufreq(E) ebt_vlan(E) ebtable_broute(E) bridge(E) stp(E) llc(E) ebtable_nat(E) ebtable_filter(E) ebtables(E) nf_tables(E) nfnetlink(E) xdpe12284(E) at24(E) ledtrig_timer(E) tmp102(E) drm(E) lm75(E) coretemp(E) max1363(E) industrialio_triggered_buffer(E) kfifo_buf(E) industrialio(E) fuse(E) tps53679(E) pmbus(E) pmbus_core(E) i2c_dev(E) configfs(E) ip_tables(E) x_tables(E) autofs4(E) loop(E) ext4(E) crc16(E) mbcache(E) jbd2(E) crc32c_generic(E) fscrypto(E) ecb(E) crypto_simd(E) cryptd(E) glue_helper(E) aes_x86_64(E) nvme(E) nvme_core(E) nls_utf8(E) nls_cp437(E) nls_ascii(E) vfat(E) fat(E) overlay(E) squashfs(E) zstd_decompress(E) xxhash(E) sd_mod(E)
    [ 656.337476] gpio_ich(E) ahci(E) mlxsw_core(E) libahci(E) devlink(E) crc32c_intel(E) libata(E) i2c_i801(E) scsi_mod(E) lpc_ich(E) mfd_core(E) ehci_pci(E) ehci_hcd(E) usbcore(E) e1000e(E) usb_common(E) fan(E) thermal(E)
    [ 656.569590] CR2: 0000000000000000
    
    admin@str-msn2700-03:~$ show kdump logging dmesg.202106242337 -l 20
    [ 653.496199] Call Trace:
    [ 653.525427] __handle_sysrq.cold.9+0x45/0xf2
    [ 653.576487] write_sysrq_trigger+0x2b/0x30
    [ 653.625472] proc_reg_write+0x39/0x60
    [ 653.669252] vfs_write+0xa5/0x1a0
    [ 653.708881] ksys_write+0x57/0xd0
    [ 653.748501] do_syscall_64+0x53/0x110
    [ 653.792287] entry_SYSCALL_64_after_hwframe+0x44/0xa9
    [ 653.852707] RIP: 0033:0x7fcfca27b504
    [ 653.895452] Code: 00 f7 d8 64 89 02 48 c7 c0 ff ff ff ff eb b3 0f 1f 80 00 00 00 00 48 8d 05 f9 61 0d 00 8b 00 85 c0 75 13 b8 01 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 54 c3 0f 1f 00 41 54 49 89 d4 55 48 89 f5 53
    [ 654.120195] RSP: 002b:00007ffe697690f8 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
    [ 654.210778] RAX: ffffffffffffffda RBX: 0000000000000002 RCX: 00007fcfca27b504
    [ 654.296157] RDX: 0000000000000002 RSI: 000055a6e4d1b3f0 RDI: 0000000000000001
    [ 654.381543] RBP: 000055a6e4d1b3f0 R08: 000000000000000a R09: 00007fcfca2cc5f0
    [ 654.466925] R10: 000000000000000a R11: 0000000000000246 R12: 00007fcfca34d760
    [ 654.552310] R13: 0000000000000002 R14: 00007fcfca348760 R15: 0000000000000002
    [ 654.637694] Modules linked in: binfmt_misc(E) nft_chain_route_ipv6(E) nft_chain_route_ipv4(E) xt_TCPMSS(E) dummy(E) team_mode_loadbalance(E) team(E) sx_bfd(OE) sx_netdev(OE) psample(E) sx_core(OE) 8021q(E) garp(E) mrp(E) mst_pciconf(OE) mst_pci(OE) xt_hl(E) xt_tcpudp(E) ip6_tables(E) nft_chain_nat_ipv4(E) nf_nat_ipv4(E) nft_compat(E) nft_counter(E) xt_conntrack(E) nf_nat(E) jc42(E) nf_conntrack_netlink(E) nf_conntrack(E) nf_defrag_ipv6(E) nf_defrag_ipv4(E) libcrc32c(E) xfrm_user(E) xfrm_algo(E) mlxsw_minimal(E) mlxsw_i2c(E) i2c_mux_reg(E) i2c_mux(E) mlxreg_hotplug(E) mlxreg_io(E) i2c_mlxcpld(E) leds_mlxreg(E) mei_wdt(E) evdev(E) intel_rapl(E) x86_pkg_temp_thermal(E) intel_powerclamp(E) kvm_intel(E) kvm(E) mlx_platform(E) irqbypass(E) crct10dif_pclmul(E) crc32_pclmul(E) ghash_clmulni_intel(E) intel_cstate(E)
    [ 655.493833] intel_uncore(E) intel_rapl_perf(E) pcspkr(E) sg(E) iTCO_wdt(E) iTCO_vendor_support(E) mei_me(E) mei(E) bonding(E) video(E) button(E) pcc_cpufreq(E) ebt_vlan(E) ebtable_broute(E) bridge(E) stp(E) llc(E) ebtable_nat(E) ebtable_filter(E) ebtables(E) nf_tables(E) nfnetlink(E) xdpe12284(E) at24(E) ledtrig_timer(E) tmp102(E) drm(E) lm75(E) coretemp(E) max1363(E) industrialio_triggered_buffer(E) kfifo_buf(E) industrialio(E) fuse(E) tps53679(E) pmbus(E) pmbus_core(E) i2c_dev(E) configfs(E) ip_tables(E) x_tables(E) autofs4(E) loop(E) ext4(E) crc16(E) mbcache(E) jbd2(E) crc32c_generic(E) fscrypto(E) ecb(E) crypto_simd(E) cryptd(E) glue_helper(E) aes_x86_64(E) nvme(E) nvme_core(E) nls_utf8(E) nls_cp437(E) nls_ascii(E) vfat(E) fat(E) overlay(E) squashfs(E) zstd_decompress(E) xxhash(E) sd_mod(E)
    [ 656.337476] gpio_ich(E) ahci(E) mlxsw_core(E) libahci(E) devlink(E) crc32c_intel(E) libata(E) i2c_i801(E) scsi_mod(E) lpc_ich(E) mfd_core(E) ehci_pci(E) ehci_hcd(E) usbcore(E) e1000e(E) usb_common(E) fan(E) thermal(E)
    [ 656.569590] CR2: 0000000000000000
    

Signed-off-by: Yong Zhao <yozhao@microsoft.com>
@yozhao101 yozhao101 changed the title [Kdump] Update the subcommands of Kdump. [Show] Update the subcommands of Kdump. Jun 17, 2021
Signed-off-by: Yong Zhao <yozhao@microsoft.com>
@jleveque
Copy link
Contributor

Please also update the Command Reference guide to reflect these changes.

Signed-off-by: Yong Zhao <yozhao@microsoft.com>
Signed-off-by: Yong Zhao <yozhao@microsoft.com>
Signed-off-by: Yong Zhao <yozhao@microsoft.com>
Signed-off-by: Yong Zhao <yozhao@microsoft.com>
Signed-off-by: Yong Zhao <yozhao@microsoft.com>
Signed-off-by: Yong Zhao <yozhao@microsoft.com>
Signed-off-by: Yong Zhao <yozhao@microsoft.com>
@yozhao101 yozhao101 marked this pull request as ready for review July 5, 2021 20:40
@yozhao101 yozhao101 requested review from lguohan and yxieca July 6, 2021 06:35
@yozhao101
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

show/kdump.py Outdated
config_db = ConfigDBConnector()
if config_db is not None:
if config_db:
Copy link
Contributor

@qiluo-msft qiluo-msft Jul 10, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if config_db

If condition is false, is it an error? #Closed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think this will be an error.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then please handle the error instead of keeping silent. Or remove the check and let config.connect() throw exception.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated and rely on the config.connect() to throw exception if any error occurs.

show/kdump.py Outdated

Returns:
admin_mode: If Kdump is ready, returns "Ready"; If Kdump is not ready,
returns "Unready"; Otherwise, returns "Unknown".
Copy link
Contributor

@qiluo-msft qiluo-msft Jul 10, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unready

"Not ready" sounds better #Closed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great suggestion! Updated.

@qiluo-msft
Copy link
Contributor

qiluo-msft commented Jul 10, 2021

def run_command(cmd, use_shell=False):

Why define a new run_command function?


In reply to: 877600216


Refers to: scripts/sonic-kdump-config:43 in f1d2610. [](commit_id = f1d2610, deletion_comment = False)

output = proc.communicate()[0]
return output
command_stdout, command_stderr = proc.communicate()
return command_stdout, command_stderr, proc.returncode
Copy link
Contributor

@qiluo-msft qiluo-msft Jul 10, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return

You changed the return type, which will impact other code which uses this function. #Closed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated the code which uses this function to get the standard output of a specific command.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you find a way not impacting other code? They are not relevant to your feature.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated!

Copy link
Contributor

@qiluo-msft qiluo-msft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As comments

@lgtm-com
Copy link

lgtm-com bot commented Jul 19, 2021

This pull request introduces 1 alert when merging 7be11c62487ef272cf5c6ad3df1fa939dcf17e1c into 0efd297 - view on LGTM.com

new alerts:

  • 1 for Unused local variable

@yozhao101
Copy link
Contributor Author

def run_command(cmd, use_shell=False):

Why define a new run_command function?

Refers to: scripts/sonic-kdump-config:43 in f1d2610. [](commit_id = f1d2610, deletion_comment = False)

The run_command(...) was created by initial author from Broadcom and it will return exit code, list of standard output and list of standard error.

Do we need remove this run_command(...) and reuse the one defined in cli.py?

@qiluo-msft
Copy link
Contributor

def run_command(cmd, use_shell=False):

Still applicable.


In reply to: 877600216


Refers to: scripts/sonic-kdump-config:43 in f1d2610. [](commit_id = f1d2610, deletion_comment = False)

@yozhao101 yozhao101 force-pushed the update_subcommands_kdump branch 2 times, most recently from 7be11c6 to 9b490cc Compare August 16, 2021 17:53
Signed-off-by: Yong Zhao <yozhao@microsoft.com>
@yozhao101
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@yozhao101 yozhao101 merged commit 4cb3b72 into sonic-net:master Aug 22, 2021
qiluo-msft pushed a commit that referenced this pull request Aug 23, 2021
Signed-off-by: Yong Zhao yozhao@microsoft.com

What I did
This PR fixed the following issues:

Initially we need add prefix sudo when ran the show command of Kdump. This is unnecessary.

I re-organized the logic of implementing show command and also update the script sonic-kdump-config.

How I did it
Since the script sonic-kdump-config can only be executed by root user, I moved some functions from this file to
the kdump.py such that we do not need run the show command with sudo.

How to verify it
I verified this change on the DuT str-msn2700-03.
vaibhavhd added a commit to sonic-net/sonic-buildimage that referenced this pull request Aug 26, 2021
Update sonic-utilities submodule to latest in 202012 branch:

[show priority-group drop counters] Add user info output when user want to check PG counters and polling are disabled sonic-net/sonic-utilities#1678
[route_check] Filter out VNET routes sonic-net/sonic-utilities#1612
[Show] Update the subcommands of Kdump. sonic-net/sonic-utilities#1682
Add mock support for swsscommon classes sonic-net/sonic-utilities#1780
[acl_loader]: add iptype match to the rules for dataplane acl sonic-net/sonic-utilities@205aff8
[202012][fast-reboot] Remove FLEX_COUNTER_TABLE from config_db.json before fast-reboot sonic-net/sonic-utilities#1774
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants