From bbe377bbcfa3936905755b9416e90c82bdc4032c Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Mon, 4 Dec 2023 16:59:46 +0900 Subject: [PATCH] vs_port: Remove redundant list-port check in RHEL/CentOS In case the port is not associated with any physical interfaces, the provider determines existence of the resource using the same command. So the logic may be always activated. On the other hand, in case the port is associated with a physical interface, the ovs port should be created by network scripts by ifup call, so it's not necessary to create the ovs port in advance. Change-Id: Id0c636338d41ee9da1a76ad0264c31c56446ab77 --- lib/puppet/provider/vs_port/ovs_redhat.rb | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/lib/puppet/provider/vs_port/ovs_redhat.rb b/lib/puppet/provider/vs_port/ovs_redhat.rb index 5d587686..6b62abd5 100644 --- a/lib/puppet/provider/vs_port/ovs_redhat.rb +++ b/lib/puppet/provider/vs_port/ovs_redhat.rb @@ -23,7 +23,6 @@ Puppet::Type.type(:vs_port).provide( commands :ip => 'ip' commands :ifdown => 'ifdown' commands :ifup => 'ifup' - commands :vsctl => 'ovs-vsctl' def initialize(value={}) super(value) @@ -35,16 +34,11 @@ Puppet::Type.type(:vs_port).provide( end def create - if ! bridge.exists? - raise Puppet::Error, "Bridge #{@resource[:bridge]} does not exist" - end - - unless vsctl('list-ports', - @resource[:bridge]).include? @resource[:port] - super - end - if interface_physical? + if ! bridge.exists? + raise Puppet::Error, "Bridge #{@resource[:bridge]} does not exist" + end + template = DEFAULT ovs_extra = get_ovs_extra(["set bridge #{@resource[:bridge]} fail_mode=#{@resource[:fail_mode]}"]) @@ -76,6 +70,8 @@ Puppet::Type.type(:vs_port).provide( ifdown(@resource[:port]) ifup(@resource[:port]) ifup(@resource[:bridge]) + else + super end end