[CRIU] [PATCH] phaul: use relative path for parent link

Andrei Vagin avagin at virtuozzo.com
Sat Nov 25 21:03:28 MSK 2017


Applied, thanks!

On Mon, Nov 20, 2017 at 04:03:43PM +0800, Jacob Wen wrote:
> 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 at oracle.com>
> ---
>  phaul/src/phaul/server.go | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/phaul/src/phaul/server.go b/phaul/src/phaul/server.go
> index 0994fb9..7449e63 100644
> --- a/phaul/src/phaul/server.go
> +++ b/phaul/src/phaul/server.go
> @@ -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)
> -- 
> 2.7.4
> 


More information about the CRIU mailing list