summaryrefslogtreecommitdiffstats
path: root/deploy/adapters/ansible/roles/cinder-volume/files
diff options
context:
space:
mode:
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
+