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:
commit
ffcf2b0345
3 changed files with 8 additions and 9 deletions
|
@ -7,6 +7,7 @@ module Fog
|
||||||
attribute :name
|
attribute :name
|
||||||
attribute :datacenter
|
attribute :datacenter
|
||||||
attribute :accessible # reachable by at least one hypervisor
|
attribute :accessible # reachable by at least one hypervisor
|
||||||
|
attribute :virtualswitch
|
||||||
|
|
||||||
def to_s
|
def to_s
|
||||||
name
|
name
|
||||||
|
|
|
@ -20,10 +20,11 @@ module Fog
|
||||||
|
|
||||||
def network_attributes network, datacenter
|
def network_attributes network, datacenter
|
||||||
{
|
{
|
||||||
:id => managed_obj_id(network),
|
:id => managed_obj_id(network),
|
||||||
:name => network.name,
|
:name => network.name,
|
||||||
:accessible => network.summary.accessible,
|
:accessible => network.summary.accessible,
|
||||||
:datacenter => datacenter,
|
:datacenter => datacenter,
|
||||||
|
:virtualswitch => network.class.to_s == "DistributedVirtualPortgroup" ? network.config.distributedVirtualSwitch.name : nil
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -652,20 +652,17 @@ module Fog
|
||||||
|
|
||||||
|
|
||||||
def modify_template_nics_specs(template_path, new_nics, datacenter)
|
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|
|
template_nics = list_vm_interfaces(template_path, datacenter).map do |old_attributes|
|
||||||
Fog::Compute::Vsphere::Interface.new(old_attributes)
|
Fog::Compute::Vsphere::Interface.new(old_attributes)
|
||||||
end
|
end
|
||||||
specs = []
|
specs = []
|
||||||
|
|
||||||
template_nics.each do |interface|
|
template_nics.each do |interface|
|
||||||
specs << create_interface(interface, interface.key, :remove)
|
specs << create_interface(interface, interface.key, :remove, :datacenter => datacenter)
|
||||||
end
|
end
|
||||||
|
|
||||||
new_nics.each do |interface|
|
new_nics.each do |interface|
|
||||||
specs << create_interface(interface, 0, :add)
|
specs << create_interface(interface, 0, :add, :datacenter => datacenter)
|
||||||
end
|
end
|
||||||
|
|
||||||
return specs
|
return specs
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue