mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[vSphere] Support passing of a distributed switch for each interface.
This commit is contained in:
parent
a40a37110c
commit
3f60613cd6
3 changed files with 5 additions and 4 deletions
|
@ -13,6 +13,7 @@ module Fog
|
|||
attribute :summary
|
||||
attribute :type
|
||||
attribute :key
|
||||
attribute :virtualswitch
|
||||
|
||||
def initialize(attributes={} )
|
||||
super defaults.merge(attributes)
|
||||
|
|
|
@ -50,7 +50,7 @@ module Fog
|
|||
end
|
||||
|
||||
def create_nic_backing nic, attributes
|
||||
raw_network = get_raw_network(nic.network, attributes[:datacenter])
|
||||
raw_network = get_raw_network(nic.network, attributes[:datacenter], if nic.virtualswitch then nic.virtualswitch end)
|
||||
|
||||
if raw_network.kind_of? RbVmomi::VIM::DistributedVirtualPortgroup
|
||||
RbVmomi::VIM.VirtualEthernetCardDistributedVirtualPortBackingInfo(
|
||||
|
@ -126,4 +126,4 @@ module Fog
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -10,14 +10,14 @@ module Fog
|
|||
|
||||
protected
|
||||
|
||||
def get_raw_network(name, datacenter_name)
|
||||
def get_raw_network(name, datacenter_name, distributedswitch_name=nil)
|
||||
dc = find_raw_datacenter(datacenter_name)
|
||||
|
||||
@connection.serviceContent.viewManager.CreateContainerView({
|
||||
:container => dc.networkFolder,
|
||||
:type => ["Network"],
|
||||
:recursive => true
|
||||
}).view.select{|n| n.name == name}.first
|
||||
}).view.select { |n| n.name == name and (not distributedswitch_name or n.config.distributedVirtualSwitch.name == distributedswitch_name)}.first
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue