Merge "Compute using new `["openstack"]["mq"]` attributes"

This commit is contained in:
Jenkins 2013-07-10 14:39:55 +00:00 committed by Gerrit Code Review
commit d1d2a02a9c
11 changed files with 175 additions and 82 deletions

View File

@ -1,5 +1,5 @@
{
"sha": "c7d9e0b09c983a031e207c9a6205fb2c8f3313d8",
"sha": "0d2b19d1a43eb2660b126e03334986639f1f3ae0",
"sources": {
"openstack-compute": {
"path": "."
@ -7,17 +7,17 @@
"openstack-image": {
"locked_version": "7.0.0",
"git": "git://github.com/stackforge/cookbook-openstack-image.git",
"ref": "413c654a1f38ed016ba7ffa503f59ae6db7d6bb0"
"ref": "c4af085fd62b542fee13d3a8a4ffdc1885ce37ed"
},
"openstack-identity": {
"locked_version": "7.0.0",
"git": "git://github.com/stackforge/cookbook-openstack-identity.git",
"ref": "ce3677c8dcb0e86ca2f07dcf8baff87de85cd004"
"ref": "029fe8a648939f832f844562d0e18af2a951c783"
},
"openstack-common": {
"locked_version": "0.3.0",
"git": "git://github.com/stackforge/cookbook-openstack-common.git",
"ref": "ae80d36e8f8d5705e01bb6c14238eccb5450a229"
"ref": "25b183f2362fa501cfee4db331491b3d984a5c05"
},
"sysctl": {
"locked_version": "0.2.0",
@ -27,44 +27,44 @@
"apache2": {
"locked_version": "1.6.6"
},
"database": {
"locked_version": "1.4.0"
},
"mysql": {
"locked_version": "3.0.0"
},
"openssl": {
"locked_version": "1.0.2"
},
"build-essential": {
"locked_version": "1.4.0"
},
"postgresql": {
"locked_version": "3.0.0"
},
"apt": {
"locked_version": "1.10.0"
},
"aws": {
"locked_version": "0.101.0"
},
"xfs": {
"locked_version": "1.1.0"
},
"rabbitmq": {
"locked_version": "2.1.0"
"locked_version": "2.1.2"
},
"erlang": {
"locked_version": "1.3.0"
},
"apt": {
"locked_version": "2.0.0"
},
"yum": {
"locked_version": "2.2.2"
"locked_version": "2.3.0"
},
"build-essential": {
"locked_version": "1.4.0"
},
"selinux": {
"locked_version": "0.5.6"
},
"python": {
"locked_version": "1.3.4"
},
"database": {
"locked_version": "1.4.0"
},
"mysql": {
"locked_version": "3.0.2"
},
"openssl": {
"locked_version": "1.0.2"
},
"postgresql": {
"locked_version": "3.0.2"
},
"aws": {
"locked_version": "0.101.2"
},
"xfs": {
"locked_version": "1.1.0"
}
}
}

View File

@ -19,7 +19,6 @@ The following cookbooks are dependencies:
* openstack-common
* openstack-identity
* openstack-image
* rabbitmq
* selinux (Fedora)
* sysctl
* yum
@ -92,6 +91,9 @@ Openstack Compute attributes are in the attribute namespace ["openstack"]["compu
* `openstack["compute"]["db"]["username"]` - Username for nova database access
* `openstack["compute"]["rabbit"]["username"]` - Username for nova rabbit access
* `openstack["compute"]["rabbit"]["vhost"]` - The rabbit vhost to use
* `openstack["compute"]["rabbit"]["port"]` - The rabbit port to use
* `openstack["compute"]["rabbit"]["host"]` - The rabbit host to use (must set when `openstack["compute"]["rabbit"]["ha"]` false).
* `openstack["compute"]["rabbit"]["ha"]` - Whether or not to use rabbit ha
* `openstack["compute"]["service_tenant_name"]` - Tenant name used by nova when interacting with keystone
* `openstack["compute"]["service_user"]` - User name used by nova when interacting with keystone
* `openstack["compute"]["service_role"]` - User role used by nova when interacting with keystone

View File

@ -12,7 +12,7 @@ default["openstack"]["compute"]["custom_template_banner"] = "
# The name of the Chef role that knows about the message queue server
# that Nova uses
default["openstack"]["compute"]["rabbit_server_chef_role"] = "rabbitmq-server"
default["openstack"]["compute"]["rabbit_server_chef_role"] = node["openstack"]["mq"]["server_role"]
default["openstack"]["compute"]["verbose"] = "False"
default["openstack"]["compute"]["debug"] = "False"
@ -29,8 +29,12 @@ default["openstack"]["compute"]["db"]["username"] = "nova"
# and accessed with openstack-common cookbook library's
# user_password routine. You are expected to create
# the user, pass, vhost in a wrapper rabbitmq cookbook.
default["openstack"]["compute"]["rabbit"]["username"] = "rabbit"
default["openstack"]["compute"]["rabbit"]["vhost"] = "/nova"
default["openstack"]["compute"]["rabbit"]["username"] = node["openstack"]["mq"]["user"]
default["openstack"]["compute"]["rabbit"]["vhost"] = node["openstack"]["mq"]["vhost"]
default["openstack"]["compute"]["rabbit"]["port"] = node["openstack"]["mq"]["port"]
default["openstack"]["compute"]["rabbit"]["host"] = node["openstack"]["mq"]["host"]
# Rabbit HA queues
default["openstack"]["compute"]["rabbit"]["ha"] = false
default["openstack"]["compute"]["service_tenant_name"] = "service"
default["openstack"]["compute"]["service_user"] = "nova"

View File

@ -27,7 +27,6 @@ depends "apache2"
depends "openstack-common", "~> 0.3.0"
depends "openstack-identity", "~> 7.0.0"
depends "openstack-image", "~> 7.0.0"
depends "rabbitmq"
depends "selinux"
depends "sysctl"
depends "yum"

View File

@ -99,13 +99,7 @@ else # install from source
end
end
rabbit_server_role = node["openstack"]["compute"]["rabbit_server_chef_role"]
rabbit_info = config_by_role rabbit_server_role, "queue"
rabbit_port = rabbit_info["port"]
rabbit_ipaddress = rabbit_info["host"]
rabbit_user = node["openstack"]["compute"]["rabbit"]["username"]
rabbit_pass = user_password "rabbit"
rabbit_vhost = node["openstack"]["compute"]["rabbit"]["vhost"]
rabbit_pass = user_password node["openstack"]["compute"]["rabbit"]["username"]
# nova db
compute_db_user = node["openstack"]["compute"]["db"]["username"]
@ -129,7 +123,6 @@ auth_uri = ::URI.decode identity_admin_endpoint.to_s
image_endpoint = endpoint "image-api"
Chef::Log.debug("openstack-compute::ceilometer-common:rabbit_info|#{rabbit_info}")
Chef::Log.debug("openstack-compute::ceilometer-common:service_user|#{service_user}")
Chef::Log.debug("openstack-compute::ceilometer-common:service_tenant|#{service_tenant}")
Chef::Log.debug("openstack-compute::ceilometer-common:identity_admin_endpoint|#{identity_admin_endpoint.to_s}")
@ -144,11 +137,7 @@ template ceilometer_conf do
:database_connection => ceilo_db_uri,
:image_endpoint_host => image_endpoint.host,
:identity_endpoint => identity_admin_endpoint,
:rabbit_ipaddress => rabbit_ipaddress,
:rabbit_pass => rabbit_pass,
:rabbit_port => rabbit_port,
:rabbit_user => rabbit_user,
:rabbit_virtual_host=> rabbit_vhost,
:service_pass => service_pass,
:service_tenant_name => service_tenant,
:service_user => service_user,

View File

@ -65,16 +65,14 @@ directory "/etc/nova/rootwrap.d" do
action :create
end
rabbit_server_role = node["openstack"]["compute"]["rabbit_server_chef_role"]
rabbit_info = config_by_role rabbit_server_role, "queue"
db_user = node["openstack"]["compute"]["db"]["username"]
db_pass = db_password "nova"
sql_connection = db_uri("compute", db_user, db_pass)
rabbit_user = rabbit_info && rabbit_info["username"] || node["openstack"]["compute"]["rabbit"]["username"]
rabbit_pass = user_password rabbit_user
rabbit_vhost = rabbit_info && rabbit_info["vhost"] || node["openstack"]["compute"]["rabbit"]["vhost"]
if node["openstack"]["compute"]["rabbit"]["ha"]
rabbit_hosts = rabbit_servers
end
rabbit_pass = user_password node["openstack"]["compute"]["rabbit"]["username"]
identity_service_role = node["openstack"]["compute"]["identity_service_chef_role"]
keystone = config_by_role identity_service_role
@ -94,7 +92,6 @@ compute_api_endpoint = endpoint "compute-api" || {}
ec2_public_endpoint = endpoint "compute-ec2-api" || {}
image_endpoint = endpoint "image-api"
Chef::Log.debug("openstack-compute::nova-common:rabbit_info|#{rabbit_info}")
Chef::Log.debug("openstack-compute::nova-common:keystone|#{keystone}")
Chef::Log.debug("openstack-compute::nova-common:identity_endpoint|#{identity_endpoint.to_s}")
Chef::Log.debug("openstack-compute::nova-common:xvpvnc_endpoint|#{xvpvnc_endpoint.to_s}")
@ -121,11 +118,8 @@ template "/etc/nova/nova.conf" do
:vncserver_listen => vnc_bind_ip,
:vncserver_proxyclient_address => vnc_bind_ip,
:memcache_servers => memcache_servers,
:rabbit_ipaddress => rabbit_info["host"],
:rabbit_user => rabbit_user,
:rabbit_password => rabbit_pass,
:rabbit_port => rabbit_info["port"],
:rabbit_virtual_host => rabbit_vhost,
:rabbit_hosts => rabbit_hosts,
:identity_endpoint => identity_endpoint,
# TODO(jaypipes): No support here for >1 image API servers
# with the glance_api_servers configuration option...

View File

@ -4,9 +4,13 @@ describe "openstack-compute::ceilometer-common" do
before { compute_stubs }
describe "ubuntu" do
before do
@chef_run = ::ChefSpec::ChefRunner.new ::UBUNTU_OPTS
@chef_run = ::ChefSpec::ChefRunner.new(::UBUNTU_OPTS) do |n|
n.set["openstack"]["mq"] = {
"host" => "127.0.0.1"
}
n.set["openstack"]["compute"]["syslog"]["use"] = true
end
@node = @chef_run.node
@node.set["openstack"]["compute"]["ceilometer"]["syslog"]["use"] = true
@chef_run.converge "openstack-compute::ceilometer-common"
end
@ -79,6 +83,31 @@ describe "openstack-compute::ceilometer-common" do
it "has 644 permissions" do
expect(sprintf("%o", @file.mode)).to eq("600")
end
it "has rabbit_user" do
expect(@chef_run).to create_file_with_content @file.name,
"rabbit_userid = guest"
end
it "has rabbit_password" do
expect(@chef_run).to create_file_with_content @file.name,
"rabbit_password = rabbit-pass"
end
it "has rabbit_port" do
expect(@chef_run).to create_file_with_content @file.name,
"rabbit_port = 5672"
end
it "has rabbit_host" do
expect(@chef_run).to create_file_with_content @file.name,
"rabbit_host = 127.0.0.1"
end
it "has rabbit_virtual_host" do
expect(@chef_run).to create_file_with_content @file.name,
"rabbit_virtual_host = /"
end
end
describe "policy.json" do

View File

@ -4,9 +4,12 @@ describe "openstack-compute::nova-common" do
before { compute_stubs }
describe "ubuntu" do
before do
@chef_run = ::ChefSpec::ChefRunner.new ::UBUNTU_OPTS
@node = @chef_run.node
@node.set["openstack"]["compute"]["syslog"]["use"] = true
@chef_run = ::ChefSpec::ChefRunner.new(::UBUNTU_OPTS) do |n|
n.set["openstack"]["mq"] = {
"host" => "127.0.0.1"
}
n.set["openstack"]["compute"]["syslog"]["use"] = true
end
@chef_run.converge "openstack-compute::nova-common"
end
@ -77,38 +80,105 @@ describe "openstack-compute::nova-common" do
expect(sprintf("%o", @file.mode)).to eq "644"
end
it "has rabbit_user" do
expect(@chef_run).to create_file_with_content @file.name,
"rabbit_userid=guest"
end
it "has rabbit_password" do
expect(@chef_run).to create_file_with_content @file.name,
"rabbit_password=rabbit-pass"
end
it "has rabbit_virtual_host" do
expect(@chef_run).to create_file_with_content @file.name,
"rabbit_virtual_host=/"
end
it "has rabbit_host" do
expect(@chef_run).to create_file_with_content @file.name,
"rabbit_host=127.0.0.1"
end
it "does not have rabbit_hosts" do
expect(@chef_run).not_to create_file_with_content @file.name,
"rabbit_hosts="
end
it "does not have rabbit_ha_queues" do
expect(@chef_run).not_to create_file_with_content @file.name,
"rabbit_ha_queues="
end
it "has rabbit_port" do
expect(@chef_run).to create_file_with_content @file.name,
"rabbit_port=5672"
end
describe "rabbit ha" do
before do
@chef_run = ::ChefSpec::ChefRunner.new(::UBUNTU_OPTS) do |n|
n.set["openstack"]["compute"]["rabbit"]["ha"] = true
n.set["cpu"] = {
"total" => "2"
}
end
@chef_run.converge "openstack-compute::nova-common"
end
it "has rabbit_hosts" do
expect(@chef_run).to create_file_with_content @file.name,
"rabbit_hosts=1.1.1.1:5672,2.2.2.2:5672"
end
it "has rabbit_ha_queues" do
expect(@chef_run).to create_file_with_content @file.name,
"rabbit_ha_queues=True"
end
it "does not have rabbit_host" do
expect(@chef_run).not_to create_file_with_content @file.name,
"rabbit_host=127.0.0.1"
end
it "does not have rabbit_port" do
expect(@chef_run).not_to create_file_with_content @file.name,
"rabbit_port=5672"
end
end
it "has vncserver_listen" do
expect(@chef_run).to create_file_with_content "/etc/nova/nova.conf",
expect(@chef_run).to create_file_with_content @file.name,
"vncserver_listen=127.0.1.1"
end
it "has vncserver_proxyclient_address" do
expect(@chef_run).to create_file_with_content "/etc/nova/nova.conf",
expect(@chef_run).to create_file_with_content @file.name,
"vncserver_proxyclient_address=127.0.1.1"
end
it "has xvpvncproxy_host" do
expect(@chef_run).to create_file_with_content "/etc/nova/nova.conf",
expect(@chef_run).to create_file_with_content @file.name,
"xvpvncproxy_host=127.0.1.1"
end
it "has novncproxy_host" do
expect(@chef_run).to create_file_with_content "/etc/nova/nova.conf",
expect(@chef_run).to create_file_with_content @file.name,
"novncproxy_host=127.0.1.1"
end
it "has correct force_dhcp_release value" do
expect(@chef_run).to create_file_with_content "/etc/nova/nova.conf",
expect(@chef_run).to create_file_with_content @file.name,
"force_dhcp_release=true"
end
it "has virtio enabled" do
expect(@chef_run).to create_file_with_content "/etc/nova/nova.conf",
expect(@chef_run).to create_file_with_content @file.name,
"libvirt_use_virtio_for_bridges=true"
end
it "does not have ec2_private_dns_show_ip option" do
expect(@chef_run).to_not create_file_with_content "/etc/nova/nova.conf",
expect(@chef_run).to_not create_file_with_content @file.name,
"ec2_private_dns_show_ip"
end
end

View File

@ -18,13 +18,11 @@ require "chefspec"
}
def compute_stubs
::Chef::Recipe.any_instance.stub(:rabbit_servers).
and_return "1.1.1.1:5672,2.2.2.2:5672"
::Chef::Recipe.any_instance.stub(:address_for).
with("lo").
and_return "127.0.1.1"
::Chef::Recipe.any_instance.stub(:config_by_role).
with("rabbitmq-server", "queue").and_return(
{ 'host' => 'rabbit-host', 'port' => 'rabbit-port' }
)
::Chef::Recipe.any_instance.stub(:config_by_role).
with("os-identity").and_return(
{
@ -41,6 +39,9 @@ def compute_stubs
and_return "bootstrap-token"
::Chef::Recipe.any_instance.stub(:db_password).and_return String.new
::Chef::Recipe.any_instance.stub(:user_password).and_return String.new
::Chef::Recipe.any_instance.stub(:user_password).
with("guest").
and_return "rabbit-pass"
::Chef::Recipe.any_instance.stub(:service_password).with("openstack-compute").
and_return "nova-pass"
::Chef::Recipe.any_instance.stub(:memcached_servers).and_return []

View File

@ -6,11 +6,11 @@ os_username = <%= @service_user %>
policy_file = /etc/ceilometer/policy.json
sql_connection = <%= @sql_connection %>
<%= @database_connection ? "database_connection = #{@database_connection}" : nil %>
rabbit_userid = <%= @rabbit_user %>
rabbit_userid = <%= node["openstack"]["compute"]["rabbit"]["username"] %>
rabbit_password = <%= @rabbit_pass %>
<%= "rabbit_port = #{@rabbit_port}" if @rabbit_port %>
rabbit_host = <%= @rabbit_ipaddress %>
<%= "rabbit_virtual_host = #{@rabbit_virtual_host}" if @rabbit_virtual_host %>
rabbit_port = <%= node["openstack"]["compute"]["rabbit"]["port"] %>
rabbit_host = <%= node["openstack"]["compute"]["rabbit"]["host"] %>
rabbit_virtual_host = <%= node["openstack"]["compute"]["rabbit"]["vhost"] %>
verbose = True
notification_topics = notifications,glance_notifications
rpc_backend = ceilometer.openstack.common.rpc.impl_kombu

View File

@ -16,11 +16,16 @@ state_path=/var/lib/nova
lock_path=/var/lock/nova
##### RABBITMQ #####
rabbit_userid=<%= @rabbit_user %>
rabbit_userid=<%= node["openstack"]["compute"]["rabbit"]["username"] %>
rabbit_password=<%= @rabbit_password %>
<%= "rabbit_port=#{@rabbit_port}" if @rabbit_port %>
rabbit_host=<%= @rabbit_ipaddress %>
rabbit_virtual_host=<%= @rabbit_virtual_host %>
rabbit_virtual_host=<%= node["openstack"]["compute"]["rabbit"]["vhost"] %>
<% if node["openstack"]["compute"]["rabbit"]["ha"] -%>
rabbit_hosts=<%= @rabbit_hosts %>
rabbit_ha_queues=True
<% else -%>
rabbit_host=<%= node["openstack"]["compute"]["rabbit"]["host"] %>
rabbit_port=<%= node["openstack"]["compute"]["rabbit"]["port"] %>
<% end -%>
##### SCHEDULER #####
# scheduler_manager=nova.scheduler.manager.SchedulerManager