Fix volume type creation, switch to targetcli for CentOS

The Cinder client will likely disappear at some point and it seems
to be having issues with setting volume type.  This patch replaces
it's usage using the OpenStack client instead.

CentOS does not use that package but instead relies on targetcli
to take care of any target related work.

Depends-On: I2e42ef4022aaaa2e1cb9f461e63ce2e9e1f49511
Depends-On: I3df2c670beeb78baaa1515bcd27e8f2b0d95b3a9
Change-Id: Ife5023bc4752cf3c2d7221f9f8772990c6bc09df
This commit is contained in:
Mohammed Naser 2018-06-20 10:24:31 -04:00
parent cf0b6101a3
commit 6904918189
6 changed files with 15 additions and 8 deletions

View File

@ -195,7 +195,11 @@ cinder_osapi_volume_workers_max: 16
cinder_osapi_volume_workers: "{{ [[ansible_processor_vcpus|default(2) // 2, 1] | max, cinder_osapi_volume_workers_max] | min }}"
## Cinder iscsi
cinder_iscsi_helper: tgtadm
cinder_iscsi_helper_mapping:
RedHat: lioadm
Debian: tgtadm
Suse: tgtadm
cinder_iscsi_helper: "{{ cinder_iscsi_helper_mapping[ansible_os_family] }}"
cinder_iscsi_iotype: fileio
cinder_iscsi_num_targets: 100
cinder_iscsi_port: 3260
@ -271,6 +275,7 @@ cinder_pip_packages:
- httplib2
- keystonemiddleware
- PyMySQL
- python-openstackclient
- python-cinderclient
- python-keystoneclient
- python-memcached

View File

@ -32,9 +32,8 @@
shell: |
. {{ ansible_env.HOME }}/openrc
CLI_OPTIONS="{{ ((keystone_service_adminuri_insecure | bool) or (cinder_service_internaluri_insecure | bool)) | ternary('--insecure','') }}"
if ! {{ cinder_bin }}/cinder ${CLI_OPTIONS} type-list | grep " {{ item.key }} "; then
{{ cinder_bin }}/cinder ${CLI_OPTIONS} type-create "{{ item.key }}"
{{ cinder_bin }}/cinder ${CLI_OPTIONS} type-key "{{ item.key }}" set volume_backend_name="{{ item.value.volume_backend_name }}"
if ! {{ cinder_bin }}/openstack ${CLI_OPTIONS} volume type show "{{ item.key }}"; then
{{ cinder_bin }}/openstack ${CLI_OPTIONS} volume type create --property volume_backend_name="{{ item.value.volume_backend_name }}" "{{ item.key }}"
fi
args:
executable: /bin/bash
@ -46,9 +45,8 @@
. {{ ansible_env.HOME }}/openrc
CLI_OPTIONS="{{ ((keystone_service_adminuri_insecure | bool) or (cinder_service_internaluri_insecure | bool)) | ternary('--insecure','') }}"
{% for evtype in item.value.extra_volume_types %}
if ! {{ cinder_bin }}/cinder ${CLI_OPTIONS} type-list | grep " {{ evtype }} "; then
{{ cinder_bin }}/cinder ${CLI_OPTIONS} type-create "{{ evtype }}"
{{ cinder_bin }}/cinder ${CLI_OPTIONS} type-key "{{ evtype }}" set volume_backend_name="{{ item.value.volume_backend_name }}"
if ! {{ cinder_bin }}/openstack ${CLI_OPTIONS} volume type show "{{ evtype }}"; then
{{ cinder_bin }}/openstack ${CLI_OPTIONS} volume type create --property volume_backend_name="{{ item.value.volume_backend_name }}" "{{ evtype }}"
fi
{% endfor %}
args:

View File

@ -63,6 +63,7 @@
notify: Ensure tgt service restarted
when:
- "cinder_services['cinder-volume']['group'] in group_names"
- "cinder_iscsi_helper == 'tgtadm'"
- cinder_backend_lvm_inuse | bool
- name: Create nfs shares export file

View File

@ -31,6 +31,7 @@ cinder_distro_packages:
cinder_service_distro_packages:
- openstack-cinder
- python-openstackclient
- python-cinderclient
- python2-shade
- uwsgi
@ -46,6 +47,6 @@ cinder_lvm_volume_distro_packages:
- device-mapper-event
- lvm2
- parted
- scsi-target-utils
- targetcli
cinder_uwsgi_bin: '/usr/sbin'

View File

@ -36,6 +36,7 @@ cinder_service_distro_packages:
- openstack-cinder-backup
- openstack-cinder-scheduler
- openstack-cinder-volume
- python-openstackclient
- python-cinderclient
- python-shade
- uwsgi

View File

@ -41,6 +41,7 @@ cinder_service_distro_packages:
- cinder-backup
- cinder-scheduler
- cinder-volume
- python-openstackclient
- python-cinderclient
- python-shade
- uwsgi