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
This commit is contained in:
John Fulton 2019-03-06 15:22:44 -05:00 committed by yatin
parent a646abc971
commit 6e7c0b6a94
3 changed files with 22 additions and 17 deletions

View File

@ -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
------------

View File

@ -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

View File

@ -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)')