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

Use -d instead of -m in config qos #388

Merged
merged 1 commit into from
Dec 4, 2018

Conversation

taoyl-ms
Copy link
Contributor

- What I did
Fix sonic-net/sonic-buildimage#2046.

- How I did it
All sonic-cfggen -m in config qos reload should be reading from db using sonic-cfggen -d instead.

@andriymoroz-mlnx
Copy link
Collaborator

with this fix it fails on first boot (when no config db yet)

root@arc-switch1029:/home/admin# rm /etc/sonic/config_db.json
root@arc-switch1029:/home/admin# config load_minigraph
Reload config from minigraph? [y/N]: y
Running command: systemctl stop dhcp_relay
Running command: systemctl stop swss
Running command: systemctl stop snmp
Warning: Stopping snmp.service, but it can still be activated by:
  snmp.timer
Running command: systemctl stop lldp
Running command: systemctl stop pmon
Running command: systemctl stop bgp
Running command: systemctl stop teamd
Running command: /usr/local/bin/sonic-cfggen -H -m -j /etc/sonic/init_cfg.json --write-to-db
Running command: pfcwd start_default
Running command: config qos reload
Traceback (most recent call last):
  File "/usr/local/bin/sonic-cfggen", line 263, in <module>
    main()
  File "/usr/local/bin/sonic-cfggen", line 240, in main
    print(template.render(sort_data(data)))
  File "/usr/local/lib/python2.7/dist-packages/jinja2/environment.py", line 1008, in render
    return self.environment.handle_exception(exc_info, True)
  File "/usr/local/lib/python2.7/dist-packages/jinja2/environment.py", line 780, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/share/sonic/device/x86_64-mlnx_msn2100-r0/ACS-MSN2100/buffers.json.j2", line 2, in top-level template code
    {%- include 'buffers_config.j2' %}
  File "/usr/share/sonic/templates/buffers_config.j2", line 112, in top-level template code
    {%- set cable = cable_length(port) %}
  File "/usr/local/lib/python2.7/dist-packages/jinja2/runtime.py", line 579, in _invoke
    rv = self._func(*arguments)
  File "/usr/share/sonic/templates/buffers_config.j2", line 63, in template
    {%- set vlan_port = local_port.split("|") %}
jinja2.exceptions.UndefinedError: 'tuple object' has no attribute 'split'
Running command: /usr/local/bin/sonic-cfggen -d -t /usr/share/sonic/device/x86_64-mlnx_msn2100-r0/ACS-MSN2100/buffers.json.j2 >/tmp/buffers.json

@lguohan
Copy link
Contributor

lguohan commented Nov 28, 2018

@taoyl-ms, can you address this?

@taoyl-ms
Copy link
Contributor Author

taoyl-ms commented Dec 3, 2018

sonic-net/sonic-buildimage#2337 will be needed to fix the issue @andriymoroz-mlnx described.

@taoyl-ms taoyl-ms merged commit e438c66 into sonic-net:master Dec 4, 2018
@andriymoroz-mlnx
Copy link
Collaborator

Fails for ptf32

fatal: [arc-switch1004-ptf32]: FAILED! => {"changed": true, "cmd": "config load_minigraph -y", "delta": "0:00:58.947079", "end": "2018-12-17 22:23:29.347265", "failed": true, "invocation": {"module_args": {"_raw_params": "config load_minigraph -y", "_uses_shell": true, "chdir": null, "creates": null, "executable": null, "removes": null, "warn": true}, "module_name": "command"}, "rc": 1, "start": "2018-12-17 22:22:30.400186", "stderr": "Warning: Stopping snmp.service, but it can still be activated by:
  snmp.timer
Traceback (most recent call last):
  File \"/usr/local/bin/sonic-cfggen\", line 263, in <module>
    main()
  File \"/usr/local/bin/sonic-cfggen\", line 240, in main
    print(template.render(sort_data(data)))
  File \"/usr/local/lib/python2.7/dist-packages/jinja2/environment.py\", line 1008, in render
    return self.environment.handle_exception(exc_info, True)
  File \"/usr/local/lib/python2.7/dist-packages/jinja2/environment.py\", line 780, in handle_exception
    reraise(exc_type, exc_value, tb)
  File \"/usr/share/sonic/device/x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers.json.j2\", line 2, in top-level template code
    {%- include 'buffers_config.j2' %}
  File \"/usr/share/sonic/templates/buffers_config.j2\", line 111, in top-level template code
    {%- set cable = cable_length(port) %}
  File \"/usr/local/lib/python2.7/dist-packages/jinja2/runtime.py\", line 579, in _invoke
    rv = self._func(*arguments)
  File \"/usr/share/sonic/templates/buffers_config.j2\", line 43, in template
    {%- if DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] %}
  File \"/usr/local/lib/python2.7/dist-packages/jinja2/environment.py\", line 411, in getitem
    return obj[argument]
jinja2.exceptions.UndefinedError: 'DEVICE_NEIGHBOR_METADATA' is undefined", "stdout": "Running command: systemctl stop dhcp_relay
Running command: systemctl stop swss
Running command: systemctl stop snmp
Running command: systemctl stop lldp
Running command: systemctl stop pmon
Running command: systemctl stop bgp
Running command: systemctl stop teamd
Running command: /usr/local/bin/sonic-cfggen -H -m -j /etc/sonic/init_cfg.json --write-to-db
Running command: pfcwd start_default
Running command: config qos reload
Running command: /usr/local/bin/sonic-cfggen -d -t /usr/share/sonic/device/x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers.json.j2 >/tmp/buffers.json", "stdout_lines": ["Running command: systemctl stop dhcp_relay", "Running command: systemctl stop swss", "Running command: systemctl stop snmp", "Running command: systemctl stop lldp", "Running command: systemctl stop pmon", "Running command: systemctl stop bgp", "Running command: systemctl stop teamd", "Running command: /usr/local/bin/sonic-cfggen -H -m -j /etc/sonic/init_cfg.json --write-to-db", "Running command: pfcwd start_default", "Running command: config qos reload", "Running command: /usr/local/bin/sonic-cfggen -d -t /usr/share/sonic/device/x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers.json.j2 >/tmp/buffers.json"], "warnings": []}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

minigraph.xml is missing in /etc/sonic/ after sonic2sonic upgrade
5 participants