pkg/machine: CheckExclusiveActiveVM should also check for starting

Also make the error message there better.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
Paul Holzinger
2024-03-13 15:00:28 +01:00
parent 1dfd3d3d12
commit c9a5c4b943

View File

@ -285,8 +285,8 @@ func CheckExclusiveActiveVM(provider vmconfigs.VMProvider, mc *vmconfigs.Machine
if err != nil {
return err
}
if state == machineDefine.Running {
return fmt.Errorf("unable to start %q: machine %s already running", mc.Name, name)
if state == machineDefine.Running || state == machineDefine.Starting {
return fmt.Errorf("unable to start %q: machine %s: %w", mc.Name, name, machineDefine.ErrVMAlreadyRunning)
}
}
return nil