File tree 1 file changed +11
-13
lines changed
pkg/cloud/vsphere/services/govmomi
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
135
135
return vm , err
136
136
}
137
137
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
151
149
}
152
150
153
151
// VM actually exists
You can’t perform that action at this time.
0 commit comments