diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2022-04-07 06:59:32 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-07 06:59:32 -0400 |
commit | d7ff08aff46eea96a77b4e195e3497eecffd7d6c (patch) | |
tree | afa7a81f0919a90beee471c11dd4f931676f5b7c | |
parent | 6a9c21c4565a9c7ebe5c11bf4152a80cfa4398dc (diff) | |
parent | 90ac1ba2a69202fa90a021ed39855bfdbe1393a4 (diff) | |
download | podman-d7ff08aff46eea96a77b4e195e3497eecffd7d6c.tar.gz podman-d7ff08aff46eea96a77b4e195e3497eecffd7d6c.tar.bz2 podman-d7ff08aff46eea96a77b4e195e3497eecffd7d6c.zip |
Merge pull request #13796 from n1hility/no-live-set
Prevent set command from updating a running instance
-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 |