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 failure with pre-existing bridge #86

Open
dbalagansky opened this issue Oct 27, 2021 · 0 comments
Open

openvswitch_bridge failure with pre-existing bridge #86

dbalagansky opened this issue Oct 27, 2021 · 0 comments
Assignees

Comments

@dbalagansky
Copy link

SUMMARY

openvswitch_bridge module fails with pre-existing OVS bridge, created via netplan.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

openvswitch_bridge

ANSIBLE VERSION
ansible [core 2.11.6]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/user/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/user/.pyenv/versions/3.9.2/lib/python3.9/site-packages/ansible
  ansible collection location = /home/user/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/user/.pyenv/versions/3.9.2/bin/ansible
  python version = 3.9.2 (default, Mar 12 2021, 10:09:55) [GCC 7.5.0]
  jinja version = 2.11.3
  libyaml = True
COLLECTION VERSION
Collection              Version
----------------------- -------
openvswitch.openvswitch 2.0.2
CONFIGURATION
# default
OS / ENVIRONMENT

Target:

NAME="Ubuntu"
VERSION="20.04.3 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.3 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal
STEPS TO REPRODUCE

The playbook below is a minimal test case for reproduction. The actual problem (that is, how I've spotted it) is that Netplan on Ubuntu creates new OVS bridges with fail-mode explicitly set to "standalone" (https://github.com/canonical/netplan/blob/main/src/openvswitch.c#L355) and all the consecutive runs of the openvswitch_bridge without explicit fail_mode arg would fail.

- hosts: all
  tasks:
    - name: update netplan
      apt:
        name: netplan.io
        update_cache: yes
        state: latest

    - name: install ovs stuff
      apt:
        name: openvswitch-switch
        state: present

    - name: create bridge via ovs-vsctl
      command: ovs-vsctl --may-exist add-br br-vlan

    - name: set fail-mode via ovs-vsctl
      command: ovs-vsctl set-fail-mode br-vlan standalone

    - name: create OVS bridge via ansible
      openvswitch_bridge:
        bridge: br-vlan
        state: present
EXPECTED RESULTS

All the tasks run fine.

ACTUAL RESULTS
PLAY [all] *********************************************************************

TASK [Gathering Facts] *********************************************************
ok: [ubuntu01]

TASK [update netplan] **********************************************************
changed: [ubuntu01]

TASK [install ovs stuff] *******************************************************
changed: [ubuntu01]

TASK [create bridge via ovs-vsctl] *********************************************
changed: [ubuntu01]

TASK [set fail-mode via ovs-vsctl] *********************************************
changed: [ubuntu01]

TASK [create OVS bridge via ansible] *******************************************
fatal: [ubuntu01]: FAILED! => {"changed": false, "cmd": "/usr/bin/ovs-vsctl -t 5 set-fail-mode br-vlan None", "msg": "ovs-vsctl: fail-mode must be \"standalone\" or \"secure\"", "rc": 1, "stderr": "ovs-vsctl: fail-mode must be \"standalone\" or \"secure\"\n", "stderr_lines": ["ovs-vsctl: fail-mode must be \"standalone\" or \"secure\""], "stdout": "", "stdout_lines": []}

PLAY RECAP *********************************************************************
ubuntu01                   : ok=5    changed=4    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0

openstack-mirroring pushed a commit to openstack/openstack-ansible-os_neutron that referenced this issue Mar 22, 2022
If OVS bridge was created via netplan prior to running neutron role,
then play would fail, as openvswitch_bridge would try to set fail_mode
to implicit None.

https: //github.com/ansible-collections/openvswitch.openvswitch/issues/86
Change-Id: I307ae755c21c8786e80bb224df89036d90d5e5ec
openstack-mirroring pushed a commit to openstack/openstack that referenced this issue Mar 22, 2022
* Update openstack-ansible-os_neutron from branch 'master'
  to bbdd12561f4e5800e6504d14a7810fad8631a42b
  - Merge "Set fail_mode explicitly"
  - Set fail_mode explicitly
    
    If OVS bridge was created via netplan prior to running neutron role,
    then play would fail, as openvswitch_bridge would try to set fail_mode
    to implicit None.
    
    https: //github.com/ansible-collections/openvswitch.openvswitch/issues/86
    Change-Id: I307ae755c21c8786e80bb224df89036d90d5e5ec
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants