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

Openvswitch bridge issue fix #51480 #58008

Open

Conversation

Projects
None yet
4 participants
@vishwanathjadhav
Copy link

commented Jun 18, 2019

SUMMARY:

Exception while creating a bridge port, due to None type item.

Issue fix #51480

ISSUE TYPE:

  • Bugfix Pull Request

COMPONENT NAME:

Open vSwitch

ADDITIONAL INFORMATION:

@ansibot

This comment has been minimized.

Copy link
Contributor

commented Jun 18, 2019

@vishwanathjadhav this PR contains the following merge commits:

Please rebase your branch to remove these commits.

click here for bot help

@ansibot

This comment has been minimized.

Copy link
Contributor

commented Jun 18, 2019

@vishwanathjadhav, just so you are aware we have a dedicated Working Group for network.
You can find other people interested in this in #ansible-network on Freenode IRC
For more information about communities, meetings and agendas see https://github.com/ansible/community

click here for bot help

@ansible-zuul

This comment has been minimized.

Copy link

commented Jun 18, 2019

@ansibot ansibot added the bug label Jun 19, 2019

@vishwanathjadhav

This comment has been minimized.

Copy link
Author

commented Jun 19, 2019

The issue has been reproduced:

TASK [Create bridge br0] *******************************************************
fatal: [sc-rdops-vm14-dhcp-174-212.eng.vmware.com]: FAILED! => {"changed": false, "module_stderr": "Shared connection to sc-rdops-vm14-dhcp-174-212.eng.vmware.com closed.\r\n", "module_stdout": "Traceback (most recent call last):\r\n  File \"/tmp/ansible_UnIT54/ansible_module_openvswitch_bridge.py\", line 267, in <module>\r\n    main()\r\n  File \"/tmp/ansible_UnIT54/ansible_module_openvswitch_bridge.py\", line 254, in main\r\n    commands = map_obj_to_commands(want, have, module)\r\n  File \"/tmp/ansible_UnIT54/ansible_module_openvswitch_bridge.py\", line 139, in map_obj_to_commands\r\n    if (k not in have['external_ids']\r\nTypeError: argument of type 'NoneType' is not iterable\r\n", "msg": "MODULE FAILURE", "rc": 1}
fatal: [sc-rdops-vm14-dhcp-189-249.eng.vmware.com]: FAILED! => {"changed": false, "module_stderr": "Shared connection to sc-rdops-vm14-dhcp-189-249.eng.vmware.com closed.\r\n", "module_stdout": "Traceback (most recent call last):\r\n  File \"/tmp/ansible_UC6B61/ansible_module_openvswitch_bridge.py\", line 267, in <module>\r\n    main()\r\n  File \"/tmp/ansible_UC6B61/ansible_module_openvswitch_bridge.py\", line 254, in main\r\n    commands = map_obj_to_commands(want, have, module)\r\n  File \"/tmp/ansible_UC6B61/ansible_module_openvswitch_bridge.py\", line 139, in map_obj_to_commands\r\n    if (k not in have['external_ids']\r\nTypeError: argument of type 'NoneType' is not iterable\r\n", "msg": "MODULE FAILURE", "rc": 1}
fatal: [sc-rdops-vm14-dhcp-178-105.eng.vmware.com]: FAILED! => {"changed": false, "module_stderr": "Shared connection to sc-rdops-vm14-dhcp-178-105.eng.vmware.com closed.\r\n", "module_stdout": "Traceback (most recent call last):\r\n  File \"/tmp/ansible_mSapdO/ansible_module_openvswitch_bridge.py\", line 267, in <module>\r\n    main()\r\n  File \"/tmp/ansible_mSapdO/ansible_module_openvswitch_bridge.py\", line 254, in main\r\n    commands = map_obj_to_commands(want, have, module)\r\n  File \"/tmp/ansible_mSapdO/ansible_module_openvswitch_bridge.py\", line 139, in map_obj_to_commands\r\n    if (k not in have['external_ids']\r\nTypeError: argument of type 'NoneType' is not iterable\r\n", "msg": "MODULE FAILURE", "rc": 1}
	to retry, use: --limit @/root/myplay/test.retry

Result After applying fix:

TASK [Create bridge br0] *******************************************************
changed: [rhel7] => {"changed": true, "commands": ["/bin/ovs-vsctl -t 5 add-br br0", "/bin/ovs-vsctl -t 5 set-fail-mode br0 standalone", "/bin/ovs-vsctl -t 5 br-set-external-id br0 bridge-id br0"]}

TASK [Add interface to br0] ****************************************************
changed: [rhel7] => {"changed": true, "cmd": ["ovs-vsctl", "add-port", "br0", "enp0s8"], "delta": "0:00:00.007307", "end": "2019-06-19 06:35:37.373628", "rc": 0, "start": "2019-06-19 06:35:37.366321", "stderr": "", "stderr_lines": [], "stdout": "", "stdout_lines": []}

TASK [Create VXLAN] ************************************************************
changed: [rhel7] => {"changed": true, "cmd": ["ovs-vsctl", "add-port", "br0", "vxlan1", "--", "set", "interface", "vxlan1", "type=vxlan", "options:local_ip=192.168.11.2"], "delta": "0:00:00.006558", "end": "2019-06-19 06:35:37.724789", "rc": 0, "start": "2019-06-19 06:35:37.718231", "stderr": "", "stderr_lines": [], "stdout": "", "stdout_lines": []}

PLAY RECAP *********************************************************************
rhel7                      : ok=12   changed=10   unreachable=0    failed=0    skipped=0    rescued=0    ignored=1   

Sample Playbook to reprodue the issue and test the fix:

- name: Reproduce and fix OVS issue
  hosts: "{{HOSTS}}"
  become: true
  vars:
  tasks:
  - when: ansible_distribution_major_version == '7'
    block:
    - name: Install OpenvSwitch
      yum:
        name: openvswitch
        state: latest

    - name: Restart OpenvSwitch
      service:
        name: "{{item}}"
        state: restarted
      ignore_errors: true
      with_items:
        - network
        - openvswitch
    
    - name: Create bridge br0
      openvswitch_bridge:
        bridge: br0
        state: present
        fail_mode: standalone
      args:
        external_ids:
            bridge-id: "br0"

    - name: Add interface to br0
      command: ovs-vsctl add-port br0 enp0s8
      ignore_errors: true

    - name: Create VXLAN
      command: ovs-vsctl add-port br0 vxlan1 -- set interface vxlan1 type=vxlan options:local_ip=192.168.11.2
      ignore_errors: true
@@ -134,7 +134,8 @@ def map_obj_to_commands(want, have, module):
templatized_command = ("%(ovs-vsctl)s -t %(timeout)s"
" br-set-external-id %(bridge)s")
command = templatized_command % module.params
if want['external_ids']:
if 'external_ids' in want and want['external_ids'] and\

This comment has been minimized.

Copy link
@ganeshrn

ganeshrn Jun 20, 2019

Member

The condition can be simplified as
if want.get('external_ids') and have.get('external_ids')

This comment has been minimized.

Copy link
@vishwanathjadhav

@ansibot ansibot removed the needs_triage label Jun 20, 2019

@ansibot

This comment has been minimized.

Copy link
Contributor

commented Jun 20, 2019

@vishwanathjadhav this PR contains the following merge commits:

Please rebase your branch to remove these commits.

click here for bot help

@ansibot

This comment has been minimized.

Copy link
Contributor

commented Jun 20, 2019

@vishwanathjadhav This PR was evaluated as a potentially problematic PR for the following reasons:

  • More than 50 changed files.

Such PR can only be merged by human. Contact a Core team member to review this PR on IRC: #ansible-devel on irc.freenode.net

click here for bot help

@ansibot

This comment has been minimized.

Copy link
Contributor

commented Jun 20, 2019

@vishwanathjadhav this PR contains the following merge commits:

Please rebase your branch to remove these commits.

click here for bot help

@ansible-zuul

This comment has been minimized.

Copy link

commented Jun 20, 2019

@pabelanger
Copy link
Contributor

left a comment

Thanks for the PR, lets also update test/integration/targets/openvswitch_bridge/ to include your example, to ensure we get test coverage.

@vishwanathjadhav vishwanathjadhav force-pushed the vishwanathjadhav:openvswitch_bridge_issue_fix_#51480 branch from e57319a to b7e1e86 Jun 21, 2019

@ansibot

This comment has been minimized.

Copy link
Contributor

commented Jun 21, 2019

@ansibot ansibot added the core_review label Jun 21, 2019

@ansible-zuul

This comment has been minimized.

Copy link

commented Jun 21, 2019

@ansibot ansibot added needs_revision and removed core_review labels Jun 21, 2019

@ansibot ansibot added the stale_ci label Jun 29, 2019

@ansibot ansibot added the stale_review label Jul 7, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.