1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-21 14:50:08 +03:00

F #4913: Fix some standard network bugs

This commit is contained in:
mcabrerizo 2017-04-04 17:00:47 +02:00
parent 993a5e8e63
commit b98442a591
2 changed files with 7 additions and 10 deletions

View File

@ -446,7 +446,7 @@ class ESXHost
# Update a standard vcenter switch in an ESX host
########################################################################
def update_vss(switch, name, pnics, num_ports, mtu)
pnics = pnics.split(",") if pnics
pnics = pnics.split(",") rescue []
#Backup switch spec for rollback
orig_spec = switch.spec
@ -651,10 +651,10 @@ class ESXHost
pg_name = pg.spec.name
spec = RbVmomi::VIM.HostPortGroupSpec(
:name => pg,
:vlanId => vlan_id,
:vswitchName => switch_name,
:policy => RbVmomi::VIM.HostNetworkPolicy
:name => pg_name,
:vlanId => vlan_id,
:vswitchName => switch_name,
:policy => RbVmomi::VIM.HostNetworkPolicy
)
nws = self['configManager.networkSystem']
@ -666,7 +666,7 @@ class ESXHost
end
# Set rollback operation
@net_rollback << {:action => :update_pg, :name => pgname, :spec => orig_spec}
@net_rollback << {:action => :update_pg, :name => pg_name, :spec => orig_spec}
end
end

View File

@ -138,10 +138,7 @@ else # VM is being terminated
next if !esx_host.vss_exists(switch_name)
swname = esx_host.remove_vss(switch_name)
rescue Exception => e
#TODO rollback?
raise e
ensure
esx_host.unlock # Remove lock
end
end
@ -168,7 +165,6 @@ else # VM is being terminated
dc.remove_dvs(dvs) if dvs
rescue Exception => e
#TODO rollback?
raise e
ensure
dc.unlock if dc
@ -178,6 +174,7 @@ else # VM is being terminated
rescue Exception => e
raise e
ensure
esx_host.unlock if esx_host
vi_client.close_connection if vi_client
end
end