From b98442a591644e88ff6ab7c2f75fad382dfae09c Mon Sep 17 00:00:00 2001 From: mcabrerizo Date: Tue, 4 Apr 2017 17:00:47 +0200 Subject: [PATCH] F #4913: Fix some standard network bugs --- src/vmm_mad/remotes/lib/vcenter_driver/host.rb | 12 ++++++------ src/vnm_mad/remotes/vcenter/clean | 5 +---- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/vmm_mad/remotes/lib/vcenter_driver/host.rb b/src/vmm_mad/remotes/lib/vcenter_driver/host.rb index 968a827338..154de8f9f5 100644 --- a/src/vmm_mad/remotes/lib/vcenter_driver/host.rb +++ b/src/vmm_mad/remotes/lib/vcenter_driver/host.rb @@ -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 diff --git a/src/vnm_mad/remotes/vcenter/clean b/src/vnm_mad/remotes/vcenter/clean index da33f12c88..96e729f320 100755 --- a/src/vnm_mad/remotes/vcenter/clean +++ b/src/vnm_mad/remotes/vcenter/clean @@ -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