summaryrefslogtreecommitdiff
path: root/libpod/runtime_migrate.go
diff options
context:
space:
mode:
authorGiuseppe Scrivano <gscrivan@redhat.com>2019-05-09 19:06:46 +0200
committerGiuseppe Scrivano <gscrivan@redhat.com>2019-05-17 20:48:25 +0200
commit9dabb16e6541a1b7bbb1c5a27a91e08863a5b491 (patch)
treefef3ec3b008101fbf4f056df03d16ec07be904fe /libpod/runtime_migrate.go
parent562357ebb26cacbe9a97c8c0a87c9524345158d0 (diff)
downloadpodman-9dabb16e6541a1b7bbb1c5a27a91e08863a5b491.tar.gz
podman-9dabb16e6541a1b7bbb1c5a27a91e08863a5b491.tar.bz2
podman-9dabb16e6541a1b7bbb1c5a27a91e08863a5b491.zip
system: migrate stops the pause process
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Diffstat (limited to 'libpod/runtime_migrate.go')
-rw-r--r--libpod/runtime_migrate.go35
1 files changed, 34 insertions, 1 deletions
diff --git a/libpod/runtime_migrate.go b/libpod/runtime_migrate.go
index 116885d3a..e32e6edf6 100644
--- a/libpod/runtime_migrate.go
+++ b/libpod/runtime_migrate.go
@@ -1,14 +1,47 @@
+// +build linux
+
package libpod
import (
"context"
"fmt"
+ "io/ioutil"
+ "os"
"path/filepath"
+ "strconv"
+ "syscall"
+ "github.com/containers/libpod/pkg/rootless"
+ "github.com/containers/libpod/pkg/util"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
)
+func stopPauseProcess() error {
+ if rootless.IsRootless() {
+ pausePidPath, err := util.GetRootlessPauseProcessPidPath()
+ if err != nil {
+ return errors.Wrapf(err, "could not get pause process pid file path")
+ }
+ data, err := ioutil.ReadFile(pausePidPath)
+ if err != nil {
+ if os.IsNotExist(err) {
+ return nil
+ }
+ return errors.Wrapf(err, "cannot read pause process pid file %s", pausePidPath)
+ }
+ pausePid, err := strconv.Atoi(string(data))
+ if err != nil {
+ return errors.Wrapf(err, "cannot parse pause pid file %s", pausePidPath)
+ }
+ if err := os.Remove(pausePidPath); err != nil {
+ return errors.Wrapf(err, "cannot delete pause pid file %s", pausePidPath)
+ }
+ syscall.Kill(pausePid, syscall.SIGKILL)
+ }
+ return nil
+}
+
func (r *Runtime) migrate(ctx context.Context) error {
runningContainers, err := r.GetRunningContainers()
if err != nil {
@@ -39,5 +72,5 @@ func (r *Runtime) migrate(ctx context.Context) error {
}
}
- return nil
+ return stopPauseProcess()
}