From ff1acb9305e5e13239a6ba7a30e99f8aa673514e Mon Sep 17 00:00:00 2001 From: "carey.xu" Date: Tue, 22 Dec 2015 16:18:26 +0800 Subject: cinder volume use the vg created by storage role JIRA: COMPASS-211 Change-Id: I6c6ec36bf015c663bd684ac8f48011397851877b Signed-off-by: carey.xu --- .../ansible/openstack/HA-ansible-multinodes.yml | 4 ++-- .../ansible/roles/cinder-volume/files/create_img.sh | 3 --- .../roles/cinder-volume/files/get_var_size.sh | 6 ------ .../ansible/roles/cinder-volume/files/loop.yml | 1 - .../ansible/roles/cinder-volume/files/losetup.sh | 7 ------- .../ansible/roles/cinder-volume/tasks/loop.yml | 20 -------------------- .../ansible/roles/cinder-volume/tasks/main.yml | 12 ------------ .../ansible/roles/cinder-volume/tasks/real.yml | 10 ---------- .../roles/cinder-volume/templates/cinder.conf | 2 +- 9 files changed, 3 insertions(+), 62 deletions(-) delete mode 100644 deploy/adapters/ansible/roles/cinder-volume/files/create_img.sh delete mode 100644 deploy/adapters/ansible/roles/cinder-volume/files/get_var_size.sh delete mode 100644 deploy/adapters/ansible/roles/cinder-volume/files/loop.yml delete mode 100644 deploy/adapters/ansible/roles/cinder-volume/files/losetup.sh delete mode 100644 deploy/adapters/ansible/roles/cinder-volume/tasks/loop.yml delete mode 100644 deploy/adapters/ansible/roles/cinder-volume/tasks/real.yml diff --git a/deploy/adapters/ansible/openstack/HA-ansible-multinodes.yml b/deploy/adapters/ansible/openstack/HA-ansible-multinodes.yml index 83479167..506113a2 100644 --- a/deploy/adapters/ansible/openstack/HA-ansible-multinodes.yml +++ b/deploy/adapters/ansible/openstack/HA-ansible-multinodes.yml @@ -38,8 +38,8 @@ - hosts: all remote_user: root accelerate: true - roles: [] # just test - # - storage + roles: + - storage - hosts: compute remote_user: root diff --git a/deploy/adapters/ansible/roles/cinder-volume/files/create_img.sh b/deploy/adapters/ansible/roles/cinder-volume/files/create_img.sh deleted file mode 100644 index 5d64143e..00000000 --- a/deploy/adapters/ansible/roles/cinder-volume/files/create_img.sh +++ /dev/null @@ -1,3 +0,0 @@ -if [ ! -f /var/cinder.img ]; then - dd if=/dev/zero of=/var/cinder.img bs=1 count=0 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 deleted file mode 100644 index 6f690375..00000000 --- a/deploy/adapters/ansible/roles/cinder-volume/files/get_var_size.sh +++ /dev/null @@ -1,6 +0,0 @@ -size=`df /var | awk '$3 ~ /[0-9]+/ { print $4 }'`; -if [ $size -gt 2000000000 ]; then - echo -n 2000000000000; -else - echo -n $((size * 1000 / 512 * 512)); -fi diff --git a/deploy/adapters/ansible/roles/cinder-volume/files/loop.yml b/deploy/adapters/ansible/roles/cinder-volume/files/loop.yml deleted file mode 100644 index e872652a..00000000 --- a/deploy/adapters/ansible/roles/cinder-volume/files/loop.yml +++ /dev/null @@ -1 +0,0 @@ -physical_device: /dev/loop0 diff --git a/deploy/adapters/ansible/roles/cinder-volume/files/losetup.sh b/deploy/adapters/ansible/roles/cinder-volume/files/losetup.sh deleted file mode 100644 index 1f0b2b0e..00000000 --- a/deploy/adapters/ansible/roles/cinder-volume/files/losetup.sh +++ /dev/null @@ -1,7 +0,0 @@ -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 - diff --git a/deploy/adapters/ansible/roles/cinder-volume/tasks/loop.yml b/deploy/adapters/ansible/roles/cinder-volume/tasks/loop.yml deleted file mode 100644 index b44253c4..00000000 --- a/deploy/adapters/ansible/roles/cinder-volume/tasks/loop.yml +++ /dev/null @@ -1,20 +0,0 @@ ---- -- include_vars: "{{ ansible_os_family }}.yml" - -- name: get available /var partition size - script: get_var_size.sh - register: part_size - -- name: create cinder file if not exitst - script: create_img.sh {{ part_size.stdout }} - -- name: do a losetup on /mnt/cinder-volumes - script: losetup.sh - register: loop_device - -- name: debug loop device - debug: msg={{ loop_device.stdout }} - -- name: create physical and group volumes - lvg: vg=cinder-volumes pvs={{ loop_device.stdout }} - vg_options=--force diff --git a/deploy/adapters/ansible/roles/cinder-volume/tasks/main.yml b/deploy/adapters/ansible/roles/cinder-volume/tasks/main.yml index 342f61ae..3765071e 100644 --- a/deploy/adapters/ansible/roles/cinder-volume/tasks/main.yml +++ b/deploy/adapters/ansible/roles/cinder-volume/tasks/main.yml @@ -9,18 +9,6 @@ lineinfile: dest=/opt/service create=yes line='{{ item }}' with_items: services | union(services_noarch) -- name: check if physical device exists - stat: path={{ physical_device }} - register: status - -- name: load loop.yml - include: loop.yml - when: status.stat.exists == False or status.stat.isblk == False - -- name: load real.yml - include: real.yml - when: status.stat.exists == True and status.stat.isblk == True - - name: upload cinder-volume configuration template: src=cinder.conf dest=/etc/cinder/cinder.conf backup=yes diff --git a/deploy/adapters/ansible/roles/cinder-volume/tasks/real.yml b/deploy/adapters/ansible/roles/cinder-volume/tasks/real.yml deleted file mode 100644 index 19ef828b..00000000 --- a/deploy/adapters/ansible/roles/cinder-volume/tasks/real.yml +++ /dev/null @@ -1,10 +0,0 @@ ---- -- include_vars: "{{ ansible_os_family }}.yml" - -- name: destroy GPT lable - shell: dd if=/dev/urandom of={{ physical_device }} bs=4M count=1 - ignore_errors: True - -- name: create physical and group volumes - lvg: vg=cinder-volumes pvs={{ physical_device }} - vg_options=--force diff --git a/deploy/adapters/ansible/roles/cinder-volume/templates/cinder.conf b/deploy/adapters/ansible/roles/cinder-volume/templates/cinder.conf index fdcac69d..75288946 100644 --- a/deploy/adapters/ansible/roles/cinder-volume/templates/cinder.conf +++ b/deploy/adapters/ansible/roles/cinder-volume/templates/cinder.conf @@ -3,7 +3,7 @@ rootwrap_config = /etc/cinder/rootwrap.conf api_paste_confg = /etc/cinder/api-paste.ini iscsi_helper = tgtadm volume_name_template = volume-%s -volume_group = cinder-volumes +volume_group = storage-volumes verbose = True auth_strategy = keystone state_path = /var/lib/cinder -- cgit 1.2.3-korg