X-Git-Url: https://gerrit.fd.io/r/gitweb?p=csit.git;a=blobdiff_plain;f=resources%2Flibraries%2Fpython%2FContainerUtils.py;h=786a4013de808da83805e04e2606abe680f427da;hp=478a9781a023823920370adbf9d414c6d45b7b75;hb=5075d208e29ece6bfd8cf4aa5289dd0b2ade583c;hpb=6abab7084716f4dc322574837b23f26a2ca9e2cb diff --git a/resources/libraries/python/ContainerUtils.py b/resources/libraries/python/ContainerUtils.py index 478a9781a0..786a4013de 100644 --- a/resources/libraries/python/ContainerUtils.py +++ b/resources/libraries/python/ContainerUtils.py @@ -20,7 +20,6 @@ from collections import OrderedDict, Counter from resources.libraries.python.ssh import SSH from resources.libraries.python.constants import Constants -from resources.libraries.python.CpuUtils import CpuUtils from resources.libraries.python.topology import Topology from resources.libraries.python.VppConfigGenerator import VppConfigGenerator @@ -78,24 +77,6 @@ class ContainerManager(object): setattr(self.engine.container, 'env', 'MICROSERVICE_LABEL={label}'.format(label=kwargs['name'])) - # Set cpuset.cpus cgroup - skip_cnt = kwargs['cpu_skip'] - smt_used = CpuUtils.is_smt_enabled(kwargs['node']['cpuinfo']) - if not kwargs['cpu_shared']: - skip_cnt += kwargs['i'] * kwargs['cpu_count'] - self.engine.container.cpuset_cpus = \ - CpuUtils.cpu_slice_of_list_per_node(node=kwargs['node'], - cpu_node=kwargs['cpuset_mems'], - skip_cnt=skip_cnt, - cpu_cnt=1, - smt_used=False) \ - + \ - CpuUtils.cpu_slice_of_list_per_node(node=kwargs['node'], - cpu_node=kwargs['cpuset_mems'], - skip_cnt=skip_cnt+1, - cpu_cnt=kwargs['cpu_count']-1, - smt_used=smt_used) - # Store container instance self.containers[kwargs['name']] = self.engine.container @@ -326,19 +307,22 @@ class ContainerEngine(object): """Install VPP inside a container.""" self.execute('ln -s /dev/null /etc/sysctl.d/80-vpp.conf') self.execute('apt-get update') - if self.container.install_dkms: - self.execute( - 'apt-get install -y dkms && ' - 'dpkg -i --force-all ' - '{guest_dir}/openvpp-testing/download_dir/*.deb'. - format(guest_dir=self.container.mnt[0].split(':')[1])) - else: - self.execute( - 'for i in $(ls -I \"*dkms*\" ' - '{guest_dir}/openvpp-testing/download_dir/); do ' - 'dpkg -i --force-all ' - '{guest_dir}/openvpp-testing/download_dir/$i; done'. - format(guest_dir=self.container.mnt[0].split(':')[1])) + # Workaround for install xenial vpp build on bionic ubuntu. + self.execute('apt-get install -y wget') + self.execute('deb=$(mktemp) && wget -O "${deb}" ' + 'http://launchpadlibrarian.net/336117627/' + 'libmbedcrypto0_2.5.1-1ubuntu1_amd64.deb && ' + 'dpkg -i "${deb}" && ' + 'rm -f "${deb}"') + self.execute('deb=$(mktemp) && wget -O "${deb}" ' + 'http://launchpadlibrarian.net/252876048/' + 'libboost-system1.58.0_1.58.0+dfsg-5ubuntu3_amd64.deb && ' + 'dpkg -i "${deb}" && ' + 'rm -f "${deb}"') + self.execute( + 'dpkg -i --force-all ' + '{guest_dir}/openvpp-testing/download_dir/*.deb'. + format(guest_dir=self.container.mnt[0].split(':')[1])) self.execute('apt-get -f install -y') self.execute('apt-get install -y ca-certificates') self.execute('echo "{config}" >> {config_file}'. @@ -685,10 +669,10 @@ class Docker(ContainerEngine): else: return - image = self.container.image if self.container.image else\ - "ubuntu:xenial-20180412" + if not self.container.image: + setattr(self.container, 'image', 'snergster/csit-sut:latest') - cmd = 'docker pull {image}'.format(image=image) + cmd = 'docker pull {image}'.format(image=self.container.image) ret, _, _ = self.container.ssh.exec_command_sudo(cmd, timeout=1800) if int(ret) != 0: