diff options
author | Shane Smith <shane.smith@shopify.com> | 2022-06-02 16:31:21 -0400 |
---|---|---|
committer | Shane Smith <shane.smith@shopify.com> | 2022-06-03 10:26:12 -0400 |
commit | 87b05b6a6fbb5c407db8fddc6e89ae2bc28dda19 (patch) | |
tree | ee0fd07d443a46001f6def2880c67db3ba0cf3b3 /pkg/machine | |
parent | 570c2492a3cc596e0ac4e2cc208d1fe26166e016 (diff) | |
download | podman-87b05b6a6fbb5c407db8fddc6e89ae2bc28dda19.tar.gz podman-87b05b6a6fbb5c407db8fddc6e89ae2bc28dda19.tar.bz2 podman-87b05b6a6fbb5c407db8fddc6e89ae2bc28dda19.zip |
Prevent simultaneous machine starts
Running `podman machine start` twice at the same time in different
terminals, for example, will make the second invocation fail and the
first one hang.
[NO NEW TESTS NEEDED]
Signed-off-by: Shane Smith <shane.smith@shopify.com>
Diffstat (limited to 'pkg/machine')
-rw-r--r-- | pkg/machine/qemu/machine.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/pkg/machine/qemu/machine.go b/pkg/machine/qemu/machine.go index b9f23662e..071da94a6 100644 --- a/pkg/machine/qemu/machine.go +++ b/pkg/machine/qemu/machine.go @@ -480,6 +480,10 @@ func (v *MachineVM) Start(name string, _ machine.StartOptions) error { wait = time.Millisecond * 500 ) + if v.Starting { + return fmt.Errorf("machine %q is already in the process of being started", v.Name) + } + v.Starting = true if err := v.writeConfig(); err != nil { return fmt.Errorf("writing JSON file: %w", err) |