From 8069fee968b73833d314b41f004c8f1cb1ab6c28 Mon Sep 17 00:00:00 2001 From: Jo¶rgen Karlsson Date: Fri, 16 Oct 2015 15:27:54 +0200 Subject: Fix for netperf install in glance image MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes two issues in the chrooted environment: - /proc must be mounted when installing certain packages. - prevent services from starting when installing or updating packages. JIRA :- Signed-off-by: Jo¶rgen Karlsson Change-Id: Ia7180c190bf93c173ea93207ed323ca96662c029 --- tools/yardstick-img-modify | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'tools/yardstick-img-modify') diff --git a/tools/yardstick-img-modify b/tools/yardstick-img-modify index 48462b80b..ee9a45780 100755 --- a/tools/yardstick-img-modify +++ b/tools/yardstick-img-modify @@ -78,7 +78,9 @@ setup() { loopdevice=$(kpartx -l $raw_imgfile | head -1 | cut -f1 -d ' ') kpartx -a $raw_imgfile + mount /dev/mapper/$loopdevice $mountdir + mount -t proc none $mountdir/proc cp $cmd $mountdir/$(basename $cmd) } @@ -89,15 +91,24 @@ modify() { nameserver_ip=$(grep -m 1 '^nameserver' \ /etc/resolv.conf | awk '{ print $2 '}) + # prevent init scripts from running during install + echo $'#!/bin/sh\nexit 101' >$mountdir/usr/sbin/policy-rc.d + chmod a+x $mountdir/usr/sbin/policy-rc.d + chroot $mountdir /$(basename $cmd) $nameserver_ip + rm -rf $mountdir/usr/sbin/policy-rc.d + + umount -f $mountdir/proc umount $mountdir + qemu-img convert -c -o compat=0.10 -O qcow2 $raw_imgfile $imgfile } # cleanup (umount) the image cleanup() { # designed to be idempotent + mount | grep $mountdir/proc && umount $mountdir/proc mount | grep $mountdir && umount $mountdir if [ -f $raw_imgfile ]; then kpartx -d $raw_imgfile || true -- cgit 1.2.3-korg