summaryrefslogtreecommitdiff
path: root/cmd/podman
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2022-06-09 16:23:25 -0400
committerGitHub <noreply@github.com>2022-06-09 16:23:25 -0400
commitf808907d85204a2a5606067eb31400aa12233635 (patch)
tree87aff4de960c2e760d021018d0ae7e3e6b53744b /cmd/podman
parent6a2c0e96011d36e5b459a010d472facd26c67389 (diff)
parent81153ffa21c5d29abb8ebadffaa19b4e02e4bc60 (diff)
downloadpodman-f808907d85204a2a5606067eb31400aa12233635.tar.gz
podman-f808907d85204a2a5606067eb31400aa12233635.tar.bz2
podman-f808907d85204a2a5606067eb31400aa12233635.zip
Merge pull request #14469 from shanesmith/prevent-simultaneous-machine-starts
Prevent simultaneous machine starts
Diffstat (limited to 'cmd/podman')
-rw-r--r--cmd/podman/machine/list.go9
-rw-r--r--cmd/podman/machine/start.go2
2 files changed, 8 insertions, 3 deletions
diff --git a/cmd/podman/machine/list.go b/cmd/podman/machine/list.go
index 5254d50cf..bb14d4a67 100644
--- a/cmd/podman/machine/list.go
+++ b/cmd/podman/machine/list.go
@@ -48,6 +48,7 @@ type ListReporter struct {
Default bool
Created string
Running bool
+ Starting bool
LastUp string
Stream string
VMType string
@@ -224,10 +225,14 @@ func toHumanFormat(vms []*machine.ListResponse) ([]*ListReporter, error) {
} else {
response.Name = vm.Name
}
- if vm.Running {
+ switch {
+ case vm.Running:
response.LastUp = "Currently running"
response.Running = true
- } else {
+ case vm.Starting:
+ response.LastUp = "Currently starting"
+ response.Starting = true
+ default:
response.LastUp = units.HumanDuration(time.Since(vm.LastUp)) + " ago"
}
response.Created = units.HumanDuration(time.Since(vm.CreatedAt)) + " ago"
diff --git a/cmd/podman/machine/start.go b/cmd/podman/machine/start.go
index c9b99e63b..3bd7f4a25 100644
--- a/cmd/podman/machine/start.go
+++ b/cmd/podman/machine/start.go
@@ -56,7 +56,7 @@ func start(_ *cobra.Command, args []string) error {
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)
+ return errors.Wrapf(machine.ErrMultipleActiveVM, "cannot start VM %s. VM %s is currently running or starting", vmName, activeName)
}
fmt.Printf("Starting machine %q\n", vmName)
if err := vm.Start(vmName, machine.StartOptions{}); err != nil {