1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Add parallel operation support for pause/unpause

Support parallel pause/unpause

Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
This commit is contained in:
Zhang Wei 2016-09-12 17:21:08 +08:00
parent 2155b46915
commit f1dda4395e
2 changed files with 4 additions and 2 deletions

View file

@ -34,8 +34,9 @@ func runPause(dockerCli *command.DockerCli, opts *pauseOptions) error {
ctx := context.Background()
var errs []string
errChan := parallelOperation(ctx, opts.containers, dockerCli.Client().ContainerPause)
for _, container := range opts.containers {
if err := dockerCli.Client().ContainerPause(ctx, container); err != nil {
if err := <-errChan; err != nil {
errs = append(errs, err.Error())
} else {
fmt.Fprintf(dockerCli.Out(), "%s\n", container)

View file

@ -35,8 +35,9 @@ func runUnpause(dockerCli *command.DockerCli, opts *unpauseOptions) error {
ctx := context.Background()
var errs []string
errChan := parallelOperation(ctx, opts.containers, dockerCli.Client().ContainerUnpause)
for _, container := range opts.containers {
if err := dockerCli.Client().ContainerUnpause(ctx, container); err != nil {
if err := <-errChan; err != nil {
errs = append(errs, err.Error())
} else {
fmt.Fprintf(dockerCli.Out(), "%s\n", container)