From 233090300ea4acee033f64bd7975c7031aaf8cfb Mon Sep 17 00:00:00 2001 From: Paul Bourke Date: Thu, 11 Aug 2016 15:18:01 +0000 Subject: [PATCH] Check volume group exists for Cinder in prechecks Add a service check for Cinder when using iscsi/LVM, that the appropriate volume group exists. TrivialFix Change-Id: I54e01911709db73549334760498b4246fe6271d7 Co-Authored-By: Vladislav Belogrudov --- ansible/roles/cinder/defaults/main.yml | 2 ++ ansible/roles/cinder/templates/cinder.conf.j2 | 2 +- ansible/roles/prechecks/tasks/service_checks.yml | 10 ++++++++++ etc/kolla/globals.yml | 5 +---- .../notes/add-cinder-vg-check-c70d9f79d8cfd09b.yaml | 4 ++++ 5 files changed, 18 insertions(+), 5 deletions(-) create mode 100644 releasenotes/notes/add-cinder-vg-check-c70d9f79d8cfd09b.yaml diff --git a/ansible/roles/cinder/defaults/main.yml b/ansible/roles/cinder/defaults/main.yml index e06b161bc5..c9de204ee8 100644 --- a/ansible/roles/cinder/defaults/main.yml +++ b/ansible/roles/cinder/defaults/main.yml @@ -73,3 +73,5 @@ cinder_backends: enabled: "{{ enable_cinder_backend_lvm | bool }}" cinder_enabled_backends: "{{ cinder_backends|selectattr('enabled', 'equalto', true)|list }}" + +cinder_volume_group: "cinder-volumes" diff --git a/ansible/roles/cinder/templates/cinder.conf.j2 b/ansible/roles/cinder/templates/cinder.conf.j2 index 311033dd82..a34ee75fd7 100644 --- a/ansible/roles/cinder/templates/cinder.conf.j2 +++ b/ansible/roles/cinder/templates/cinder.conf.j2 @@ -79,7 +79,7 @@ lock_path = /var/lib/cinder/tmp {% if enable_cinder_backend_lvm | bool %} [lvm-1] -volume_group = cinder-volumes +volume_group = {{ cinder_volume_group }} volume_driver = cinder.volume.drivers.lvm.LVMVolumeDriver volume_backend_name = lvm-1 iscsi_helper = tgtadm diff --git a/ansible/roles/prechecks/tasks/service_checks.yml b/ansible/roles/prechecks/tasks/service_checks.yml index b4e7ca99cd..06c9b8e324 100644 --- a/ansible/roles/prechecks/tasks/service_checks.yml +++ b/ansible/roles/prechecks/tasks/service_checks.yml @@ -64,3 +64,13 @@ - enable_ceilometer | bool - not enable_mongodb | bool - ceilometer_database_type == "mongodb" + +- name: Checking LVM volume group exists for Cinder + command: "vgs {{ cinder_volume_group }}" + register: result + changed_when: false + failed_when: result | failed + when: + - inventory_hostname in groups['cinder-volume'] + - enable_cinder | bool + - enable_cinder_backend_lvm | bool diff --git a/etc/kolla/globals.yml b/etc/kolla/globals.yml index cd9177766d..5415874954 100644 --- a/etc/kolla/globals.yml +++ b/etc/kolla/globals.yml @@ -187,10 +187,7 @@ kolla_internal_vip_address: "10.10.10.254" # Enable / disable Cinder backends #cinder_backend_ceph: "{{ enable_ceph }}" -# Cinder's iSCSI backend !!!REQUIRES!!! two parameters: -# 1 - IP address of the server hosting LVM Volume group -# 2 - The name of Volume group which Cinder will use. -#cinder_volume_group: +#cinder_volume_group: "cinder-volumes" ####################### diff --git a/releasenotes/notes/add-cinder-vg-check-c70d9f79d8cfd09b.yaml b/releasenotes/notes/add-cinder-vg-check-c70d9f79d8cfd09b.yaml new file mode 100644 index 0000000000..e77a38543f --- /dev/null +++ b/releasenotes/notes/add-cinder-vg-check-c70d9f79d8cfd09b.yaml @@ -0,0 +1,4 @@ +--- +features: + - When Cinder, iSCSI and the LVM driver are enabled, check that the + appropriate volume group exists on the target nodes.