Merge "Add size option to "--mount" when run container"
This commit is contained in:
commit
7010aabb8b
@ -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=<volume>,destination=<path>.")
|
||||
"the form --mount source=<volume>,destination=<path>. Or use "
|
||||
"--mount size=<size>,destination=<path> 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)
|
||||
|
Loading…
Reference in New Issue
Block a user