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
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user