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 • committed by openshift-cherrypick-robot
parent 1ca93f3fb6
commit 412648207d

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