From 6e7c0b6a94c4e384e5b312be50cb7fe0a7902b3d Mon Sep 17 00:00:00 2001 From: John Fulton Date: Wed, 6 Mar 2019 15:22:44 -0500 Subject: [PATCH] Create two loop devices for bluestore and filestore The ceph-loop-device role was changed [1] to create an LVM structure on the loop device but only for versions which can use that structure for bluestore. However, the zuul.branch variable doesn't work as expected to differentiate versions so remove the code that uses it. In place of switching on the version create two loop devices, then legacy jobs which don't support LVM can use the loop device without LVM. Call the legacy loop device /dev/loop3 so older jobs get the expected name. [1] https://review.openstack.org/#/c/637196 Change-Id: I778bf3d78ccf492e852a2c932ccd5e8266bcfe71 Related-Bug: #1817688 --- roles/ceph-loop-device/README.rst | 13 +++++++++---- roles/ceph-loop-device/defaults/main.yml | 4 +++- roles/ceph-loop-device/tasks/main.yml | 22 ++++++++++------------ 3 files changed, 22 insertions(+), 17 deletions(-) diff --git a/roles/ceph-loop-device/README.rst b/roles/ceph-loop-device/README.rst index 946536681..2415cbdc3 100644 --- a/roles/ceph-loop-device/README.rst +++ b/roles/ceph-loop-device/README.rst @@ -1,21 +1,26 @@ ceph-loop-device ================ -This role creates the /dev/loop3 (default) loop device required when you have -ceph services in the deployment. For Stein and newer it creates three logical -volumes for use with bluestore. +This roles creates the /dev/loop3 and /dev/loop4 (default) loop +devices required when you have Ceph services in the deployment. +The first device is used for legacy jobs which use Ceph Filestore. +The second loop device has three logical volumes created on it for +use with Ceph Bluestore. Role Variables -------------- -ceph_loop_device: /dev/loop3 +ceph_loop_device: /dev/loop4 +ceph_loop_device_legacy: /dev/loop3 ceph_loop_device_file: /var/lib/ceph-osd.img +ceph_loop_device_file_legacy: /var/lib/ceph-osd-legacy.img ceph_logical_volume_group: ceph_vg ceph_logical_volume_wal: ceph_lv_wal ceph_logical_volume_db: ceph_lv_db ceph_logical_volume_data: ceph_lv_data + Requirements ------------ diff --git a/roles/ceph-loop-device/defaults/main.yml b/roles/ceph-loop-device/defaults/main.yml index 7be81ad1d..921e80f35 100644 --- a/roles/ceph-loop-device/defaults/main.yml +++ b/roles/ceph-loop-device/defaults/main.yml @@ -1,6 +1,8 @@ --- -ceph_loop_device: /dev/loop3 +ceph_loop_device: /dev/loop4 +ceph_loop_device_legacy: /dev/loop3 ceph_loop_device_file: /var/lib/ceph-osd.img +ceph_loop_device_file_legacy: /var/lib/ceph-osd-legacy.img ceph_logical_volume_group: ceph_vg ceph_logical_volume_wal: ceph_lv_wal ceph_logical_volume_db: ceph_lv_db diff --git a/roles/ceph-loop-device/tasks/main.yml b/roles/ceph-loop-device/tasks/main.yml index b38ced834..7664ffa52 100644 --- a/roles/ceph-loop-device/tasks/main.yml +++ b/roles/ceph-loop-device/tasks/main.yml @@ -12,21 +12,22 @@ - name: Make sure we have losetup installed/latest become: true package: - name: util-linux + name: + - util-linux + - lvm2 state: latest -- name: Use dd and losetup to create the loop device +- name: Use dd and losetup to create the loop devices become: true shell: | - dd if=/dev/zero of={{ ceph_loop_device_file }} bs=1 count=0 seek=7G - losetup {{ ceph_loop_device }} {{ ceph_loop_device_file }} + dd if=/dev/zero of={{ item.0 }} bs=1 count=0 seek=7G + losetup {{ item.1 }} {{ item.0 }} lsblk + with_together: + - ["{{ ceph_loop_device_file }}", "{{ ceph_loop_device_file_legacy }}"] + - ["{{ ceph_loop_device }}", "{{ ceph_loop_device_legacy }}"] -- name: Get branch - set_fact: - ci_branch: "{{ zuul.branch | default('master') | replace('stable/','') }}" - -- name: Use {pv,vg,lv}create to create logical volumes on loop device +- name: Use {pv,vg,lv}create to create logical volumes on one loop device become: true shell: | pvcreate {{ ceph_loop_device }} @@ -35,6 +36,3 @@ lvcreate -n {{ ceph_logical_volume_db }} -l 375 {{ ceph_logical_volume_group }} lvcreate -n {{ ceph_logical_volume_data }} -l 1041 {{ ceph_logical_volume_group }} lvs - when: - - ci_branch is defined - - ci_branch is not match('(newton|ocata|pike)')