summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'cmd')
-rw-r--r--cmd/podman/machine/start.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/cmd/podman/machine/start.go b/cmd/podman/machine/start.go
index d06e04f41..4334cfc0f 100644
--- a/cmd/podman/machine/start.go
+++ b/cmd/podman/machine/start.go
@@ -7,6 +7,7 @@ import (
"github.com/containers/podman/v3/pkg/domain/entities"
"github.com/containers/podman/v3/pkg/machine"
"github.com/containers/podman/v3/pkg/machine/qemu"
+ "github.com/pkg/errors"
"github.com/spf13/cobra"
)
@@ -40,6 +41,18 @@ func start(cmd *cobra.Command, args []string) error {
if len(args) > 0 && len(args[0]) > 0 {
vmName = args[0]
}
+
+ // We only have qemu VM's for now
+ active, activeName, err := qemu.CheckActiveVM()
+ if err != nil {
+ return err
+ }
+ if active {
+ if vmName == activeName {
+ return errors.Wrapf(machine.ErrVMAlreadyRunning, "cannot start VM %s", vmName)
+ }
+ return errors.Wrapf(machine.ErrMultipleActiveVM, "cannot start VM %s. VM %s is currently running", vmName, activeName)
+ }
switch vmType {
default:
vm, err = qemu.LoadVMByName(vmName)