From 885a483e0f6c301a4ff122680705c4c4f9b80a4e Mon Sep 17 00:00:00 2001 From: rainzm Date: Thu, 1 Apr 2021 17:16:24 +0800 Subject: [PATCH] fix(esxi): be compatible with disconnected host --- pkg/multicloud/esxi/net_topology_pro.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/multicloud/esxi/net_topology_pro.go b/pkg/multicloud/esxi/net_topology_pro.go index c7858810f5..9fa5dcca36 100644 --- a/pkg/multicloud/esxi/net_topology_pro.go +++ b/pkg/multicloud/esxi/net_topology_pro.go @@ -533,7 +533,7 @@ func (cli *SESXiClient) getVirtualSwitchs(hss []mo.HostSystem) (SVirtualSwitchMa // vs for i := range hss { hs := hss[i] - if hs.Config.Network == nil { + if hs.Config == nil || hs.Config.Network == nil { continue } for i := range hs.Config.Network.Vswitch { @@ -570,7 +570,7 @@ func (cli *SESXiClient) getVirtualSwitchs(hss []mo.HostSystem) (SVirtualSwitchMa func (cli *SESXiClient) getVPGMap(mohost *mo.HostSystem) sVPGMap { sm := newVPGMap() - if mohost.Config.Network == nil { + if mohost.Config == nil || mohost.Config.Network == nil { return sm } for i := range mohost.Config.Network.Portgroup {