From: Ryan.RCS Date: Wed, 21 Dec 2016 02:29:41 +0000 (+0000) Subject: fixed issue in yardstick-img-modify cleanup() fun X-Git-Tag: danube.1.0~163^2 X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F27%2F26327%2F1;p=yardstick.git fixed issue in yardstick-img-modify cleanup() fun 1. when run yardstick-img-modify script, sometimes it show below error. + '[' -f /tmp/workspace/yardstick/yardstick-xenial-server.raw ']' + kpartx -dv /tmp/workspace/yardstick/yardstick-xenial-server.raw ioctl: LOOP_CLR_FD: No such device or address del devmap : loop0p1 can't del loop : /dev/loop0 + test 1 -eq 1 -o 1 -eq 2 2. so i added a expression to check if the .raw file map deleted or not 3. if the devmap not deleted, then we delete it, otherwise, we do nothing JIRA: YARDSTICK-502 Change-Id: Ia050121ed6bf837bab05e38f2e9e9628ca31627a Signed-off-by: Ryan.RCS --- diff --git a/tools/yardstick-img-modify b/tools/yardstick-img-modify index 0033383ef..1743d908a 100755 --- a/tools/yardstick-img-modify +++ b/tools/yardstick-img-modify @@ -152,9 +152,13 @@ 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 + if [ -z "$(kpartx -l $raw_imgfile | grep 'loop deleted')" ]; then + kpartx -dv $raw_imgfile + fi fi + rm -f $raw_imgfile rm -rf $mountdir }