1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-30 22:50:10 +03:00

B #3567: Add switch name for PG networks (#3871)

Signed-off-by: Carlos J. Herrera Matos <cherrera@opennebula.systems>
This commit is contained in:
Carlos J. Herrera 2019-10-24 17:30:43 +02:00 committed by Tino Vázquez
parent 09f4c93b0c
commit 9916084e22
2 changed files with 40 additions and 0 deletions

View File

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

View File

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