File tree Expand file tree Collapse file tree 1 file changed +11
-13
lines changed
pkg/cloud/vsphere/services/govmomi Expand file tree Collapse file tree 1 file changed +11
-13
lines changed Original file line number Diff line number Diff line change @@ -135,19 +135,17 @@ func (vms *VMService) DestroyVM(ctx *context.MachineContext) (infrav1.VirtualMac
135135 return vm , err
136136 }
137137
138- // check if VM actually exists
139- if ctx .VSphereMachine .Spec .MachineRef != "" {
140- moRefID , err := findVMByInstanceUUID (ctx )
141- if err != nil {
142- return vm , err
143- }
144- if moRefID == "" {
145- // No vm exists
146- // remove the MachineRef and set the vm state to notfound
147- ctx .VSphereMachine .Spec .MachineRef = ""
148- vm .State = infrav1 .VirtualMachineStateNotFound
149- return vm , nil
150- }
138+ // check if the vm existts
139+ moRefID , err := findVMByInstanceUUID (ctx )
140+ if err != nil {
141+ return vm , err
142+ }
143+ if moRefID == "" {
144+ // No vm exists
145+ // remove the MachineRef and set the vm state to notfound
146+ ctx .VSphereMachine .Spec .MachineRef = ""
147+ vm .State = infrav1 .VirtualMachineStateNotFound
148+ return vm , nil
151149 }
152150
153151 // VM actually exists
You can’t perform that action at this time.
0 commit comments