aboutsummaryrefslogtreecommitdiffstats
path: root/tools/yardstick-img-modify
diff options
context:
space:
mode:
Diffstat (limited to 'tools/yardstick-img-modify')
-rwxr-xr-xtools/yardstick-img-modify21
1 files changed, 14 insertions, 7 deletions
diff --git a/tools/yardstick-img-modify b/tools/yardstick-img-modify
index eba85473c..c90027213 100755
--- a/tools/yardstick-img-modify
+++ b/tools/yardstick-img-modify
@@ -66,15 +66,22 @@ download() {
cd -
}
-# mount image using qemu-nbd
+# mount image
setup() {
- modprobe nbd max_part=16
- qemu-nbd -c /dev/nbd0 $imgfile
- partprobe /dev/nbd0
-
mkdir -p $mountdir
- mount /dev/nbd0p1 $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
cp $cmd $mountdir/$(basename $cmd)
}