cronjob binary path depends on platform
also refactored some tests Change-Id: I7ef1082a515898efd26be398fa30d32b756c27c3
This commit is contained in:
@@ -2,8 +2,8 @@
|
|||||||
"sha": "ba71763fac936d414bd4a63f004357f86f6e1bfb",
|
"sha": "ba71763fac936d414bd4a63f004357f86f6e1bfb",
|
||||||
"sources": {
|
"sources": {
|
||||||
"openstack-block-storage": {
|
"openstack-block-storage": {
|
||||||
"locked_version": "7.0.2",
|
"locked_version": "7.0.3",
|
||||||
"constraint": "= 7.0.2",
|
"constraint": "= 7.0.3",
|
||||||
"path": "."
|
"path": "."
|
||||||
},
|
},
|
||||||
"openstack-image": {
|
"openstack-image": {
|
||||||
|
|||||||
@@ -2,6 +2,11 @@ openstack-block-storage Cookbook CHANGELOG
|
|||||||
==============================
|
==============================
|
||||||
This file is used to list changes made in each version of the openstack-block-storage cookbook.
|
This file is used to list changes made in each version of the openstack-block-storage cookbook.
|
||||||
|
|
||||||
|
v7.0.3
|
||||||
|
------
|
||||||
|
### Bug
|
||||||
|
- change audit cronjob binary path depending on platform, refactored some tests
|
||||||
|
|
||||||
v7.0.2
|
v7.0.2
|
||||||
------
|
------
|
||||||
### Improvement
|
### Improvement
|
||||||
|
|||||||
@@ -108,6 +108,7 @@ default["openstack"]["block-storage"]["syslog"]["config_facility"] = "local2"
|
|||||||
|
|
||||||
default["openstack"]["block-storage"]["api"]["ratelimit"] = "True"
|
default["openstack"]["block-storage"]["api"]["ratelimit"] = "True"
|
||||||
default["openstack"]["block-storage"]["cron"]["minute"] = '00'
|
default["openstack"]["block-storage"]["cron"]["minute"] = '00'
|
||||||
|
default["openstack"]["block-storage"]["cron"]["audit_logfile"] = "/var/log/cinder/audit.log"
|
||||||
|
|
||||||
default["openstack"]["block-storage"]["volume"]["state_path"] = "/var/lib/cinder"
|
default["openstack"]["block-storage"]["volume"]["state_path"] = "/var/lib/cinder"
|
||||||
default["openstack"]["block-storage"]["volume"]["driver"] = "cinder.volume.driver.ISCSIDriver"
|
default["openstack"]["block-storage"]["volume"]["driver"] = "cinder.volume.driver.ISCSIDriver"
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ maintainer_email "cookbooks@lists.tfoundry.com"
|
|||||||
license "Apache 2.0"
|
license "Apache 2.0"
|
||||||
description "The OpenStack Advanced Volume Management service Cinder."
|
description "The OpenStack Advanced Volume Management service Cinder."
|
||||||
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
|
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
|
||||||
version "7.0.2"
|
version "7.0.3"
|
||||||
|
|
||||||
recipe "openstack-block-storage::common", "Defines the common pieces of repeated code from the other recipes"
|
recipe "openstack-block-storage::common", "Defines the common pieces of repeated code from the other recipes"
|
||||||
recipe "openstack-block-storage::api", "Installs the cinder-api, sets up the cinder database, and cinder service/user/endpoints in keystone"
|
recipe "openstack-block-storage::api", "Installs the cinder-api, sets up the cinder database, and cinder service/user/endpoints in keystone"
|
||||||
|
|||||||
@@ -55,6 +55,9 @@ service "cinder-scheduler" do
|
|||||||
subscribes :restart, "template[/etc/cinder/cinder.conf]"
|
subscribes :restart, "template[/etc/cinder/cinder.conf]"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
audit_bin_dir = platform?("ubuntu") ? "/usr/bin" : "/usr/local/bin"
|
||||||
|
audit_log = node["openstack"]["block-storage"]["cron"]["audit_logfile"]
|
||||||
|
|
||||||
if node["openstack"]["metering"]
|
if node["openstack"]["metering"]
|
||||||
scheduler_role = node["openstack"]["block-storage"]["scheduler_role"]
|
scheduler_role = node["openstack"]["block-storage"]["scheduler_role"]
|
||||||
results = search(:node, "roles:#{scheduler_role}")
|
results = search(:node, "roles:#{scheduler_role}")
|
||||||
@@ -67,7 +70,7 @@ if node["openstack"]["metering"]
|
|||||||
minute node["openstack"]["block-storage"]["cron"]["minute"]
|
minute node["openstack"]["block-storage"]["cron"]["minute"]
|
||||||
month node["openstack"]["block-storage"]["cron"]["month"] || '*'
|
month node["openstack"]["block-storage"]["cron"]["month"] || '*'
|
||||||
weekday node["openstack"]["block-storage"]["cron"]["weekday"] || '*'
|
weekday node["openstack"]["block-storage"]["cron"]["weekday"] || '*'
|
||||||
command "/usr/local/bin/cinder-volume-usage-audit > /var/log/cinder/audit.log 2>&1"
|
command "#{audit_bin_dir}/cinder-volume-usage-audit > #{audit_log} 2>&1"
|
||||||
action cron_node == node.name ? :create : :delete
|
action cron_node == node.name ? :create : :delete
|
||||||
user node["openstack"]["block-storage"]["user"]
|
user node["openstack"]["block-storage"]["user"]
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -74,38 +74,34 @@ describe "openstack-block-storage::scheduler" do
|
|||||||
end
|
end
|
||||||
chef_run.converge "openstack-block-storage::scheduler"
|
chef_run.converge "openstack-block-storage::scheduler"
|
||||||
cron = chef_run.cron "cinder-volume-usage-audit"
|
cron = chef_run.cron "cinder-volume-usage-audit"
|
||||||
expect(cron.command).to match(/\/usr\/local\/bin\/cinder-volume-usage-audit/)
|
bin_str="/usr/bin/cinder-volume-usage-audit > /var/log/cinder/audit.log"
|
||||||
expect(cron.command).to match(/\/var\/log\/cinder\/audit.log/)
|
expect(cron.command).to match(/#{bin_str}/)
|
||||||
expect(cron.minute).to eq "00"
|
crontests = [ [:minute, '00'], [:hour, '*'], [:day, '*'],
|
||||||
expect(cron.hour).to eq "*"
|
[:weekday, '*'], [:month, '*'], [:user, 'cinder'] ]
|
||||||
expect(cron.day).to eq "*"
|
crontests.each do |k,v|
|
||||||
expect(cron.weekday).to eq "*"
|
expect(cron.send(k)).to eq v
|
||||||
expect(cron.month).to eq "*"
|
end
|
||||||
expect(cron.user).to eq "cinder"
|
|
||||||
expect(cron.action).to include :create
|
expect(cron.action).to include :create
|
||||||
end
|
end
|
||||||
|
|
||||||
it "creates cron metering custom" do
|
it "creates cron metering custom" do
|
||||||
|
crontests = [ [:minute, '50'], [:hour, '23'], [:day, '6'],
|
||||||
|
[:weekday, '5'], [:month, '11'], [:user, 'foobar'] ]
|
||||||
::Chef::Recipe.any_instance.stub(:search).
|
::Chef::Recipe.any_instance.stub(:search).
|
||||||
with(:node, "roles:os-block-storage-scheduler").
|
with(:node, "roles:os-block-storage-scheduler").
|
||||||
and_return([OpenStruct.new(:name => "foobar")])
|
and_return([OpenStruct.new(:name => "foobar")])
|
||||||
chef_run = ::ChefSpec::ChefRunner.new ::UBUNTU_OPTS do |n|
|
chef_run = ::ChefSpec::ChefRunner.new ::UBUNTU_OPTS do |n|
|
||||||
n.set["openstack"]["metering"] = true
|
n.set["openstack"]["metering"] = true
|
||||||
n.set["openstack"]["block-storage"]["cron"]["minute"] = 50
|
crontests.each do |k,v|
|
||||||
n.set["openstack"]["block-storage"]["cron"]["hour"] = 23
|
n.set["openstack"]["block-storage"]["cron"][k.to_s] = v
|
||||||
n.set["openstack"]["block-storage"]["cron"]["day"] = 6
|
end
|
||||||
n.set["openstack"]["block-storage"]["cron"]["weekday"] = 5
|
|
||||||
n.set["openstack"]["block-storage"]["cron"]["month"] = 11
|
|
||||||
n.set["openstack"]["block-storage"]["user"] = "foobar"
|
n.set["openstack"]["block-storage"]["user"] = "foobar"
|
||||||
end
|
end
|
||||||
chef_run.converge "openstack-block-storage::scheduler"
|
chef_run.converge "openstack-block-storage::scheduler"
|
||||||
cron = chef_run.cron "cinder-volume-usage-audit"
|
cron = chef_run.cron "cinder-volume-usage-audit"
|
||||||
expect(cron.minute).to eq "50"
|
crontests.each do |k,v|
|
||||||
expect(cron.hour).to eq "23"
|
expect(cron.send(k)).to eq v
|
||||||
expect(cron.day).to eq "6"
|
end
|
||||||
expect(cron.weekday).to eq "5"
|
|
||||||
expect(cron.month).to eq "11"
|
|
||||||
expect(cron.user).to eq "foobar"
|
|
||||||
expect(cron.action).to include :delete
|
expect(cron.action).to include :delete
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user