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:
Giuseppe Scrivano 2019-05-08 13:44:06 +02:00
parent 144244aeed
commit 2e0fef51b3
No known key found for this signature in database
GPG Key ID: E4730F97F60286ED
2 changed files with 2 additions and 19 deletions

View File

@ -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
}

View File

@ -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
}