summaryrefslogtreecommitdiffstats
path: root/dovetail/container.py
diff options
context:
space:
mode:
authorSerenaFeng <feng.xiaowei@zte.com.cn>2018-03-09 18:46:27 +0800
committerDan Xu <xudan16@huawei.com>2018-03-15 03:44:15 +0000
commit6de223dad312a4fac4a410fc4a4a21f457c06f27 (patch)
tree7e0834e4ae33d87ba0858e5969e629a020e269fd /dovetail/container.py
parent3330fb68a80794f8df503b2956a03f57613a601a (diff)
substitute image copy with docker volume
Change-Id: Ie470d03bd168c909fd02c316523049c67a6bb095 Signed-off-by: SerenaFeng <feng.xiaowei@zte.com.cn>
Diffstat (limited to 'dovetail/container.py')
-rw-r--r--dovetail/container.py29
1 files changed, 9 insertions, 20 deletions
diff --git a/dovetail/container.py b/dovetail/container.py
index 63ce2db8..9a90a48b 100644
--- a/dovetail/container.py
+++ b/dovetail/container.py
@@ -202,34 +202,23 @@ class Container(object):
"insecure mode...")
return None
+ images_volume = ''
+ if dovetail_config[type]['config'].get('images', None):
+ images_volume = '-v {}:{}'.format(
+ dovetail_config['images_dir'],
+ dovetail_config[type]['config']['images'])
+
result_volume = ' -v %s:%s ' % (dovetail_config['result_dir'],
dovetail_config[type]['result']['dir'])
- cmd = 'sudo docker run %s %s %s %s %s %s %s %s %s /bin/bash' % \
- (opts, envs, config, hosts_config, openrc, cacert_volume,
- config_volume, result_volume, docker_image)
+ cmd = 'sudo docker run {opts} {envs} {config} {hosts_config} ' \
+ '{openrc} {cacert_volume} {config_volume} {result_volume} ' \
+ '{images_volume} {docker_image} /bin/bash'.format(**locals())
dt_utils.exec_cmd(cmd, cls.logger)
ret, container_id = \
dt_utils.exec_cmd("sudo docker ps | grep " + docker_image +
" | awk '{print $1}' | head -1", cls.logger)
cls.container_list[type] = container_id
- if 'sdnvpn' in str(testcase_name):
- prefix_path = dt_cfg.dovetail_config[type]['config']['dir']
- file_name = dt_cfg.dovetail_config['sdnvpn_image']
- src_path = os.path.join(prefix_path, 'pre_config', file_name)
- dest_path = '/home/opnfv/functest/images'
- Container.pre_copy(container_id, src_path, dest_path)
-
- if type.lower() == 'functest':
- prefix_path = dt_cfg.dovetail_config[type]['config']['dir']
- images = ['cirros_image', 'ubuntu14_image', 'cloudify_image',
- 'trusty_image']
- for image in images:
- file_name = dt_cfg.dovetail_config[image]
- src_path = os.path.join(prefix_path, 'pre_config', file_name)
- dest_path = '/home/opnfv/functest/images'
- Container.pre_copy(container_id, src_path, dest_path)
-
if type.lower() == 'yardstick':
cls.set_yardstick_conf_file(container_id)