Replace cinder quota-set cli for class with openstack cli quota

Change-Id: Ibf6e4d2efa13fd948cfbca0005773f779d460488
Closes-Bug: #1561155
This commit is contained in:
Xing Zhou 2016-12-14 13:58:06 +08:00
parent 9f07b3b884
commit 44caaac5f6
5 changed files with 19 additions and 6 deletions

View File

@ -20,4 +20,6 @@ class cinder::client(
name => $::cinder::params::client_package,
tag => ['openstack', 'cinder-support-package'],
}
include '::openstacklib::openstackclient'
}

View File

@ -78,11 +78,11 @@ define cinder::quota_set (
]
}
exec {"cinder quota-class-update ${class_name}":
exec {"openstack quota set --class ${class_name}":
# lint:ignore:140chars
command => "cinder quota-class-update ${class_name} --volumes ${quota_volumes} --snapshots ${quota_snapshots} --gigabytes ${quota_gigabytes} --volume-type '${volume_type}'",
command => "openstack quota set --class ${class_name} --volumes ${quota_volumes} --snapshots ${quota_snapshots} --gigabytes ${quota_gigabytes} --volume-type '${volume_type}'",
# lint:endignore
onlyif => 'cinder quota-class-show default | grep -qP -- -1',
onlyif => 'openstack quota show --class default | grep -qP -- -1',
environment => $cinder_env,
require => Anchor['cinder-support-package'],
path => ['/usr/bin', '/bin'],

View File

@ -0,0 +1,4 @@
---
other:
- Replace cinder quota-set cli for class with openstack cli quota,
It uses --class option to exec resources class quota.

View File

@ -25,6 +25,13 @@ describe 'cinder::client' do
)
end
it 'installs openstackclient package' do
is_expected.to contain_package('python-openstackclient').with(
'ensure' => 'present',
'tag' => 'openstack',
)
end
end
on_supported_os({

View File

@ -27,8 +27,8 @@ describe 'cinder::quota_set' do
params.merge!(param_set)
end
it do
is_expected.to contain_exec('cinder quota-class-update default').with(
:command => "cinder quota-class-update default --volumes 10 --snapshots 10 --gigabytes 1000 --volume-type 'hippo'",
is_expected.to contain_exec('openstack quota set --class default').with(
:command => "openstack quota set --class default --volumes 10 --snapshots 10 --gigabytes 1000 --volume-type 'hippo'",
:environment => (param_set == {}) ?
['OS_TENANT_NAME=admin',
'OS_USERNAME=admin',
@ -39,7 +39,7 @@ describe 'cinder::quota_set' do
'OS_PASSWORD=asdf',
'OS_AUTH_URL=http://127.127.127.1:5000/v2.0/',
'OS_REGION_NAME=test'],
:onlyif => 'cinder quota-class-show default | grep -qP -- -1',
:onlyif => 'openstack quota show --class default | grep -qP -- -1',
:require => 'Anchor[cinder-support-package]')
end
end