diff --git a/zunclient/osc/v1/containers.py b/zunclient/osc/v1/containers.py index 4cd5c4fd..87532132 100644 --- a/zunclient/osc/v1/containers.py +++ b/zunclient/osc/v1/containers.py @@ -108,6 +108,13 @@ class CreateContainer(command.ShowOne): metavar='', help='Restart policy to apply when a container exits' '(no, on-failure[:max-retry], always, unless-stopped)') + parser.add_argument( + '--image-driver', + metavar='', + help='The image driver to use to pull container image. ' + 'It can have following values: ' + '"docker": pull the image from Docker Hub. ' + '"glance": pull the image from Glance. ') return parser def take_action(self, parsed_args): @@ -122,6 +129,7 @@ class CreateContainer(command.ShowOne): opts['workdir'] = parsed_args.workdir opts['labels'] = zun_utils.format_args(parsed_args.label) opts['image_pull_policy'] = parsed_args.image_pull_policy + opts['image_driver'] = parsed_args.image_driver if parsed_args.restart: opts['restart_policy'] = _check_restart_policy(parsed_args.restart) @@ -514,6 +522,13 @@ class RunContainer(command.ShowOne): metavar='', help='Restart policy to apply when a container exits' '(no, on-failure[:max-retry], always, unless-stopped)') + parser.add_argument( + '--image-driver', + metavar='', + help='The image driver to use to pull container image. ' + 'It can have following values: ' + '"docker": pull the image from Docker Hub. ' + '"glance": pull the image from Glance. ') return parser def take_action(self, parsed_args): @@ -528,6 +543,7 @@ class RunContainer(command.ShowOne): opts['workdir'] = parsed_args.workdir opts['labels'] = zun_utils.format_args(parsed_args.label) opts['image_pull_policy'] = parsed_args.image_pull_policy + opts['image_driver'] = parsed_args.image_driver if parsed_args.restart: opts['restart_policy'] = _check_restart_policy(parsed_args.restart) diff --git a/zunclient/v1/containers.py b/zunclient/v1/containers.py index a6e74fb7..33305b44 100644 --- a/zunclient/v1/containers.py +++ b/zunclient/v1/containers.py @@ -21,7 +21,7 @@ from zunclient import exceptions CREATION_ATTRIBUTES = ['name', 'image', 'command', 'cpu', 'memory', 'environment', 'workdir', 'labels', 'image_pull_policy', - 'restart_policy', 'tty', 'stdin_open'] + 'restart_policy', 'tty', 'stdin_open', 'image_driver'] class Container(base.Resource): diff --git a/zunclient/v1/containers_shell.py b/zunclient/v1/containers_shell.py index b5e8c6dc..1d10dd9f 100644 --- a/zunclient/v1/containers_shell.py +++ b/zunclient/v1/containers_shell.py @@ -120,6 +120,12 @@ def _remove_null_parms(**kwargs): action='store_true', default=False, help='Keep STDIN open even if not attached') +@utils.arg('--image-driver', + metavar='', + help='The image driver to use to pull container image. ' + 'It can have following values: ' + '"docker": pull the image from Docker Hub. ' + '"glance": pull the image from Glance. ') def do_create(cs, args): """Create a container.""" opts = {} @@ -132,6 +138,7 @@ def do_create(cs, args): opts['workdir'] = args.workdir opts['labels'] = zun_utils.format_args(args.label) opts['image_pull_policy'] = args.image_pull_policy + opts['image_driver'] = args.image_driver if args.restart: opts['restart_policy'] = _check_restart_policy(args.restart) if args.tty: @@ -402,6 +409,12 @@ def do_kill(cs, args): action='store_true', default=False, help='Keep STDIN open even if not attached') +@utils.arg('--image-driver', + metavar='', + help='The image driver to use to pull container image. ' + 'It can have following values: ' + '"docker": pull the image from Docker Hub. ' + '"glance": pull the image from Glance. ') def do_run(cs, args): """Run a command in a new container""" opts = {} @@ -414,6 +427,7 @@ def do_run(cs, args): opts['workdir'] = args.workdir opts['labels'] = zun_utils.format_args(args.label) opts['image_pull_policy'] = args.image_pull_policy + opts['image_driver'] = args.image_driver if args.restart: opts['restart_policy'] = _check_restart_policy(args.restart) if args.tty: