Merge "Add interface_type parameter"

This commit is contained in:
Jenkins 2017-02-03 01:04:23 +00:00 committed by Gerrit Code Review
commit ee3e211489
2 changed files with 30 additions and 0 deletions

View File

@ -8,6 +8,7 @@ Puppet::Type.type(:vs_port).provide(:ovs) do
has_feature :bonding
has_feature :vlan
has_feature :interface_type
commands :vsctl => 'ovs-vsctl'
@ -39,6 +40,10 @@ Puppet::Type.type(:vs_port).provide(:ovs) do
:vlan_trunks,
]
end
if @resource.provider.class.feature?(:interface_type)
sync_properties += [:interface_type,
]
end
for prop_name in sync_properties
property = @resource.property(prop_name)
property.sync unless property.safe_insync?(property.retrieve)
@ -64,6 +69,17 @@ Puppet::Type.type(:vs_port).provide(:ovs) do
vsctl(*args)
end
def interface_type
types = get_port_interface_column('type').uniq
types != nil ? types.join(' ') : :system
end
def interface_type=(value)
@resource.property(:interface).retrieve.each do |iface|
vsctl('set', 'Interface', iface, "type=#{value}")
end
end
def bond_mode
get_port_column('bond_mode')
end

View File

@ -44,6 +44,20 @@ Puppet::Type.newtype(:vs_port) do
end
end
newproperty(:interface_type, :required_features => :interface_type) do
desc "The type of network interface connected to this port.
Supported types are 'system', 'internal' and 'tap'. Currently the
interface configuration required for tunnel ports is not supported.
Currently all interfaces on a port are set to the same type. Bonding
configurations with different types on the same port are not supported."
defaultto :system
newvalues(:system, :internal, :tap)
end
newproperty(:bond_mode, :required_features => :bonding) do
desc "Interface bonding mode for this port.