sonic-net / sonic-buildimage

Scripts which perform an installable binary image build for SONiC
Other
711 stars 1.36k forks source link

["SFLOW"] | after reload config_db.json sflow going to disabled state #9473

Closed ihorchekh closed 2 years ago

ihorchekh commented 2 years ago

Description After reload config_db.json sflow going to disabled state. Command show feature status shows sflow in disabled state after config reload -y

Steps to reproduce the issue:

  1. Check that sflow enabled in config_db.json *if it has "state": "disabled" change to "enabled"
       "sflow": {
            "auto_restart": "enabled",
            "has_global_scope": "True",
            "has_per_asic_scope": "False",
            "has_timer": "False",
            "high_mem_alert": "disabled",
            "state": "enabled"
        },
  2. Reboot device
  3. Check show feature status
  4. Reload config: config reload -y
  5. Check show feature status

Actual result Command show feature status shows sflow in disabled state after config reload -y

Expected result Command show feature status shows sflow in enabled state after config reload -y

Output of show version: SONiC.master.51908-dirty-20211117.173456

Output of show techsupport: sonic_dump_r-tigon-11_20211208_150029.tar.gz

zhangyanzhao commented 2 years ago

Nvidia team will debug further according to comments from issue tirage meeting

dgsudharsan commented 2 years ago

config reload -y Running command: rm -rf /tmp/dropstat-* Disabling container monitoring ... Stopping SONiC target ... Running command: /usr/local/bin/sonic-cfggen -j /etc/sonic/config_db.json -j /etc/sonic/init_cfg.json --write-to-db Running command: /usr/local/bin/db_migrator.py -o migrate Running command: /usr/local/bin/sonic-cfggen -d -y /etc/sonic/sonic_version.yml -t /usr/share/sonic/templates/sonic-environment.j2,/etc/sonic/sonic-environment

In the above execution from latest master sonic-cfggen is taking config_db.json first followed by init_cfg.json which will make default values in init_cfg.json override user configuration values. In 202106 we find below is the order

if [ "$(systemctl is-enabled swss.service)" == "enabled" ]; then echo "hello"; fi

    if namespace is None:
        if os.path.isfile(INIT_CFG_FILE):
            command = "{} -j {} -j {} --write-to-db".format(SONIC_CFGGEN_PATH, INIT_CFG_FILE, file)

However, the order was reversed in this PR https://github.com/Azure/sonic-utilities/pull/1781. Is there any specific reason for it? If not, can you please make the order as earlier so user config takes precedence over default?