Associate role related logs in role configs.

Define role related log attributes in role configs so that
recipe does not need to check its own role every time when
writing a role related config from template, because those
info would already have been in role definition and passed
down to node attributes.
Process monitoring can use the same mechanism.

Change-Id: Ifb10da356baf99d2d7e21c8d4d3d8df38fc81f58
This commit is contained in:
Jerry Zhao 2014-08-04 16:14:48 -07:00
parent 6c24eaa1fc
commit bb869f8cfd
15 changed files with 151 additions and 117 deletions

View File

@ -22,28 +22,5 @@ default["rsyslog"]["server"] = false
default["rsyslog"]["protocol"] = "tcp"
default["rsyslog"]["port"] = "514"
default["rsyslog"]["server_role"] = "loghost"
default["rsyslog"]["novalog"] = {:"nova-api"=>"/var/log/nova/api.log",
:"nova-conductor"=>"/var/log/nova/conductor.log",
:"nova-compute"=>"/var/log/nova/compute.log",
:"nova-scheduler"=>"/var/log/nova/scheduler.log"}
default["rsyslog"]["debiannovalog"] = {:"nova-api"=>"/var/log/nova/nova-api.log",
:"nova-conductor"=>"/var/log/nova/nova-conductor.log",
:"nova-compute"=>"/var/log/nova/nova-compute.log",
:"nova-scheduler"=>"/var/log/nova/nova-scheduler.log"}
default["rsyslog"]["glancelog"] = {:"glance-api"=>"/var/log/glance/api.log",
:"glance-reg"=>"/var/log/glance/registry.log"}
default["rsyslog"]["cinderlog"] = {:"cinder-api"=>"/var/log/cinder/api.log",
:"cinder-scheduler"=>"/var/log/cinder/scheduler.log",
:"cinder-volume"=>"/var/log/cinder/volume.log"}
default["rsyslog"]["debiancinderlog"] = {:"cinder-api"=>"/var/log/cinder/cinder-api.log",
:"cinder-scheduler"=>"/var/log/cinder/cinder-scheduler.log",
:"cinder-volume"=>"/var/log/cinder/cinder-volume.log"}
default["rsyslog"]["quantumlog"] = {:"quantum-server"=>"/var/log/quantum/server.log",
:"quantum-dhcp"=>"/var/log/quantum/dhcp-agent.log",
:"quantum-l3agent"=>"/var/log/quantum/l3-agent.log",
:"quantum-ovsagent"=>"/var/log/quantum/openvswitch-agent.log"}
default["rsyslog"]["keystonelog"] = {:"keystone"=>"/var/log/keystone/keystone.log"}
default["rsyslog"]["messaginglog"] = {:"rabbitmq"=>"/var/log/rabbitmq/rabbit\@#{node['hostname']}.log"}
default["rsyslog"]["mysqllog"] = {:"mysqld"=>"/var/log/mysqld.log"}
default["rsyslog"]["debianmysqllog"] = {:"mysqld"=>"/var/log/mysql.log"}
default["rsyslog"]["sysstatlog"] = {:"dstat"=>"/var/log/dstat.log"}
default["rsyslog"]["rhelloglist"] = { "dstat"=>"/var/log/dstat.log" }
default["rsyslog"]["debianloglist"] = { "dstat"=>"/var/log/dstat.log" }

View File

@ -29,107 +29,28 @@ execute "dstat" do
action :run
end
if roles.gsub("\n",",").strip =~ /os-compute/
template "/etc/rsyslog.d/nova.conf" do
source "openstack.conf.erb"
backup false
owner "root"
group "root"
mode 0644
case node["platform_family"]
when "debian"
variables :loglist => node['rsyslog']['debiannovalog']
when "rhel"
variables :loglist => node['rsyslog']['novalog']
end
notifies :restart, "service[rsyslog]"
end
end
if roles.gsub("\n",",").strip =~ /os-identity/
template "/etc/rsyslog.d/keystone.conf" do
source "openstack.conf.erb"
backup false
owner "root"
group "root"
mode 0644
variables :loglist => node['rsyslog']['keystonelog']
notifies :restart, "service[rsyslog]"
end
end
if roles.gsub("\n",",").strip =~ /os-image/
template "/etc/rsyslog.d/glance.conf" do
source "openstack.conf.erb"
backup false
owner "root"
group "root"
mode 0644
variables :loglist => node['rsyslog']['glancelog']
notifies :restart, "service[rsyslog]"
end
end
if roles.gsub("\n",",").strip =~ /os-block-storage/
template "/etc/rsyslog.d/cinder.conf" do
source "openstack.conf.erb"
backup false
owner "root"
group "root"
mode 0644
case node["platform_family"]
when "debian"
variables :loglist => node['rsyslog']['debiancinderlog']
when "rhel"
variables :loglist => node['rsyslog']['cinderlog']
end
notifies :restart, "service[rsyslog]"
end
end
if roles.gsub("\n",",").strip =~ /os-network/
template "/etc/rsyslog.d/quantum.conf" do
source "openstack.conf.erb"
backup false
owner "root"
group "root"
mode 0644
variables :loglist => node['rsyslog']['quantumlog']
notifies :restart, "service[rsyslog]"
end
end
if roles.gsub("\n",",").strip =~ /os-ops-messaging/
template "/etc/rsyslog.d/messaging.conf" do
source "openstack.conf.erb"
backup false
owner "root"
group "root"
mode 0644
variables :loglist => node['rsyslog']['messaginglog']
notifies :restart, "service[rsyslog]"
end
end
if roles.gsub("\n",",").strip =~ /os-ops-database/
template "/etc/rsyslog.d/database.conf" do
source "openstack.conf.erb"
backup false
owner "root"
group "root"
mode 0644
case node["platform_family"]
when "debian"
variables :loglist => node['rsyslog']['debianmysqllog']
when "rhel"
variables :loglist => node['rsyslog']['mysqllog']
end
notifies :restart, "service[rsyslog]"
case node["platform_family"]
when "debian"
node.force_override['rsyslog']['debianloglist']['rabbitmq']="/var/log/rabbitmq/rabbit\@#{node['hostname']}.log"
when "rhel"
node.force_override['rsyslog']['rhelloglist']['rabbitmq']="/var/log/rabbitmq/rabbit\@#{node['hostname']}.log"
end
end
template "/etc/rsyslog.d/sysstat.conf" do
template "/etc/rsyslog.d/openstack.conf" do
source "openstack.conf.erb"
backup false
owner "root"
group "root"
mode 0644
variables :loglist => node['rsyslog']['sysstatlog']
notifies :restart, "service[rsyslog]", :immediately
case node["platform_family"]
when "debian"
variables :loglist => node['rsyslog']['debianloglist']
when "rhel"
variables :loglist => node['rsyslog']['rhelloglist']
end
notifies :restart, "service[rsyslog]"
end
file "/etc/rsyslog.d/server.conf" do

View File

@ -1,5 +1,15 @@
name "os-block-storage-api"
description "OpenStack Block Storage API service"
override_attributes(
"rsyslog" => {
"rhelloglist" => {
"cinder-api" => "/var/log/cinder/api.log"
},
"debianloglist" => {
"cinder-api" => "/var/log/cinder/cinder-api.log"
}
}
)
run_list(
"role[os-base]",
"recipe[openstack-block-storage::api]"

View File

@ -1,5 +1,15 @@
name "os-block-storage-scheduler"
description "OpenStack Block Storage Scheduler service"
override_attributes(
"rsyslog" => {
"rhelloglist" => {
"cinder-scheduler" => "/var/log/cinder/scheduler.log"
},
"debianloglist" => {
"cinder-scheduler" => "/var/log/cinder/cinder-scheduler.log"
}
}
)
run_list(
"role[os-base]",
"recipe[openstack-block-storage::scheduler]"

View File

@ -1,5 +1,15 @@
name "os-block-storage-worker"
description "OpenStack Block Storage worker"
override_attributes(
"rsyslog" => {
"rhelloglist" => {
"cinder-volume" => "/var/log/cinder/volume.log"
},
"debianloglist" => {
"cinder-volume" => "/var/log/cinder/cinder-volume.log"
}
}
)
run_list(
"role[os-base]",
"recipe[openstack-block-storage::volume]"

View File

@ -1,5 +1,15 @@
name "os-compute-api-os-compute"
description "OpenStack API for Compute"
override_attributes(
"rsyslog" => {
"rhelloglist" => {
"nova-api" => "/var/log/nova/api.log"
},
"debianloglist" => {
"nova-api" => "/var/log/nova/nova-api.log"
}
}
)
run_list(
"role[os-base]",
"recipe[openstack-compute::api-os-compute]"

View File

@ -1,5 +1,17 @@
name "os-compute-scheduler"
description "Nova scheduler"
override_attributes(
"rsyslog" => {
"rhelloglist" => {
"nova-scheduler" => "/var/log/nova/scheduler.log",
"nova-conductor" => "/var/log/nova/conductor.log"
},
"debianloglist" => {
"nova-scheduler" => "/var/log/nova/nova-scheduler.log",
"nova-conductor" => "/var/log/nova/nova-conductor.log"
}
}
)
run_list(
"role[os-base]",
"recipe[openstack-compute::scheduler]"

View File

@ -1,5 +1,15 @@
name "os-compute-worker"
description "The compute node, most likely with a hypervisor."
override_attributes(
"rsyslog" => {
"rhelloglist" => {
"nova-compute" => "/var/log/nova/compute.log"
},
"debianloglist" => {
"nova-compute" => "/var/log/nova/nova-compute.log"
}
}
)
run_list(
"role[os-base]",
"recipe[openstack-compute::compute]"

View File

@ -1,5 +1,15 @@
name "os-identity"
description "Roll-up role for Identity"
override_attributes(
"rsyslog" => {
"rhelloglist" => {
"keystone" => "/var/log/keystone/keystone.log"
},
"debianloglist" => {
"keystone" => "/var/log/keystone/keystone.log"
}
}
)
run_list(
"role[os-base]",
"recipe[openstack-identity::server]",

View File

@ -1,5 +1,15 @@
name "os-image-api"
description "Glance API service"
override_attributes(
"rsyslog" => {
"rhelloglist" => {
"glance-api" => "/var/log/glance/api.log"
},
"debianloglist" => {
"glance-api" => "/var/log/glance/api.log"
}
}
)
run_list(
"role[os-base]",
#"recipe[openstack-image::db]",

View File

@ -1,5 +1,15 @@
name "os-image-registry"
description "Glance Registry service"
override_attributes(
"rsyslog" => {
"rhelloglist" => {
"glance-registry" => "/var/log/glance/registry.log"
},
"debianloglist" => {
"glance-registry" => "/var/log/glance/registry.log"
}
}
)
run_list(
"role[os-base]",
#"recipe[openstack-image::db]",

View File

@ -1,5 +1,15 @@
name "os-network-server"
description "Configures OpenStack networking, managed by attribute for either nova-network or quantum"
override_attributes(
"rsyslog" => {
"rhelloglist" => {
"quantum-server" => "/var/log/quantum/server.log"
},
"rhelloglist" => {
"quantum-server" => "/var/log/quantum/server.log"
}
}
)
run_list(
"role[os-base]",
"recipe[openstack-network::server]"

View File

@ -1,5 +1,19 @@
name "os-network"
description "Configures OpenStack networking, managed by attribute for either nova-network or quantum"
override_attributes(
"rsyslog" => {
"rhelloglist" => {
"quantum-ovsagent" => "/var/log/quantum/openvswitch-agent.log",
"quantum-dhcp" => "/var/log/quantum/dhcp-agent.log",
"quantum-l3agent" => "/var/log/quantum/l3-agent.log"
},
"rhelloglist" => {
"quantum-ovsagent" => "/var/log/quantum/openvswitch-agent.log",
"quantum-dhcp" => "/var/log/quantum/dhcp-agent.log",
"quantum-l3agent" => "/var/log/quantum/l3-agent.log"
},
}
)
run_list(
"role[os-base]",
"recipe[openstack-network::openvswitch]",

View File

@ -1,5 +1,15 @@
name "os-ops-database"
description "Currently MySQL Server (non-ha)"
override_attributes(
"rsyslog" => {
"rhelloglist" => {
"mysqld" => "/var/log/mysqld.log"
},
"debianloglist" => {
"mysqld" => "/var/log/mysql.log"
}
}
)
run_list(
"role[os-base]",
"recipe[openstack-ops-database::server]",

View File

@ -1,5 +1,15 @@
name "os-ops-messaging"
description "Currently RabbitMQ Server (non-ha)"
override_attributes(
"rsyslog" => {
"rhelloglist" => {
"rabbitmq" => "/var/log/rabbitmq/rabbit\@$hostname.log"
},
"debianloglist" => {
"rabbitmq" => "/var/log/rabbitmq/rabbit\@$hostname.log"
}
}
)
run_list(
"role[os-base]",
"recipe[openstack-ops-messaging::server]"