Skip to content

Commit 2ff4342

Browse files
committed
applehv: machine tests for stop and rm
change behaviour of stopped a stopped/exited machine to match qemu in that stopping a stopped machine is NOT an error. add condition to machine rm where rm is not run twice due to a logic error [NO NEW TESTS NEEDED] Signed-off-by: Brent Baude <bbaude@redhat.com>
1 parent 94f47d6 commit 2ff4342

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

pkg/machine/applehv/machine.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -681,7 +681,7 @@ func (m *MacMachine) Stop(name string, opts machine.StopOptions) error {
681681
}
682682

683683
if vmState != machine.Running {
684-
return machine.ErrWrongState
684+
return nil
685685
}
686686

687687
defer func() {

pkg/machine/applehv/rest.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,10 @@ func (vf *VfkitHelper) stop(force, wait bool) error {
9494
if err := vf.stateChange(define.HardStop); err != nil {
9595
return err
9696
}
97-
}
98-
if err := vf.stateChange(define.Stop); err != nil {
99-
return err
97+
} else {
98+
if err := vf.stateChange(define.Stop); err != nil {
99+
return err
100+
}
100101
}
101102
if !wait {
102103
return nil

0 commit comments

Comments
 (0)