From 90ac1ba2a69202fa90a021ed39855bfdbe1393a4 Mon Sep 17 00:00:00 2001 From: "Jason T. Greene" Date: Wed, 6 Apr 2022 20:39:59 -0500 Subject: Prevent set command from updating a running instance Signed-off-by: Jason T. Greene --- pkg/machine/qemu/machine.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pkg/machine/qemu/machine.go b/pkg/machine/qemu/machine.go index 5d1ba511c..81bc98098 100644 --- a/pkg/machine/qemu/machine.go +++ b/pkg/machine/qemu/machine.go @@ -439,6 +439,19 @@ func (v *MachineVM) Set(_ string, opts machine.SetOptions) error { return nil } + running, err := v.isRunning() + if err != nil { + return err + } + + if running { + suffix := "" + if v.Name != machine.DefaultMachineName { + suffix = " " + v.Name + } + return errors.Errorf("cannot change setting while the vm is running, run 'podman machine stop%s' first", suffix) + } + changeCon, err := machine.AnyConnectionDefault(v.Name, v.Name+"-root") if err != nil { return err -- cgit v1.2.3-54-g00ecf