diff options
author | Peter Mikus <pmikus@cisco.com> | 2019-09-13 08:13:09 +0000 |
---|---|---|
committer | Peter Mikus <pmikus@cisco.com> | 2019-09-13 12:15:34 +0000 |
commit | 9efba1d574916eded1a6d4d8580e092a8831033b (patch) | |
tree | ea096c9afd521c0979aa7831368cca57ebf79a58 | |
parent | e2d15edc355f0c70df578dde0495f8ffd85d8c12 (diff) |
FIX: Pylint + Container mount
- Mount is affecting only LXC container
Signed-off-by: Peter Mikus <pmikus@cisco.com>
Change-Id: I84140ea5e48120792fc84182a97eb7d06c954a84
-rw-r--r-- | resources/libraries/python/ContainerUtils.py | 7 | ||||
-rw-r--r-- | resources/libraries/python/VPPUtil.py | 1 | ||||
-rw-r--r-- | resources/libraries/python/VppCounters.py | 18 |
3 files changed, 15 insertions, 11 deletions
diff --git a/resources/libraries/python/ContainerUtils.py b/resources/libraries/python/ContainerUtils.py index cd48fc6c1f..6fea804443 100644 --- a/resources/libraries/python/ContainerUtils.py +++ b/resources/libraries/python/ContainerUtils.py @@ -635,13 +635,16 @@ class LXC(ContainerEngine): if self.container.mnt: for mount in self.container.mnt: host_dir, guest_dir = mount.split(':') + if host_dir.endswith('/'): + self.container.ssh.exec_command_sudo( + "sh -c 'mkdir -p {host_dir}'".format(host_dir=host_dir)) options = 'bind,create=dir' \ if guest_dir.endswith('/') else 'bind,create=file' entry = 'lxc.mount.entry = {host_dir} '\ - '/var/lib/lxc/{c.name}/rootfs{guest_dir} none ' \ + '{guest_dir} none ' \ '{options} 0 0'.format(c=self.container, host_dir=host_dir, - guest_dir=guest_dir, + guest_dir=guest_dir[1:], options=options) ret, _, _ = self.container.ssh.exec_command_sudo( "sh -c 'echo \"{e}\" >> /var/lib/lxc/{c.name}/config'". diff --git a/resources/libraries/python/VPPUtil.py b/resources/libraries/python/VPPUtil.py index 8f9b593902..4e2b2373c4 100644 --- a/resources/libraries/python/VPPUtil.py +++ b/resources/libraries/python/VPPUtil.py @@ -17,7 +17,6 @@ from robot.api import logger from resources.libraries.python.Constants import Constants from resources.libraries.python.DUTSetup import DUTSetup -from resources.libraries.python.L2Util import L2Util from resources.libraries.python.PapiExecutor import PapiSocketExecutor from resources.libraries.python.ssh import exec_cmd_no_error from resources.libraries.python.topology import NodeType diff --git a/resources/libraries/python/VppCounters.py b/resources/libraries/python/VppCounters.py index 65d647709d..c115efcdb5 100644 --- a/resources/libraries/python/VppCounters.py +++ b/resources/libraries/python/VppCounters.py @@ -71,7 +71,7 @@ class VppCounters(object): return runtime = [] - runtime_non_zero = [] + runtime_nz = [] for name in names: runtime.append({'name': name}) @@ -100,18 +100,20 @@ class VppCounters(object): if (sum(calls_th) or sum(vectors_th) or sum(suspends_th) or sum(clocks_th)): - runtime_non_zero.append(runtime_item) + runtime_nz.append(runtime_item) if log_zeros: logger.info( - "stats runtime ({host} - {socket}):\n{runtime}".format( - host=node['host'], runtime=pformat(runtime), - socket=socket)) + "stats runtime ({host} - {socket}):\n{runtime}". + format( + host=node['host'], runtime=pformat(runtime), + socket=socket)) else: logger.info( - "stats runtime ({host} - {socket}):\n{runtime}".format( - host=node['host'], runtime=pformat(runtime_non_zero), - socket=socket)) + "stats runtime ({host} - {socket}):\n{runtime}". + format( + host=node['host'], runtime=pformat(runtime_nz), + socket=socket)) @staticmethod def vpp_show_runtime_counters_on_all_duts(nodes): |