mirror of
https://github.com/containers/podman.git
synced 2025-07-03 17:27:18 +08:00
system: migrate stops the pause process
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
@ -132,6 +132,7 @@ func setupRootless(cmd *cobra.Command, args []string) error {
|
|||||||
became, ret, err := rootless.JoinUserAndMountNS(uint(pausePid), "")
|
became, ret, err := rootless.JoinUserAndMountNS(uint(pausePid), "")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.Errorf("cannot join pause process pid %d. You may need to remove %s and stop all containers", pausePid, pausePidPath)
|
logrus.Errorf("cannot join pause process pid %d. You may need to remove %s and stop all containers", pausePid, pausePidPath)
|
||||||
|
logrus.Errorf("you can use `system migrate` to recreate the pause process")
|
||||||
logrus.Errorf(err.Error())
|
logrus.Errorf(err.Error())
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,47 @@
|
|||||||
|
// +build linux
|
||||||
|
|
||||||
package libpod
|
package libpod
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"io/ioutil"
|
||||||
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"strconv"
|
||||||
|
"syscall"
|
||||||
|
|
||||||
|
"github.com/containers/libpod/pkg/rootless"
|
||||||
|
"github.com/containers/libpod/pkg/util"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/sirupsen/logrus"
|
"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 {
|
func (r *Runtime) migrate(ctx context.Context) error {
|
||||||
runningContainers, err := r.GetRunningContainers()
|
runningContainers, err := r.GetRunningContainers()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -39,5 +72,5 @@ func (r *Runtime) migrate(ctx context.Context) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return stopPauseProcess()
|
||||||
}
|
}
|
||||||
|
11
libpod/runtime_migrate_unsupported.go
Normal file
11
libpod/runtime_migrate_unsupported.go
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
// +build !linux
|
||||||
|
|
||||||
|
package libpod
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
)
|
||||||
|
|
||||||
|
func (r *Runtime) migrate(ctx context.Context) error {
|
||||||
|
return nil
|
||||||
|
}
|
Reference in New Issue
Block a user