aboutsummaryrefslogtreecommitdiffstats
path: root/tools/yardstick-img-modify
diff options
context:
space:
mode:
authorJo¶rgen Karlsson <jorgen.w.karlsson@ericsson.com>2015-10-02 10:18:17 +0200
committerJo¶rgen Karlsson <jorgen.w.karlsson@ericsson.com>2015-10-14 16:19:20 +0200
commitd03858bbac357b6d705c7137d2d20d5c8e34ecc6 (patch)
tree729aa5b9665120c4c836557b2eb67d4d48229031 /tools/yardstick-img-modify
parent882af7878ab8119fede93a215c9e402023f817be (diff)
Docker container for Yardstick CI
The Docker container is intended to be run by the CI pipeline but it may also be used stand alone. Building the docker image: $ cd yardstick/ci/docker $ make clean && make Pushing image to docker hub: $ docker login ... (credentials needed) $ docker push opnfv/yardstick-ci (need to connect your account to opnfv) The docker image must be manually built and pushed to the docker Hub. This will probably be handled by gerrit triggers in the future (including revision handling and tagging of images). Example invocation: docker run \ --privileged=true \ -t \ -e "INSTALLER_TYPE=fuel" \ -e "INSTALLER_IP=10.20.0.2" \ -e YARDSTICK_BRANCH="refs/changes/01/2201/7" \ -e RELENG_BRANCH="master" \ opnfv/yardstick-ci \ run_benchmarks Basic steps performed by the container: 1. clone yardstick and releng repos 2 setup OS credentials (releng scripts) 3. install yardstick and dependencies 4. build yardstick cloud image and upload it to glance 5. upload cirros-0.3.3 cloud image to glance 6. run yardstick test scenarios If anything goes wrong in any of the steps above a non-zero exit status is returned. Some limitations: Scenario results (yardstick.out) are currently discarded. A future patch will take care of dumping the result to a database. Currently the container only runs the ping sample scenario. Testsuite execution (and selection) will be added in a future patch. The container has only been tested against fuel installations. Change-Id: I0bd29035082d3e283429c7392de8fc11b9fd777f JIRA: YARDSTICK-136 Signed-off-by: Jo¶rgen Karlsson <jorgen.w.karlsson@ericsson.com>
Diffstat (limited to 'tools/yardstick-img-modify')
-rwxr-xr-xtools/yardstick-img-modify40
1 files changed, 22 insertions, 18 deletions
diff --git a/tools/yardstick-img-modify b/tools/yardstick-img-modify
index c90027213..48462b80b 100755
--- a/tools/yardstick-img-modify
+++ b/tools/yardstick-img-modify
@@ -47,6 +47,7 @@ md5sums_path="${release}/current/MD5SUMS"
md5sums_url=${MD5SUMS_URL:-"https://${host}/${md5sums_path}"}
imgfile="${workspace}/yardstick-${release}-server.img"
+raw_imgfile="${workspace}/yardstick-${release}-server.raw"
filename=$(basename $image_url)
# download and checksum base image, conditionally if local copy is outdated
@@ -62,26 +63,23 @@ download() {
wget -nc $image_url
grep $filename MD5SUMS | md5sum -c
fi
- cp $filename $imgfile
+ qemu-img convert $filename $raw_imgfile
cd -
}
# mount image
setup() {
mkdir -p $mountdir
- if [ -f /etc/centos-release ]; then
- # CentOS, mount image using guestmount.
- # (needs libguestfs-tools installed)
- export LIBGUESTFS_BACKEND=direct
- guestmount -a $imgfile -i --rw $mountdir
- else
- # mount image using qemu-nbd
- modprobe nbd max_part=16
- qemu-nbd -c /dev/nbd0 $imgfile
- partprobe /dev/nbd0
-
- mount /dev/nbd0p1 $mountdir
- fi
+
+ for i in $(seq 0 9); do
+ [ -a /dev/loop$i ] || mknod -m 660 /dev/loop$i b 7 $i
+ done
+
+ loopdevice=$(kpartx -l $raw_imgfile | head -1 | cut -f1 -d ' ')
+
+ kpartx -a $raw_imgfile
+ mount /dev/mapper/$loopdevice $mountdir
+
cp $cmd $mountdir/$(basename $cmd)
}
@@ -90,20 +88,26 @@ modify() {
# resolv.conf does not exist in base image, pass nameserver value from host
nameserver_ip=$(grep -m 1 '^nameserver' \
/etc/resolv.conf | awk '{ print $2 '})
+
chroot $mountdir /$(basename $cmd) $nameserver_ip
+
+ 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 && umount $mountdir
- test -b /dev/nbd0 && partprobe /dev/nbd0
- pgrep qemu-nbd && qemu-nbd -d /dev/nbd0
+ if [ -f $raw_imgfile ]; then
+ kpartx -d $raw_imgfile || true
+ fi
+ rm -f $raw_imgfile
rm -rf $mountdir
- killall qemu-nbd 2> /dev/null || true
- lsmod | grep nbd && rmmod nbd || true
}
+set -x
+
main() {
cleanup
download