aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xtests/ci/prepare_storperf_admin-rc.sh5
-rw-r--r--tests/ci/scp_storperf_admin-rc.sh11
-rw-r--r--tests/unit/test_ssh.py2
-rwxr-xr-xtools/yardstick-img-modify8
-rw-r--r--yardstick/ssh.py6
5 files changed, 25 insertions, 7 deletions
diff --git a/tests/ci/prepare_storperf_admin-rc.sh b/tests/ci/prepare_storperf_admin-rc.sh
index 0401719ff..b3dc2e58e 100755
--- a/tests/ci/prepare_storperf_admin-rc.sh
+++ b/tests/ci/prepare_storperf_admin-rc.sh
@@ -9,14 +9,15 @@
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
+# Prepare storperf_admin-rc for StorPerf.
+
AUTH_URL=${OS_AUTH_URL}
USERNAME=${OS_USERNAME:-admin}
PASSWORD=${OS_PASSWORD:-console}
TENANT_NAME=${OS_TENANT_NAME:-admin}
VOLUME_API_VERSION=${OS_VOLUME_API_VERSION:-2}
PROJECT_NAME=${OS_PROJECT_NAME:-$TENANT_NAME}
-TENANT_ID=`keystone tenant-get admin|grep 'id'|awk -F '|' '{print $3}'|sed -e 's/^[[:space:]]*//'`
-
+TENANT_ID=`openstack project show admin|grep '\bid\b' |awk -F '|' '{print $3}'|sed -e 's/^[[:space:]]*//'`
rm -f ~/storperf_admin-rc
touch ~/storperf_admin-rc
diff --git a/tests/ci/scp_storperf_admin-rc.sh b/tests/ci/scp_storperf_admin-rc.sh
index af2885b01..7c3896d88 100644
--- a/tests/ci/scp_storperf_admin-rc.sh
+++ b/tests/ci/scp_storperf_admin-rc.sh
@@ -1,5 +1,16 @@
#!/bin/bash
+##############################################################################
+# Copyright (c) 2016 Huawei Technologies Co.,Ltd and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+# Copy storperf_admin-rc to deployment location.
+
ssh_options="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
sshpass -p root scp 2>/dev/null $ssh_options ~/storperf_admin-rc \
root@192.168.200.1:/root/ &> /dev/null
diff --git a/tests/unit/test_ssh.py b/tests/unit/test_ssh.py
index 88638a0a8..8b828ed7c 100644
--- a/tests/unit/test_ssh.py
+++ b/tests/unit/test_ssh.py
@@ -314,7 +314,7 @@ class SSHRunTestCase(unittest.TestCase):
self.test_client._put_file_shell("localfile", "remotefile", 0o42)
self.test_client.run.assert_called_once_with(
- 'cat > "remotefile"&& chmod -- 042 "remotefile"',
+ 'cat > remotefile && chmod -- 042 remotefile',
stdin=mock_open.return_value.__enter__.return_value)
@mock.patch("yardstick.ssh.os.stat")
diff --git a/tools/yardstick-img-modify b/tools/yardstick-img-modify
index 0033383ef..68ce6e223 100755
--- a/tools/yardstick-img-modify
+++ b/tools/yardstick-img-modify
@@ -152,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
+ #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
}
diff --git a/yardstick/ssh.py b/yardstick/ssh.py
index 2ba6de92e..3081001b6 100644
--- a/yardstick/ssh.py
+++ b/yardstick/ssh.py
@@ -313,14 +313,14 @@ class SSH(object):
def _put_file_shell(self, localpath, remotepath, mode=None):
# quote to stop wordpslit
- cmd = ['cat > "%s"' % remotepath]
+ cmd = ['cat > %s' % remotepath]
if mode is not None:
# use -- so no options
- cmd.append('chmod -- 0%o "%s"' % (mode, remotepath))
+ cmd.append('chmod -- 0%o %s' % (mode, remotepath))
with open(localpath, "rb") as localfile:
# only chmod on successful cat
- cmd = "&& ".join(cmd)
+ cmd = " && ".join(cmd)
self.run(cmd, stdin=localfile)
def put_file(self, localpath, remotepath, mode=None):