summaryrefslogtreecommitdiffstats
path: root/deploy/adapters/ansible/roles/cinder-volume/files
diff options
context:
space:
mode:
authorJustin chi <chigang@huawei.com>2015-10-28 07:59:27 +0000
committerGerrit Code Review <gerrit@172.30.200.206>2015-10-28 07:59:27 +0000
commit5d0f138cdbbd5459984c41eaa05dfaa7c074167e (patch)
tree43104cb39f0999c36813b3324afc42abe623f406 /deploy/adapters/ansible/roles/cinder-volume/files
parent2e27389414987ec721f31ab75d415bb5a5ceaa99 (diff)
parentdcd8ebd9d8da04c91650f596ae78f92115f8a97b (diff)
Merge "cinder volume space is too small"
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
+