port api-os-compute recipe
This commit is contained in:
@@ -90,6 +90,8 @@ when "fedora"
|
||||
default["nova"]["platform"] = {
|
||||
"api_ec2_packages" => ["openstack-nova"],
|
||||
"api_ec2_service" => "openstack-nova-api",
|
||||
"api_os_compute_packages" => ["openstack-nova"],
|
||||
"api_os_compute_service" => "openstack-nova-api",
|
||||
"common_packages" => ["openstack-nova"],
|
||||
"package_overrides" => ""
|
||||
}
|
||||
@@ -97,6 +99,8 @@ when "ubuntu"
|
||||
default["nova"]["platform"] = {
|
||||
"api_ec2_packages" => ["nova-api-ec2"],
|
||||
"api_ec2_service" => "nova-api-ec2",
|
||||
"api_os_compute_packages" => ["nova-api-os-compute"],
|
||||
"api_os_compute_service" => "nova-api-os-compute",
|
||||
"common_packages" => ["nova-common"],
|
||||
"package_overrides" => "-o Dpkg::Options::='--force-confold'-o Dpkg::Options::='--force-confdef'"
|
||||
}
|
||||
|
||||
@@ -22,70 +22,46 @@ include_recipe "nova::nova-common"
|
||||
# Set a secure keystone service password
|
||||
node.set_unless['nova']['service_pass'] = secure_password
|
||||
|
||||
platform_options = node["nova"]["platform"]
|
||||
|
||||
#TODO(breu): test for fedora
|
||||
# Distribution specific settings go here
|
||||
if platform?(%w{fedora})
|
||||
# Fedora
|
||||
nova_api_os_compute_package = "openstack-nova"
|
||||
nova_api_os_compute_service = "openstack-nova-api"
|
||||
nova_api_os_compute_package_options = ""
|
||||
else
|
||||
# All Others (right now Debian and Ubuntu)
|
||||
nova_api_os_compute_package = "nova-api-os-compute"
|
||||
nova_api_os_compute_service = nova_api_os_compute_package
|
||||
nova_api_os_compute_package_options = "-o Dpkg::Options::='--force-confold' --force-yes"
|
||||
end
|
||||
|
||||
directory "/var/lock/nova" do
|
||||
owner "nova"
|
||||
group "nova"
|
||||
mode "0755"
|
||||
action :create
|
||||
owner "nova"
|
||||
group "nova"
|
||||
mode "0755"
|
||||
action :create
|
||||
end
|
||||
|
||||
package "python-keystone" do
|
||||
action :upgrade
|
||||
end
|
||||
|
||||
package nova_api_os_compute_package do
|
||||
action :upgrade
|
||||
options nova_api_os_compute_package_options
|
||||
platform_options["api_os_compute_packages"].each do |pkg|
|
||||
package pkg do
|
||||
action :upgrade
|
||||
options platform_options["package_overrides"]
|
||||
end
|
||||
end
|
||||
|
||||
service nova_api_os_compute_service do
|
||||
service "nova-api-os-compute" do
|
||||
service_name platform_options["nova_os_compute_service"]
|
||||
supports :status => true, :restart => true
|
||||
action :enable
|
||||
subscribes :restart, resources(:template => "/etc/nova/nova.conf"), :delayed
|
||||
end
|
||||
|
||||
if Chef::Config[:solo]
|
||||
Chef::Log.warn("This recipe uses search. Chef Solo does not support search.")
|
||||
else
|
||||
# Lookup keystone api ip address
|
||||
keystone, something, arbitrary_value = Chef::Search::Query.new.search(:node, "roles:keystone AND chef_environment:#{node.chef_environment}")
|
||||
if keystone.length > 0
|
||||
Chef::Log.info("nova::api-os-compute/keystone using search")
|
||||
keystone_api_ip = keystone[0]['keystone']['api_ipaddress']
|
||||
keystone_service_port = keystone[0]['keystone']['service_port']
|
||||
keystone_admin_port = keystone[0]['keystone']['admin_port']
|
||||
keystone_admin_token = keystone[0]['keystone']['admin_token']
|
||||
else
|
||||
Chef::Log.info("nova::api-os-compute/keystone NOT using search")
|
||||
keystone_api_ip = node['keystone']['api_ipaddress']
|
||||
keystone_service_port = node['keystone']['service_port']
|
||||
keystone_admin_port = node['keystone']['admin_port']
|
||||
keystone_admin_token = node['keystone']['admin_token']
|
||||
end
|
||||
end
|
||||
keystone = get_settings_by_role("keystone", "keystone")
|
||||
ks_admin_endpoint = get_access_endpoint("keystone", "keystone", "admin-api")
|
||||
ks_service_endpoint = get_access_endpoint("keystone", "keystone", "service-api")
|
||||
nova_api_endpoint = get_access_endpoint("nova-api-os-compute", "nova", "api")
|
||||
|
||||
# Register Service Tenant
|
||||
keystone_register "Register Service Tenant" do
|
||||
auth_host keystone_api_ip
|
||||
auth_port keystone_admin_port
|
||||
auth_protocol "http"
|
||||
api_ver "/v2.0"
|
||||
auth_token keystone_admin_token
|
||||
auth_host ks_admin_endpoint["host"]
|
||||
auth_port ks_admin_endpoint["port"]
|
||||
auth_protocol ks_admin_endpoint["scheme"]
|
||||
api_ver ks_admin_endpoint["path"]
|
||||
auth_token keystone["admin_token"]
|
||||
tenant_name node["nova"]["service_tenant_name"]
|
||||
tenant_description "Service Tenant"
|
||||
tenant_enabled "true" # Not required as this is the default
|
||||
@@ -94,11 +70,11 @@ end
|
||||
|
||||
# Register Service User
|
||||
keystone_register "Register Service User" do
|
||||
auth_host keystone_api_ip
|
||||
auth_port keystone_admin_port
|
||||
auth_protocol "http"
|
||||
api_ver "/v2.0"
|
||||
auth_token keystone_admin_token
|
||||
auth_host ks_admin_endpoint["host"]
|
||||
auth_port ks_admin_endpoint["port"]
|
||||
auth_protocol ks_admin_endpoint["scheme"]
|
||||
api_ver ks_admin_endpoint["path"]
|
||||
auth_token keystone["admin_token"]
|
||||
tenant_name node["nova"]["service_tenant_name"]
|
||||
user_name node["nova"]["service_user"]
|
||||
user_pass node["nova"]["service_pass"]
|
||||
@@ -108,11 +84,11 @@ end
|
||||
|
||||
## Grant Admin role to Service User for Service Tenant ##
|
||||
keystone_register "Grant 'admin' Role to Service User for Service Tenant" do
|
||||
auth_host keystone_api_ip
|
||||
auth_port keystone_admin_port
|
||||
auth_protocol "http"
|
||||
api_ver "/v2.0"
|
||||
auth_token keystone_admin_token
|
||||
auth_host ks_admin_endpoint["host"]
|
||||
auth_port ks_admin_endpoint["port"]
|
||||
auth_protocol ks_admin_endpoint["scheme"]
|
||||
api_ver ks_admin_endpoint["path"]
|
||||
auth_token keystone["admin_token"]
|
||||
tenant_name node["nova"]["service_tenant_name"]
|
||||
user_name node["nova"]["service_user"]
|
||||
role_name node["nova"]["service_role"]
|
||||
@@ -121,11 +97,11 @@ end
|
||||
|
||||
# Register Compute Service
|
||||
keystone_register "Register Compute Service" do
|
||||
auth_host keystone_api_ip
|
||||
auth_port keystone_admin_port
|
||||
auth_protocol "http"
|
||||
api_ver "/v2.0"
|
||||
auth_token keystone_admin_token
|
||||
auth_host ks_admin_endpoint["host"]
|
||||
auth_port ks_admin_endpoint["port"]
|
||||
auth_protocol ks_admin_endpoint["scheme"]
|
||||
api_ver ks_admin_endpoint["path"]
|
||||
auth_token keystone["admin_token"]
|
||||
service_name "nova"
|
||||
service_type "compute"
|
||||
service_description "Nova Compute Service"
|
||||
@@ -138,22 +114,22 @@ template "/etc/nova/api-paste.ini" do
|
||||
group "root"
|
||||
mode "0644"
|
||||
variables(
|
||||
:component => node["package_component"],
|
||||
:service_port => keystone_service_port,
|
||||
:keystone_api_ipaddress => keystone_api_ip,
|
||||
:admin_port => keystone_admin_port,
|
||||
:admin_token => keystone_admin_token
|
||||
)
|
||||
notifies :restart, resources(:service => nova_api_os_compute_service), :delayed
|
||||
"component" => node["package_component"],
|
||||
"keystone_api_ipaddress" => ks_service_endpoint["host"],
|
||||
"service_port" => ks_service_endpoint["port"],
|
||||
"admin_port" => ks_admin_endpoint["port"],
|
||||
"admin_token" => keystone["admin_token"]
|
||||
)
|
||||
notifies :restart, resources(:service => "nova-api-os-compute"), :delayed
|
||||
end
|
||||
|
||||
# Register Compute Endpoing
|
||||
keystone_register "Register Compute Endpoint" do
|
||||
auth_host keystone_api_ip
|
||||
auth_port keystone_admin_port
|
||||
auth_protocol "http"
|
||||
api_ver "/v2.0"
|
||||
auth_token keystone_admin_token
|
||||
auth_host ks_admin_endpoint["host"]
|
||||
auth_port ks_admin_endpoint["port"]
|
||||
auth_protocol ks_admin_endpoint["scheme"]
|
||||
api_ver ks_admin_endpoint["path"]
|
||||
auth_token keystone["admin_token"]
|
||||
service_type "compute"
|
||||
endpoint_region node["nova"]["compute"]["region"]
|
||||
endpoint_adminurl node["nova"]["compute"]["adminURL"]
|
||||
|
||||
Reference in New Issue
Block a user