Allow skipping installation of storops library

The unity share driver requires storops library, and now we install it
using pip. However this may not be ideal in some deployments because
it mixes up python libraries installed by packages and ones installed
by pip. This change introduces an option to disable management of
the storops library so that users can install the library by
a different method (3rd party package).

This change also fixes the missing manila-support-package tag, to
ensure that the package is installed before manila services start.

Change-Id: I56951a77264154c2f3cbc57234b7f54eef99aee1
This commit is contained in:
Takashi Kajinami 2023-10-27 10:37:54 +09:00
parent 1b89d78af6
commit cfab2b79d1
3 changed files with 36 additions and 5 deletions

View File

@ -95,6 +95,10 @@
# [*package_ensure*]
# (optional) Ensure state for package. Defaults to 'present'.
#
# [*manage_storops*]
# (optional) Manage the storops python library.
# Defaults to true
#
# === Examples
#
# manila::backend::dellemc_unity { 'myBackend':
@ -125,6 +129,7 @@ define manila::backend::dellemc_unity (
$reserved_share_from_snapshot_percentage = $facts['os_service_default'],
$reserved_share_extend_percentage = $facts['os_service_default'],
$package_ensure = 'present',
Boolean $manage_storops = true,
) {
include manila::deps
@ -160,9 +165,12 @@ define manila::backend::dellemc_unity (
tag => 'manila-support-package',
})
# Python library storops is required to run Unity driver.
ensure_packages( 'storops', {
ensure => $package_ensure,
provider => 'pip',
})
if $manage_storops {
# Python library storops is required to run Unity driver.
ensure_packages( 'storops', {
ensure => $package_ensure,
provider => 'pip',
tag => 'manila-support-package',
})
}
}

View File

@ -0,0 +1,5 @@
---
features:
- |
The new ``manila::backend::dellemc_unity::manage_storops`` parameter has
been added.

View File

@ -44,6 +44,14 @@ describe 'manila::backend::dellemc_unity' do
it 'marks emc_nas_password as secret' do
is_expected.to contain_manila_config("dellemc_unity/emc_nas_password").with_secret( true )
end
it 'installs storops library' do
is_expected.to contain_package('storops').with(
:ensure => 'installed',
:provider => 'pip',
:tag => 'manila-support-package',
)
end
end
shared_examples 'manila::backend::dellemc_unity' do
@ -81,6 +89,16 @@ describe 'manila::backend::dellemc_unity' do
it { is_expected.to raise_error(Puppet::Error) }
end
context 'with storops library unmanaged' do
let :params do
required_params.merge({
:manage_storops => false
})
end
it { is_expected.to_not contain_package('storops') }
end
end
on_supported_os({