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>
This commit is contained in:
parent
570c2492a3
commit
87b05b6a6f
|
@ -480,6 +480,10 @@ func (v *MachineVM) Start(name string, _ machine.StartOptions) error {
|
||||||
wait = time.Millisecond * 500
|
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
|
v.Starting = true
|
||||||
if err := v.writeConfig(); err != nil {
|
if err := v.writeConfig(); err != nil {
|
||||||
return fmt.Errorf("writing JSON file: %w", err)
|
return fmt.Errorf("writing JSON file: %w", err)
|
||||||
|
|
Loading…
Reference in New Issue