summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorJo¶rgen Karlsson <jorgen.w.karlsson@ericsson.com>2015-10-16 15:27:54 +0200
committerJo¶rgen Karlsson <jorgen.w.karlsson@ericsson.com>2015-10-16 15:27:54 +0200
commit8069fee968b73833d314b41f004c8f1cb1ab6c28 (patch)
treede83af2963fba53158a66abc10af7e2690d431c2 /tools
parent6bf31ef144d025d47dd8fb3770190b3fb42eed2d (diff)
Fix for netperf install in glance image
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 <jorgen.w.karlsson@ericsson.com> Change-Id: Ia7180c190bf93c173ea93207ed323ca96662c029
Diffstat (limited to 'tools')
-rwxr-xr-xtools/yardstick-img-modify11
1 files changed, 11 insertions, 0 deletions
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