Skip to content

Commit

Permalink
Merge pull request #113 from openshift-cherrypick-robot/cherry-pick-1…
Browse files Browse the repository at this point in the history
…12-to-v0.7

[v0.7] Refresh VM state before attempting to rm
  • Loading branch information
openshift-merge-bot[bot] authored Mar 22, 2024
2 parents 71d475f + 92fec52 commit d71a1f8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/hypervctl/vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -568,8 +568,12 @@ func (vm *VirtualMachine) remove() (int32, error) {
srv *wmiext.Service
)

refreshVM, err := vm.vmm.GetMachine(vm.ElementName)
if err != nil {
return 0, err
}
// Check for disabled/stopped state
if !Disabled.equal(vm.EnabledState) {
if !Disabled.equal(refreshVM.EnabledState) {
return -1, ErrMachineStateInvalid
}
if srv, err = NewLocalHyperVService(); err != nil {
Expand Down

0 comments on commit d71a1f8

Please sign in to comment.