mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-01-23 02:14:37 +00:00
phaul: use relative path for parent link
Absolute paths for parent links may not work on restore. e.g: restore on a different server(during migration). See https://github.com/checkpoint-restore/criu/blob/criu-2.x-stable/criu/image.c#L432 Signed-off-by: Jacob Wen <jian.w.wen@oracle.com> Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
This commit is contained in:
parent
369b56068b
commit
5efcb6028d
1 changed files with 10 additions and 1 deletions
|
|
@ -7,6 +7,7 @@ import (
|
|||
"github.com/golang/protobuf/proto"
|
||||
"github.com/checkpoint-restore/criu/lib/go/src/criu"
|
||||
"github.com/checkpoint-restore/criu/lib/go/src/rpc"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
type PhaulServer struct {
|
||||
|
|
@ -54,7 +55,15 @@ func (s *PhaulServer) StartIter() error {
|
|||
|
||||
opts.ImagesDirFd = proto.Int32(int32(img_dir.Fd()))
|
||||
if prev_p != "" {
|
||||
opts.ParentImg = proto.String(prev_p)
|
||||
p, err := filepath.Abs(img_dir.Name())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
rel, err := filepath.Rel(p, prev_p)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
opts.ParentImg = proto.String(rel)
|
||||
}
|
||||
|
||||
pid, _, err := s.cr.StartPageServerChld(opts)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue