1
0
Fork 0
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:
Marc Grimme 2013-09-27 09:54:29 +02:00
parent a40a37110c
commit 3f60613cd6
3 changed files with 5 additions and 4 deletions

View file

@ -13,6 +13,7 @@ module Fog
attribute :summary
attribute :type
attribute :key
attribute :virtualswitch
def initialize(attributes={} )
super defaults.merge(attributes)

View file

@ -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

View file

@ -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