Description of problem: When navigating through https://bugzilla.redhat.com/show_bug.cgi?id=1725596, I've seen this behaviour in my scripts: [root@wsfd-netdev19 ~]# ovs-vsctl add-port br0 gre0 -- set interface gre0 type=ip6gre options:key=100 options:remote_ip=2001::2 ovs-vsctl: Error detected while setting up 'gre0': could not add network device gre0 to ofproto (Address family not supported by protocol). See ovs-vswitchd log for details. ovs-vsctl: The default log directory is "/var/log/openvswitch". [root@wsfd-netdev19 ~]# echo $? 0 Well, it's is correct because the port actually was added: [root@wsfd-netdev19 ~]# ovs-vsctl show e904851c-9eed-4041-8dd6-af304d379ca0 Bridge ovs-sriov Port "eth0" Interface "eth0" Port "bond9" Interface "bond9" Port ovs-sriov Interface ovs-sriov type: internal Bridge "br0" Port "br0" Interface "br0" type: internal Port "ns2-veth-ab" Interface "ns2-veth-ab" Port "gre0" Interface "gre0" type: "ip6gre" options: {key="100", remote_ip="2001::2"} error: "could not add network device gre0 to ofproto (Address family not supported by protocol)" ovs_version: "2.11.0" This happens with unknown interfaces as well: [root@wsfd-netdev19 ~]# ovs-vsctl add-port br0 foobar ovs-vsctl: Error detected while setting up 'foobar': could not open network device foobar (No such device). See ovs-vswitchd log for details. ovs-vsctl: The default log directory is "/var/log/openvswitch". [root@wsfd-netdev19 ~]# ovs-vsctl show e904851c-9eed-4041-8dd6-af304d379ca0 Bridge ovs-sriov Port "eth0" Interface "eth0" Port "bond9" Interface "bond9" Port ovs-sriov Interface ovs-sriov type: internal Bridge "br0" Port "br0" Interface "br0" type: internal Port foobar Interface foobar error: "could not open network device foobar (No such device)" But this is also bad because the script cannot easily detect such error condition, and so would OSP and others when adding this tunnel interface. Is there a way to make this operation more strict, and error out on such conditions? Is it actually wanted? Or to query (without parsing ovs-vsctl output) if a port is at least minimally functional? Version-Release number of selected component (if applicable): openvswitch2.11-2.11.0-14.el7fdp.x86_64
If the whole transaction succeded, the command is supposed to succeed too. Hence a 0 exit status looks reasonable.
It can be triggered by an invalid ip too: root@rhel8:~# ovs-vsctl add-port br0 gre0 -- set interface gre0 type=ip6gre options:key=100 options:remote_ip=192.168.0.300 ovs-vsctl: Error detected while setting up 'gre0': gre0: bad ip6gre 'remote_ip' gre0: ip6gre type requires valid 'remote_ip' argument. See ovs-vswitchd log for details. ovs-vsctl: The default log directory is "/var/log/openvswitch". root@rhel8:~# echo $? 0
Posted upstream: http://patchwork.ozlabs.org/project/openvswitch/list/?series=360149
Posted v3 upstream: http://patchwork.ozlabs.org/project/openvswitch/list/?series=362382