mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-30 22:50:10 +03:00
Signed-off-by: Carlos J. Herrera Matos <cherrera@opennebula.systems>
This commit is contained in:
parent
09f4c93b0c
commit
9916084e22
@ -471,6 +471,28 @@ class DatacenterFolder
|
||||
one_cluster = VCenterDriver::ClusterComputeResource.new_from_ref(ref, @vi_client)
|
||||
location = VCenterDriver::VIHelper.get_location(one_cluster.item)
|
||||
|
||||
one_cluster['host'].each do |host|
|
||||
begin
|
||||
esx_host = VCenterDriver::ESXHost.new_from_ref(host._ref, @vi_client)
|
||||
esx_host.lock
|
||||
|
||||
pg_inside = esx_host.get_pg_inside
|
||||
|
||||
networks.each {|ref, n|
|
||||
next if networks[ref][:sw_name]
|
||||
pg_inside.each do |vswitch, network_names|
|
||||
network_names.each do |name|
|
||||
if n['name'] == name
|
||||
networks[ref][:sw_name] = vswitch
|
||||
end
|
||||
end
|
||||
end
|
||||
}
|
||||
ensure
|
||||
esx_host.unlock if esx_host
|
||||
end
|
||||
end
|
||||
|
||||
network_obj = info['network']
|
||||
cname = info['name']
|
||||
|
||||
|
@ -951,6 +951,24 @@ class ESXHost
|
||||
return pnics_available
|
||||
end
|
||||
|
||||
########################################################################
|
||||
# Get networks inside a host
|
||||
########################################################################
|
||||
def get_pg_inside
|
||||
pg_inside = {}
|
||||
|
||||
# Get pnics in use in standard switches
|
||||
@item.config.network.vswitch.each do |vs|
|
||||
pg_inside[vs.name] = []
|
||||
vs.portgroup.each do |pg|
|
||||
pg.slice!("key-vim.host.PortGroup-")
|
||||
pg_inside[vs.name] << pg
|
||||
end
|
||||
end
|
||||
|
||||
pg_inside
|
||||
end
|
||||
|
||||
########################################################################
|
||||
# Check if proxy switch exists in host for distributed virtual switch
|
||||
########################################################################
|
||||
|
Loading…
x
Reference in New Issue
Block a user