diff options
author | Jason T. Greene <jason.greene@redhat.com> | 2022-04-06 20:39:59 -0500 |
---|---|---|
committer | Jason T. Greene <jason.greene@redhat.com> | 2022-04-06 20:39:59 -0500 |
commit | 90ac1ba2a69202fa90a021ed39855bfdbe1393a4 (patch) | |
tree | afa7a81f0919a90beee471c11dd4f931676f5b7c /pkg/machine/qemu | |
parent | 6a9c21c4565a9c7ebe5c11bf4152a80cfa4398dc (diff) | |
download | podman-90ac1ba2a69202fa90a021ed39855bfdbe1393a4.tar.gz podman-90ac1ba2a69202fa90a021ed39855bfdbe1393a4.tar.bz2 podman-90ac1ba2a69202fa90a021ed39855bfdbe1393a4.zip |
Prevent set command from updating a running instance
Signed-off-by: Jason T. Greene <jason.greene@redhat.com>
Diffstat (limited to 'pkg/machine/qemu')
-rw-r--r-- | pkg/machine/qemu/machine.go | 13 |
1 files changed, 13 insertions, 0 deletions
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 |