Change criu command line format for page server
--page-server ADDRESS:PORT Docker-DCO-1.1-Signed-off-by: Hui Kang <hkang.sunysb@gmail.com>
This commit is contained in:
parent
7a012fe3b5
commit
d278b830d9
|
@ -3,6 +3,7 @@ package main
|
|||
import (
|
||||
"fmt"
|
||||
"strconv"
|
||||
"strings"
|
||||
"github.com/codegangsta/cli"
|
||||
"github.com/docker/libcontainer"
|
||||
)
|
||||
|
@ -18,8 +19,7 @@ var checkpointCommand = cli.Command{
|
|||
cli.BoolFlag{Name: "tcp-established", Usage: "allow open tcp connections"},
|
||||
cli.BoolFlag{Name: "ext-unix-sk", Usage: "allow external unix sockets"},
|
||||
cli.BoolFlag{Name: "shell-job", Usage: "allow shell jobs"},
|
||||
cli.StringFlag{Name: "page-server", Value: "", Usage: "IP address of the page server"},
|
||||
cli.StringFlag{Name: "port", Value: "", Usage: "port number of the page server"},
|
||||
cli.StringFlag{Name: "page-server", Value: "", Usage: "ADDRESS:PORT of the page server"},
|
||||
},
|
||||
Action: func(context *cli.Context) {
|
||||
imagePath := context.String("image-path")
|
||||
|
@ -44,18 +44,18 @@ var checkpointCommand = cli.Command{
|
|||
|
||||
// xxx following criu opts are optional
|
||||
// The dump image can be sent to a criu page server
|
||||
var port string
|
||||
if psAddress := context.String("page-server"); psAddress != "" {
|
||||
if port = context.String("port"); port == "" {
|
||||
fatal(fmt.Errorf("The --port number isn't specified"))
|
||||
if psOpt := context.String("page-server"); psOpt != "" {
|
||||
addressPort := strings.Split(psOpt, ":")
|
||||
if len(addressPort) != 2 {
|
||||
fatal(fmt.Errorf("Use --page-server ADDRESS:PORT to specify page server"))
|
||||
}
|
||||
|
||||
port_int, err := strconv.Atoi(port)
|
||||
port_int, err := strconv.Atoi(addressPort[1])
|
||||
if err != nil {
|
||||
fatal(fmt.Errorf("Invalid port number"))
|
||||
}
|
||||
criuOpts.Ps = &libcontainer.CriuPageServerInfo{
|
||||
Address: psAddress,
|
||||
Address: addressPort[0],
|
||||
Port: int32(port_int),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue