From ad2a8bfd2940ff156c14f47fbfdfbf801fadfa56 Mon Sep 17 00:00:00 2001 From: Gris Ge Date: Thu, 26 Nov 2020 22:37:28 +0800 Subject: [PATCH] test env: Bring test veth peer up In order to allows NetworkManager to control veth interface, the veth peer should be in up state and the veth should be marked as managed. Signed-off-by: Gris Ge --- tests/tasks/manage_test_interface.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/tasks/manage_test_interface.yml b/tests/tasks/manage_test_interface.yml index 924c1e3..f421c27 100644 --- a/tests/tasks/manage_test_interface.yml +++ b/tests/tasks/manage_test_interface.yml @@ -17,9 +17,19 @@ # veth - name: Create veth interface {{ interface }} - command: ip link add {{ interface }} type veth peer name peer{{ interface }} + command: "{{ item }}" + with_items: + - ip link add {{ interface }} type veth peer name peer{{ interface }} + - ip link set peer{{ interface }} up + - ip link set {{ interface }} up when: "type == 'veth' and state == 'present' and interface not in current_interfaces" +- name: Set up veth as managed by NetworkManager + shell: nmcli d set {{ interface }} managed true + # The varible for `network_provider` is not exists yet, + # just ignore error for initscripts + ignore_errors: yes + when: "type == 'veth' and state == 'present'" - name: Delete veth interface {{ interface }} command: ip link del {{ interface }} type veth