-
Notifications
You must be signed in to change notification settings - Fork 193
GRPC interface for Start/Remove container #469
Conversation
Signed-off-by: Wang Xu <gnawux@gmail.com>
Signed-off-by: Wang Xu <gnawux@gmail.com>
Signed-off-by: Wang Xu <gnawux@gmail.com>
- dm remove root device, file mode check, it looks it had never worked well - remove container entry in pod Signed-off-by: Wang Xu <gnawux@gmail.com>
container remove works |
- and fix create/start container procedures Signed-off-by: Wang Xu <gnawux@gmail.com>
In the above op list, there is an failure of stop. It is not a bug, the |
With carefully operation, you may add, start, stop, kill, remove a container inside a pod now @feiskyer |
Signed-off-by: Wang Xu <gnawux@gmail.com>
@@ -788,13 +801,17 @@ service PublicAPI { | |||
rpc ContainerLogs(ContainerLogsRequest) returns (stream ContainerLogsResponse) {} | |||
// ContainerCreate creates a container in specified pod | |||
rpc ContainerCreate(ContainerCreateRequest) returns (ContainerCreateResponse) {} | |||
// ContainerStart start a container in a specified pod |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: s/start/starts
} | ||
if len(args) == 0 { | ||
return fmt.Errorf("\"create\" requires a minimum of 1 argument, please provide POD spec file.\n") | ||
if copt.Remove || copt.Attach { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check whether copt
is nil before this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For help subcommand, both copt and err are nil.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about change if err != nil {
to if copt == nil {
if err == nil { | ||
fmt.Fprintf(cli.out, "container %s is successfully deleted!\n", id) | ||
} else { | ||
fmt.Fprintf(cli.err, "%v\n", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: also logs the container id for clear.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will update this. Actually this is copied from the original one, I don't know if you are depends on this behavior.
if err == nil { | ||
fmt.Fprintf(cli.out, "Pod(%s) is successfully deleted!\n", id) | ||
} else { | ||
fmt.Fprintf(cli.err, "%v\n", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: also logs the pod id for clear.
var parser = gflag.NewParser(&opts, gflag.Default) | ||
parser.Usage = "start [-c 1 -m 128]| POD_ID \n\nLaunch a 'pending' pod" | ||
var parser = gflag.NewParser(nil, gflag.Default) | ||
parser.Usage = "start POD_ID [CONTAINER_ID]\n\nLaunch a created pod or container" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
podId is not required when starting a created container, add a new -c
option for containers?
@@ -99,13 +99,14 @@ func (daemon *Daemon) CmdCreateContainer(podId string, containerArgs []byte) (st | |||
return daemon.CreateContainerInPod(podId, &c) | |||
} | |||
|
|||
func (daemon *Daemon) CmdStartContainer(podId, containerId string) error { | |||
err := daemon.StartContainer(podId, containerId) | |||
func (daemon *Daemon) CmdStartContainer(podId, containerId string) (*engine.Env, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: remove podId
from params.
return err | ||
} | ||
|
||
pod := r.Form.Get("podId") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: remove podId
attach/rm should be set to false by default. |
Hmm... you are right |
and some other fix based on the review comments Signed-off-by: Wang Xu <gnawux@gmail.com>
@feiskyer updated
|
@gnawux Still same errors on creating a new container, blocks on
|
Signed-off-by: Wang Xu <gnawux@gmail.com>
@feiskyer I pushed a new commit with more verbose logs, the successful log should be like this
|
Signed-off-by: Wang Xu <gnawux@gmail.com>
LGTM |
1 similar comment
LGTM |
Test results list in following comments.
For #462