Merge "Implements custom lvm names"

This commit is contained in:
Jenkins 2017-06-22 14:25:48 +00:00 committed by Gerrit Code Review
commit bc8eecf86f
5 changed files with 44 additions and 10 deletions

View File

@ -502,6 +502,12 @@ Cinder volume size Config parameters
**CONFIG_CINDER_VOLUMES_SIZE**
Size of Block Storage volumes group. Actual volume size will be extended with 3% more space for VG metadata. Remember that the size of the volume group will restrict the amount of disk space that you can expose to Compute instances, and that the specified amount must be available on the device used for /var/lib/cinder.
Cinder lvm Config parameters
----------------------------
**CONFIG_CINDER_VOLUME_NAME**
Specify a custom name for the lvm cinder volume group
Cinder gluster Config parameters
--------------------------------

View File

@ -126,6 +126,20 @@ def initConfig(controller):
"CONDITION": False},
],
"CINDERVOLUMENAME": [
{"CMD_OPTION": "cinder-volume-name",
"PROMPT": "Enter a name for the Cinder volume",
"OPTION_LIST": [],
"VALIDATORS": [validators.validate_not_empty],
"DEFAULT_VALUE": "cinder-volumes",
"MASK_INPUT": False,
"LOOSE_VALIDATION": False,
"CONF_NAME": "CONFIG_CINDER_VOLUME_NAME",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
],
"CINDERGLUSTERMOUNTS": [
{"CMD_OPTION": "cinder-gluster-mounts",
"PROMPT": ("Enter a single or comma separated list of gluster "
@ -500,6 +514,13 @@ def initConfig(controller):
"POST_CONDITION": False,
"POST_CONDITION_MATCH": True},
{"GROUP_NAME": "CINDERVOLUMENAME",
"DESCRIPTION": "Cinder volume custom name",
"PRE_CONDITION": check_lvm_options,
"PRE_CONDITION_MATCH": True,
"POST_CONDITION": False,
"POST_CONDITION_MATCH": True},
{"GROUP_NAME": "CINDERVOLUMESIZE",
"DESCRIPTION": "Cinder volume size Config parameters",
"PRE_CONDITION": check_lvm_vg_options,
@ -682,7 +703,7 @@ def check_solidfire_options(config):
# -------------------------- step functions --------------------------
def check_cinder_vg(config, messages):
cinders_volume = 'cinder-volumes'
cinders_volume = config["CONFIG_CINDER_VOLUME_NAME"]
# Do we have a cinder-volumes vg?
have_cinders_volume = False
@ -697,8 +718,7 @@ def check_cinder_vg(config, messages):
if config["CONFIG_CINDER_VOLUMES_CREATE"] == "n":
if not have_cinders_volume:
raise exceptions.MissingRequirements("The cinder server should "
"contain a cinder-volumes "
"volume group")
"contain a volume group")
match = re.match('^(?P<size>\d+)G$',
config['CONFIG_CINDER_VOLUMES_SIZE'].strip())
if not match:

View File

@ -1,6 +1,7 @@
class packstack::cinder::backend::lvm ()
{
$create_cinder_volume = hiera('CONFIG_CINDER_VOLUMES_CREATE')
$cinder_volume_name = hiera('CONFIG_CINDER_VOLUME_NAME')
if $create_cinder_volume == 'y' {
# Find an available loop device
@ -10,7 +11,7 @@ class packstack::cinder::backend::lvm ()
size => hiera('CONFIG_CINDER_VOLUMES_SIZE'),
loopback_device => $loop_dev,
volume_path => '/var/lib/cinder',
volume_name => 'cinder-volumes',
volume_name => $cinder_volume_name,
}
# Add loop device on boot
@ -19,8 +20,8 @@ class packstack::cinder::backend::lvm ()
file_line{ 'rc.local_losetup_cinder_volume':
path => '/etc/rc.d/rc.local',
match => '^.*/var/lib/cinder/cinder-volumes.*$',
line => 'losetup -f /var/lib/cinder/cinder-volumes && service openstack-cinder-volume restart',
match => "^.*/var/lib/cinder/$cinder_volume_name.*$",
line => "losetup -f /var/lib/cinder/$cinder_volume_name && service openstack-cinder-volume restart",
}
file { '/etc/rc.d/rc.local':
@ -33,7 +34,7 @@ class packstack::cinder::backend::lvm ()
path => '/usr/lib/systemd/system/openstack-losetup.service',
before => Service['openstack-losetup'],
notify => Exec['reload systemd files for cinder-volume'],
content => '[Unit]
content => "[Unit]
Description=Setup cinder-volume loop device
DefaultDependencies=false
Before=openstack-cinder-volume.service
@ -41,13 +42,13 @@ class packstack::cinder::backend::lvm ()
[Service]
Type=oneshot
ExecStart=/usr/bin/sh -c \'/usr/sbin/losetup -j /var/lib/cinder/cinder-volumes | /usr/bin/grep /var/lib/cinder/cinder-volumes || /usr/sbin/losetup -f /var/lib/cinder/cinder-volumes\'
ExecStop=/usr/bin/sh -c \'/usr/sbin/losetup -j /var/lib/cinder/cinder-volumes | /usr/bin/cut -d : -f 1 | /usr/bin/xargs /usr/sbin/losetup -d\'
ExecStart=/usr/bin/sh -c \'/usr/sbin/losetup -j /var/lib/cinder/$cinder_volume_name | /usr/bin/grep /var/lib/cinder/$cinder_volume_name || /usr/sbin/losetup -f /var/lib/cinder/$cinder_volume_name\'
ExecStop=/usr/bin/sh -c \'/usr/sbin/losetup -j /var/lib/cinder/$cinder_volume_name | /usr/bin/cut -d : -f 1 | /usr/bin/xargs /usr/sbin/losetup -d\'
TimeoutSec=60
RemainAfterExit=yes
[Install]
RequiredBy=openstack-cinder-volume.service',
RequiredBy=openstack-cinder-volume.service",
}
exec { 'reload systemd files for cinder-volume':
@ -86,6 +87,7 @@ class packstack::cinder::backend::lvm ()
cinder::backend::iscsi { 'lvm':
iscsi_ip_address => hiera('CONFIG_STORAGE_HOST_URL'),
require => Package['lvm2'],
volume_group => $cinder_volume_name,
}
cinder::type { 'iscsi':

View File

@ -0,0 +1,5 @@
---
features:
- Users would like the ability to use custom lvm
names during deployment. This is now possible using
the cinder-volume-name parameter.

View File

@ -16,6 +16,7 @@ echo
$SUDO packstack ${ADDITIONAL_ARGS} \
--allinone \
--cinder-volume-name="aVolume" \
--debug \
--service-workers=2 \
--default-password="packstack" \