diff --git a/zunclient/common/utils.py b/zunclient/common/utils.py index c9382564..2876e20b 100644 --- a/zunclient/common/utils.py +++ b/zunclient/common/utils.py @@ -200,10 +200,12 @@ def parse_command(command): def parse_mounts(mounts): err_msg = ("Invalid mounts argument '%s'. mounts arguments must be of " - "the form --mount source=,destination=.") + "the form --mount source=,destination=. Or use " + "--mount size=,destination= to create a new volume " + "and mount to the container") parsed_mounts = [] for mount in mounts: - mount_info = {"source": "", "destination": ""} + mount_info = {"source": "", "destination": "", "size": ""} for mnt in mount.split(","): try: k, v = mnt.split("=", 1) @@ -218,7 +220,10 @@ def parse_mounts(mounts): else: raise apiexec.CommandError(err_msg % mnt) - if not mount_info['source'] or not mount_info['destination']: + if not mount_info['destination']: + raise apiexec.CommandError(err_msg % mnt) + + if not mount_info['source'] and not mount_info['size']: raise apiexec.CommandError(err_msg % mnt) parsed_mounts.append(mount_info)