Revert "Support the option volume_binds of docker run"

This revert is necessary for fixing the breakage of the CLI.
The breakage is due to the fact that this feature hasn't been
implemented yet in server. We need to wait for the server
patch [1] to be merged before considering merging the patch in
client side.

[1] https://review.openstack.org/#/c/512000/

Closes-Bug: #1747280
This reverts commit c19ffb5a02.

Change-Id: I177444be609d089716d8d3cf45a285ec9f0b1b31
This commit is contained in:
Hongbin Lu
2018-02-04 18:24:51 +00:00
parent c19ffb5a02
commit cf365a0555
2 changed files with 6 additions and 11 deletions

View File

@@ -200,13 +200,12 @@ def parse_command(command):
def parse_mounts(mounts):
err_msg = ("Invalid mounts argument '%s'. mounts arguments must be of "
"the form --mount type=<local|cinder>,source=<volume>,"
"destination=<path>. Or use --mount type=<local|cinder>,"
"size=<size>,destination=<path> to create a new volume "
"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 = {"type": "", "source": "", "destination": "", "size": ""}
mount_info = {"source": "", "destination": "", "size": ""}
for mnt in mount.split(","):
try:
k, v = mnt.split("=", 1)
@@ -221,15 +220,11 @@ def parse_mounts(mounts):
else:
raise apiexec.CommandError(err_msg % mnt)
if mount_info['type'] not in ["local", "cinder"]:
raise apiexec.CommandError(err_msg % mnt)
if not mount_info['destination']:
raise apiexec.CommandError(err_msg % mnt)
if mount_info['type'] == 'cinder':
if not mount_info['source'] and not mount_info['size']:
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)
return parsed_mounts

View File

@@ -166,7 +166,7 @@ class ShellTest(shell_test_base.TestCommandLineArgument):
self, mock_run, mock_show_container):
mock_run.return_value = 'container'
self._test_arg_success(
'run --mount type=local,source=s,destination=d x')
'run --mount source=s,destination=d x')
mock_show_container.assert_called_once_with('container')
def test_zun_container_run_with_mount_invalid_format(self):