From 1c7b564caad7364aa4b5a1aff0552e9a9662950e Mon Sep 17 00:00:00 2001 From: ioito <qu_xuan@icloud.com> Date: Fri, 27 Oct 2023 16:17:55 +0800 Subject: [PATCH] fix: esxi vm delete --- pkg/multicloud/esxi/virtualmachine.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/multicloud/esxi/virtualmachine.go b/pkg/multicloud/esxi/virtualmachine.go index ad583c6a3..d33c126be 100644 --- a/pkg/multicloud/esxi/virtualmachine.go +++ b/pkg/multicloud/esxi/virtualmachine.go @@ -250,6 +250,12 @@ func (svm *SVirtualMachine) Refresh() error { var moObj mo.VirtualMachine err := svm.manager.reference2Object(svm.object.Reference(), VIRTUAL_MACHINE_PROPS, &moObj) if err != nil { + if e := errors.Cause(err); soap.IsSoapFault(e) { + _, ok := soap.ToSoapFault(e).VimFault().(types.ManagedObjectNotFound) + if ok { + return cloudprovider.ErrNotFound + } + } return err } base.object = &moObj