diff options
Diffstat (limited to 'tools/yardstick-img-modify')
-rwxr-xr-x | tools/yardstick-img-modify | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/tools/yardstick-img-modify b/tools/yardstick-img-modify index 07f10b3ce..68ce6e223 100755 --- a/tools/yardstick-img-modify +++ b/tools/yardstick-img-modify @@ -32,21 +32,22 @@ die() { exit 1 } -test $# -eq 1 || die "no image specific script as argument" +test $# -eq 1 -o $# -eq 2 || die "no image specific script as argument" test $(id -u) -eq 0 || die "should invoke using sudo" cmd=$1 +RELEASE=$2 test -x $cmd mountdir="/mnt/yardstick" workspace=${WORKSPACE:-"/tmp/workspace/yardstick"} host=${HOST:-"cloud-images.ubuntu.com"} -release=${RELEASE:-"trusty"} +release=${RELEASE:-"xenial"} image_path="${release}/current/${release}-server-cloudimg-${YARD_IMG_ARCH}-disk1.img" image_url=${IMAGE_URL:-"https://${host}/${image_path}"} md5sums_path="${release}/current/MD5SUMS" md5sums_url=${MD5SUMS_URL:-"https://${host}/${md5sums_path}"} -imgfile="${workspace}/yardstick-${release}-server.img" +imgfile="${workspace}/yardstick-image.img" raw_imgfile="${workspace}/yardstick-${release}-server.raw" filename=$(basename $image_url) @@ -151,9 +152,15 @@ cleanup() { mount | grep $mountdir/proc && umount $mountdir/proc mount | grep $mountdir && umount $mountdir mount | grep "/mnt/vivid" && umount "/mnt/vivid" + if [ -f $raw_imgfile ]; then + #kpartx -dv $raw_imgfile sometimes failed, we should checked it agein. + #if [ -z "$(kpartx -l $raw_imgfile | grep 'loop deleted')" ]; then + # kpartx -dv $raw_imgfile + #fi kpartx -dv $raw_imgfile || true fi + rm -f $raw_imgfile rm -rf $mountdir } |