Skip to content

OVS role follow up minor issues #219

Description

@dann1

Description
After some more testing we found out some minor problems we would like to have addresses in the OVS role.

Interfaces in UP

By default, with NetworkManager, all of the interfaces are set in UP state (unless the link is physically down). After the opennebula-ovs unit switches over networking from NetworkManager only the used interfaces will be in UP.

We need the openvswitch role to handle this. Before the one-deploy implementation we had this other systemd unit that did this task

[Unit]
Description=Enable Physical Network Interfaces
Before=openvswitch.service network-online.target
After=network-pre.target
DefaultDependencies=no

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/bin/bash -c 'for iface in /sys/class/net/*; do dev=$(basename $iface); if [ -d $iface/device ] && [ "$dev" != "lo" ]; then ip link set dev $dev up; fi; done'

[Install]
WantedBy=multi-user.target

perhaps it is useful as a reference for the official implementation. It also works with the current OVS role.

Without this, the next power cycle will have a lot of interfaces in DOWN state.

This issue sort of ties to #218 as blacklisting the OVS interfaces from NetworkManager also solves the problem at hand, which is downed links.

VLAN Tagged Management interface

If the management IP used for the SSH connection exists in a VLAN interface, the script generated by the opennebula-ovs.sh script will only try to flush the address from the real interface

14: ens3f0.741@vmnic6: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 6c:fe:54:99:6a:90 brd ff:ff:ff:ff:ff:ff
    inet 172.23.16.23/24 brd 172.23.16.255 scope global noprefixroute ens3f0.741
       valid_lft forever preferred_lft forever
    inet6 fe80::4f0f:fbf0:fdb0:8b80/64 scope link noprefixroute
       valid_lft forever preferred_lft forever
[root@nfhhvbcnlb03 ~]# ip addr show ovsbr0
1044: ovsbr0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default qlen 1000
    link/ether 6c:fe:54:99:65:b0 brd ff:ff:ff:ff:ff:ff
    inet 172.23.16.23/24 metric 400 scope global ovsbr0
       valid_lft forever preferred_lft forever
    inet6 fe80::6efe:54ff:fe99:65b0/64 scope link
       valid_lft forever preferred_lft forever

In the next power cycle it will be lost, and is actually harmless, but it is a leftover. Ideally the logic should automatically detect if this is the case. Or, for example, see if a tag is being set in the internal bridge port, which is usually what is stated in the inventory when accessing a host with a vlan tag in the management interface

14: ens3f0.741@vmnic6: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 6c:fe:54:99:6a:90 brd ff:ff:ff:ff:ff:ff
    inet 172.23.16.23/24 brd 172.23.16.255 scope global noprefixroute ens3f0.741
       valid_lft forever preferred_lft forever
    inet6 fe80::4f0f:fbf0:fdb0:8b80/64 scope link noprefixroute
       valid_lft forever preferred_lft forever
[root@nfhhvbcnlb03 ~]# ip addr show ovsbr0
1044: ovsbr0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default qlen 1000
    link/ether 6c:fe:54:99:65:b0 brd ff:ff:ff:ff:ff:ff
    inet 172.23.16.23/24 metric 400 scope global ovsbr0
       valid_lft forever preferred_lft forever
    inet6 fe80::6efe:54ff:fe99:65b0/64 scope link
       valid_lft forever preferred_lft forever

The openvswitch role targets the frontend group

The condition to install the selinux changes is to check whether the openvswitch user exists or not. When declaring the same host in frontend group and node group, we get a lock, similar to what happens when package installation tasks occur

TASK [opennebula.deploy.openvswitch : Create custom SELinux policy for DPDK / Libvirt shared sockets] ****************************************************************************
Wednesday 03 June 2026  18:47:42 +0200 (0:00:00.642)       0:04:31.957 ********
fatal: [kvm1]: FAILED! =>
    changed: false
    cmd: |-
        set -o errexit
        TDIR="$(mktemp -d)" && trap "rm -rf $TDIR" EXIT ERR
        tee "$TDIR/dpdk_virt.te"
        if (cd "$TDIR" && semodule -E dpdk_virt); then
          BEFORE="$(cksum $TDIR/dpdk_virt.pp)"
        else
          BEFORE=""
        fi
        checkmodule -M -m -o "$TDIR/dpdk_virt.mod" "$TDIR/dpdk_virt.te"
        semodule_package -o "$TDIR/dpdk_virt.pp" -m "$TDIR/dpdk_virt.mod"
        AFTER="$(cksum $TDIR/dpdk_virt.pp)"
        if [[ "$AFTER" == "$BEFORE" ]]; then
          exit 0
        else
          semodule -i "$TDIR/dpdk_virt.pp"
          exit 78 # EREMCHG
        fi
    delta: '0:00:05.031798'
    end: '2026-06-03 12:47:47.326165'
    failed_when_result: true
    msg: non-zero return code
    rc: 1
    start: '2026-06-03 12:47:42.294367'
    stderr: |-
        semodule:  Failed on dpdk_virt!
        libsemanage.semanage_get_lock: Could not get direct transaction lock at /var/lib/selinux/targeted/semanage.trans.LOCK. (Resource temporarily unavailable).
        semodule:  Failed on /tmp/tmp.afmYSlfX8Z/dpdk_virt.pp!
    stderr_lines: <omitted>
    stdout: |-
        module dpdk_virt 1.0;
        require {
            type openvswitch_t;
            type virt_var_run_t;
            class dir { search getattr read open };
            class sock_file { write getattr append };
        }
        allow openvswitch_t virt_var_run_t:dir { search getattr read open };
        allow openvswitch_t virt_var_run_t:sock_file { write getattr append };
    stdout_lines: <omitted></omitted>

In this case I had kvm1 and fe1 be the same host. So, the task ran successfully in fe1 (because openvswitch is installed) and then failed in kvm1 because it was already running in fe1 which is kvm1.

When running it again with a different frontend it went well

skipping: [fe1] => (item={'path': '/var/run/one/', 'entity': 'openvswitch', 'permissions': 'rx'})  =>
    ansible_loop_var: item
    changed: false
    false_condition: _has_openvswitch_user
    item:
        entity: openvswitch
        path: /var/run/one/
        permissions: rx
    skip_reason: Conditional result was False
skipping: [fe1] => (item={'path': '/var/run/one/vhost-socks/', 'entity': 'openvswitch', 'permissions': 'rx'})  =>
    ansible_loop_var: item
    changed: false
    false_condition: _has_openvswitch_user
    item:
        entity: openvswitch
        path: /var/run/one/vhost-socks/
        permissions: rx
    skip_reason: Conditional result was False
skipping: [fe1] => (item={'path': '/var/run/one/vhost-socks/', 'entity': 'openvswitch', 'permissions': 'rwX', 'default': True})  =>
    ansible_loop_var: item
    changed: false
    false_condition: _has_openvswitch_user
    item:
        default: true
        entity: openvswitch
        path: /var/run/one/vhost-socks/
        permissions: rwX
    skip_reason: Conditional result was False
skipping: [fe1] =>
    changed: false
    msg: All items skipped

however, if for some reason openvswitch is installed in the frontend (like when doing fe + kvm in the same host) the role will try to do selinux stuff in the frontend.

So, maybe better if we skip running openvswitch role tasks in the frontend group ?

SRIOV renaming with 128*4 VF

I got an error about a list index out of range when trying to rename 4 sets of 128 VF.

This was the inventory

        # PF
        - address: "0000:16:00.0"
          set_name: vmnic7
          set_numvfs: max # activate all VF on this PF
          unlisted: true # skip PF monitoring to avoid accidental PT
          set_switchdev: true # switchdev mode, requires hw and driver support
        - address: "0000:16:00.1"
          set_name: vmnic8
          unlisted: true # skip PF monitoring to avoid accidental PT
          set_numvfs: max # activate all VF on this PF
          set_switchdev: true # switchdev mode, requires hw and driver support
        - address: "0000:40:00.0"
          set_name: vmnic1
          set_numvfs: max # activate all VF on this PF
          unlisted: true # skip PF monitoring to avoid accidental PT
          set_switchdev: true # switchdev mode, requires hw and driver support
        - address: "0000:40:00.1"
          set_name: vmnic4
          unlisted: true # skip PF monitoring to avoid accidental PT
          set_numvfs: max # activate all VF on this PF
          set_switchdev: true # switchdev mode, requires hw and driver support

        # VF
        - vendor: "8086" # intel
          device: "159b" # 810 vf device
          class: "0200"
          set_driver: vfio-pci
          set_name: "pf{1[1]}{1[3]}vf{2}"
          virtual: true
          unlisted: false

I can't show the output right as I didn't copy it and I can't run this server again, but the #VF section renaming failed. This is another server with 810 instead of mellanox. The mellanox server had 2 PF with 8 VF each. This one has 4 PF with 128 VF each. Is the set_name logic or declaration wrong in there ?

This is not OVS related though, but found within the same context.

Let me know if it's better to open an issue for each of these or per role.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Fields

No fields configured for Feature.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions