criuSwrk: prepare for CRIU VERSION RPC
To use the CRIU VERSION RPC the criuSwrk function is adapted to work with CriuOpts set to 'nil' as CriuOpts is not required for the VERSION RPC. Also do not print c.criuVersion if it is '0' as the first RPC call will always be the VERSION call and only after that the version will be known. Signed-off-by: Adrian Reber <areber@redhat.com>
This commit is contained in:
parent
c5f0ce979b
commit
c71d9cd447
|
@ -1059,7 +1059,14 @@ func (c *linuxContainer) criuSwrk(process *Process, req *criurpc.CriuReq, opts *
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
logPath := filepath.Join(opts.WorkDirectory, req.GetOpts().GetLogFile())
|
var logPath string
|
||||||
|
if opts != nil {
|
||||||
|
logPath = filepath.Join(opts.WorkDirectory, req.GetOpts().GetLogFile())
|
||||||
|
} else {
|
||||||
|
// For the VERSION RPC 'opts' is set to 'nil' and therefore
|
||||||
|
// opts.WorkDirectory does not exist. Set logPath to "".
|
||||||
|
logPath = ""
|
||||||
|
}
|
||||||
criuClient := os.NewFile(uintptr(fds[0]), "criu-transport-client")
|
criuClient := os.NewFile(uintptr(fds[0]), "criu-transport-client")
|
||||||
criuClientFileCon, err := net.FileConn(criuClient)
|
criuClientFileCon, err := net.FileConn(criuClient)
|
||||||
criuClient.Close()
|
criuClient.Close()
|
||||||
|
@ -1074,7 +1081,11 @@ func (c *linuxContainer) criuSwrk(process *Process, req *criurpc.CriuReq, opts *
|
||||||
defer criuServer.Close()
|
defer criuServer.Close()
|
||||||
|
|
||||||
args := []string{"swrk", "3"}
|
args := []string{"swrk", "3"}
|
||||||
|
if c.criuVersion != 0 {
|
||||||
|
// If the CRIU Version is still '0' then this is probably
|
||||||
|
// the initial CRIU run to detect the version. Skip it.
|
||||||
logrus.Debugf("Using CRIU %d at: %s", c.criuVersion, c.criuPath)
|
logrus.Debugf("Using CRIU %d at: %s", c.criuVersion, c.criuPath)
|
||||||
|
}
|
||||||
logrus.Debugf("Using CRIU with following args: %s", args)
|
logrus.Debugf("Using CRIU with following args: %s", args)
|
||||||
cmd := exec.Command(c.criuPath, args...)
|
cmd := exec.Command(c.criuPath, args...)
|
||||||
if process != nil {
|
if process != nil {
|
||||||
|
|
Loading…
Reference in New Issue