1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

Merge pull request #3689 from iNecas/fix-virtual-switches

Fix distributed port group switches support for cloning with multiple networks
This commit is contained in:
Kevin Menard 2015-10-21 08:00:50 -04:00
commit ffcf2b0345
3 changed files with 8 additions and 9 deletions

View file

@ -7,6 +7,7 @@ module Fog
attribute :name
attribute :datacenter
attribute :accessible # reachable by at least one hypervisor
attribute :virtualswitch
def to_s
name

View file

@ -20,10 +20,11 @@ module Fog
def network_attributes network, datacenter
{
:id => managed_obj_id(network),
:name => network.name,
:accessible => network.summary.accessible,
:datacenter => datacenter,
:id => managed_obj_id(network),
:name => network.name,
:accessible => network.summary.accessible,
:datacenter => datacenter,
:virtualswitch => network.class.to_s == "DistributedVirtualPortgroup" ? network.config.distributedVirtualSwitch.name : nil
}
end
end

View file

@ -652,20 +652,17 @@ module Fog
def modify_template_nics_specs(template_path, new_nics, datacenter)
#new_spec_operation = RbVmomi::VIM::VirtualDeviceConfigSpecOperation('new')
#remove_spec_operation = RbVmomi::VIM::VirtualDeviceConfigSpecOperation('remove')
template_nics = list_vm_interfaces(template_path, datacenter).map do |old_attributes|
Fog::Compute::Vsphere::Interface.new(old_attributes)
end
specs = []
template_nics.each do |interface|
specs << create_interface(interface, interface.key, :remove)
specs << create_interface(interface, interface.key, :remove, :datacenter => datacenter)
end
new_nics.each do |interface|
specs << create_interface(interface, 0, :add)
specs << create_interface(interface, 0, :add, :datacenter => datacenter)
end
return specs