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>
This commit is contained in:
Brent Baude
2023-09-26 15:28:05 -05:00
parent 94f47d6f66
commit 2ff43429f7
2 changed files with 5 additions and 4 deletions

View File

@ -681,7 +681,7 @@ func (m *MacMachine) Stop(name string, opts machine.StopOptions) error {
} }
if vmState != machine.Running { if vmState != machine.Running {
return machine.ErrWrongState return nil
} }
defer func() { defer func() {

View File

@ -94,9 +94,10 @@ func (vf *VfkitHelper) stop(force, wait bool) error {
if err := vf.stateChange(define.HardStop); err != nil { if err := vf.stateChange(define.HardStop); err != nil {
return err return err
} }
} } else {
if err := vf.stateChange(define.Stop); err != nil { if err := vf.stateChange(define.Stop); err != nil {
return err return err
}
} }
if !wait { if !wait {
return nil return nil