diff --git a/docs/packstack.rst b/docs/packstack.rst index 3c50d87ff..fdc56d218 100755 --- a/docs/packstack.rst +++ b/docs/packstack.rst @@ -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 -------------------------------- diff --git a/packstack/plugins/cinder_250.py b/packstack/plugins/cinder_250.py index 673e86ce1..16aa2735c 100644 --- a/packstack/plugins/cinder_250.py +++ b/packstack/plugins/cinder_250.py @@ -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\d+)G$', config['CONFIG_CINDER_VOLUMES_SIZE'].strip()) if not match: diff --git a/packstack/puppet/modules/packstack/manifests/cinder/backend/lvm.pp b/packstack/puppet/modules/packstack/manifests/cinder/backend/lvm.pp index 1b2533bd1..b768a1877 100644 --- a/packstack/puppet/modules/packstack/manifests/cinder/backend/lvm.pp +++ b/packstack/puppet/modules/packstack/manifests/cinder/backend/lvm.pp @@ -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': diff --git a/releasenotes/notes/releasenotes/notes/add-custom-lvm-name-090af5002950706d.yaml b/releasenotes/notes/releasenotes/notes/add-custom-lvm-name-090af5002950706d.yaml new file mode 100644 index 000000000..01cc2552b --- /dev/null +++ b/releasenotes/notes/releasenotes/notes/add-custom-lvm-name-090af5002950706d.yaml @@ -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. diff --git a/tests/scenario001.sh b/tests/scenario001.sh index 54bf4cd84..d828c8207 100755 --- a/tests/scenario001.sh +++ b/tests/scenario001.sh @@ -16,6 +16,7 @@ echo $SUDO packstack ${ADDITIONAL_ARGS} \ --allinone \ + --cinder-volume-name="aVolume" \ --debug \ --service-workers=2 \ --default-password="packstack" \