From 08041d55d19859945bf751257eca62af425024ec Mon Sep 17 00:00:00 2001 From: rainzm Date: Mon, 14 Sep 2020 16:24:31 +0800 Subject: [PATCH] fix(esxi): return when host.Vm is empty --- pkg/multicloud/esxi/manager.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/multicloud/esxi/manager.go b/pkg/multicloud/esxi/manager.go index 362ebee75a..5148857378 100644 --- a/pkg/multicloud/esxi/manager.go +++ b/pkg/multicloud/esxi/manager.go @@ -656,6 +656,9 @@ func (cli *SESXiClient) HostVmIPs(ctx context.Context) (map[string]string, []SSi } func (cli *SESXiClient) vmIPs(host *mo.HostSystem) ([]SSimpleVM, error) { + if len(host.Vm) == 0 { + return []SSimpleVM{}, nil + } var vms []mo.VirtualMachine err := cli.references2Objects(host.Vm, VM_PROPS, &vms) if err != nil {