summaryrefslogtreecommitdiffstats
path: root/deploy/adapters/ansible/roles/cinder-volume/files
diff options
context:
space:
mode:
authorcarey.xu <carey.xuhan@huawei.com>2015-10-26 23:47:19 +0800
committercarey.xu <carey.xuhan@huawei.com>2015-10-27 17:07:08 +0800
commitdcd8ebd9d8da04c91650f596ae78f92115f8a97b (patch)
tree6e8d86d9dbfa86e094b3303c1845fbcc06b48e9c /deploy/adapters/ansible/roles/cinder-volume/files
parent4d2673fbf7dc77113309c2ce50eaa2b850c7825e (diff)
cinder volume space is too small
JIRA: COMPASS-116 Change-Id: I26553b6e56bbe46138e8dec4ee3af1aed7093bc4 Signed-off-by: carey.xu <carey.xuhan@huawei.com>
Diffstat (limited to 'deploy/adapters/ansible/roles/cinder-volume/files')
-rw-r--r--deploy/adapters/ansible/roles/cinder-volume/files/create_img.sh3
-rw-r--r--deploy/adapters/ansible/roles/cinder-volume/files/get_var_size.sh6
-rw-r--r--deploy/adapters/ansible/roles/cinder-volume/files/losetup.sh7
3 files changed, 16 insertions, 0 deletions
diff --git a/deploy/adapters/ansible/roles/cinder-volume/files/create_img.sh b/deploy/adapters/ansible/roles/cinder-volume/files/create_img.sh
new file mode 100644
index 00000000..b69db0ed
--- /dev/null
+++ b/deploy/adapters/ansible/roles/cinder-volume/files/create_img.sh
@@ -0,0 +1,3 @@
+if [[ ! -f /var/cinder.img ]]; then
+ dd if=/dev/zero of=/var/cinder.img bs=1 count=1 seek=$1
+fi
diff --git a/deploy/adapters/ansible/roles/cinder-volume/files/get_var_size.sh b/deploy/adapters/ansible/roles/cinder-volume/files/get_var_size.sh
new file mode 100644
index 00000000..9670da12
--- /dev/null
+++ b/deploy/adapters/ansible/roles/cinder-volume/files/get_var_size.sh
@@ -0,0 +1,6 @@
+size=`df /var | awk '$3 ~ /[0-9]+/ { print $4 }'`;
+if [[ $size -gt 2000000000 ]]; then
+ echo -n 2000000000000;
+else
+ echo -n $((size * 1000));
+fi
diff --git a/deploy/adapters/ansible/roles/cinder-volume/files/losetup.sh b/deploy/adapters/ansible/roles/cinder-volume/files/losetup.sh
new file mode 100644
index 00000000..d0e6c776
--- /dev/null
+++ b/deploy/adapters/ansible/roles/cinder-volume/files/losetup.sh
@@ -0,0 +1,7 @@
+loop_dev=`losetup -a |grep "/var/cinder.img"|awk -F':' '{print $1}'`
+if [[ -z $loop_dev ]]; then
+ losetup -f --show /var/cinder.img
+else
+ echo $loop_dev
+fi
+