mirror of https://github.com/containers/podman.git
migrate: not create a new namespace
this leaves the containers stopped but we won't risk to use the wrong user namespace. Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
parent
144244aeed
commit
2e0fef51b3
|
|
@ -966,18 +966,6 @@ func makeRuntime(ctx context.Context, runtime *Runtime) (err error) {
|
|||
runtime.valid = true
|
||||
|
||||
if runtime.doMigrate {
|
||||
if os.Geteuid() != 0 {
|
||||
aliveLock.Unlock()
|
||||
locked = false
|
||||
|
||||
became, ret, err := rootless.BecomeRootInUserNS()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if became {
|
||||
os.Exit(ret)
|
||||
}
|
||||
}
|
||||
if err := runtime.migrate(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package libpod
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
|
|
@ -21,7 +22,7 @@ func (r *Runtime) migrate(ctx context.Context) error {
|
|||
|
||||
logrus.Infof("stopping all containers")
|
||||
for _, ctr := range runningContainers {
|
||||
logrus.Infof("stopping %s", ctr.ID())
|
||||
fmt.Printf("stopped %s\n", ctr.ID())
|
||||
if err := ctr.Stop(); err != nil {
|
||||
return errors.Wrapf(err, "cannot stop container %s", ctr.ID())
|
||||
}
|
||||
|
|
@ -38,11 +39,5 @@ func (r *Runtime) migrate(ctx context.Context) error {
|
|||
}
|
||||
}
|
||||
|
||||
for _, ctr := range runningContainers {
|
||||
if err := ctr.Start(ctx, true); err != nil {
|
||||
logrus.Errorf("error restarting container %s", ctr.ID())
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue