port volume to osops-utils
This commit is contained in:
@@ -37,7 +37,7 @@ default["nova"]["services"]["novnc"]["path"] = "/vnc_auto.html"
|
||||
default["nova"]["services"]["volume"]["scheme"] = "http"
|
||||
default["nova"]["services"]["volume"]["network"] = "public"
|
||||
default["nova"]["services"]["volume"]["port"] = 8776
|
||||
default["nova"]["services"]["volume"]["path"] = "/v1"
|
||||
default["nova"]["services"]["volume"]["path"] = "/v1/%(tenant_id)s"
|
||||
|
||||
# can this be wedged into the "api" endpoint?
|
||||
default["nova"]["compute"]["region"] = "RegionOne"
|
||||
@@ -92,6 +92,10 @@ when "fedora"
|
||||
"api_ec2_service" => "openstack-nova-api",
|
||||
"api_os_compute_packages" => ["openstack-nova"],
|
||||
"api_os_compute_service" => "openstack-nova-api",
|
||||
"api_os_volume_packages" => ["openstack-nova"],
|
||||
"api_os_volume_service" => "openstack_nova_api",
|
||||
"nova_volume_packages" => ["openstack-nova"],
|
||||
"nova_volume_service" => "openstack-nova-volume",
|
||||
"common_packages" => ["openstack-nova"],
|
||||
"package_overrides" => ""
|
||||
}
|
||||
@@ -101,6 +105,10 @@ when "ubuntu"
|
||||
"api_ec2_service" => "nova-api-ec2",
|
||||
"api_os_compute_packages" => ["nova-api-os-compute"],
|
||||
"api_os_compute_service" => "nova-api-os-compute",
|
||||
"api_os_volume_packages" => ["nova-api-os-volume"],
|
||||
"api_os_volume_service" => "nova-api-os-volume",
|
||||
"nova_volume_packages" => ["nova-volume"],
|
||||
"nova_volume_service" => "nova-volume",
|
||||
"common_packages" => ["nova-common"],
|
||||
"package_overrides" => "-o Dpkg::Options::='--force-confold'-o Dpkg::Options::='--force-confdef'"
|
||||
}
|
||||
|
||||
@@ -19,18 +19,7 @@
|
||||
|
||||
include_recipe "nova::nova-common"
|
||||
|
||||
# Distribution specific settings go here
|
||||
if platform?(%w{fedora})
|
||||
# Fedora
|
||||
nova_api_os_volume_package = "openstack-nova"
|
||||
nova_api_os_volume_service = "openstack-nova-api"
|
||||
nova_api_os_volume_package_options = ""
|
||||
else
|
||||
# All Others (right now Debian and Ubuntu)
|
||||
nova_api_os_volume_package = "nova-api-os-volume"
|
||||
nova_api_os_volume_service = nova_api_os_volume_package
|
||||
nova_api_os_volume_package_options = "-o Dpkg::Options::='--force-confold' --force-yes"
|
||||
end
|
||||
platform_options = node["nova"]["platform"]
|
||||
|
||||
directory "/var/lock/nova" do
|
||||
owner "nova"
|
||||
@@ -43,36 +32,23 @@ package "python-keystone" do
|
||||
action :upgrade
|
||||
end
|
||||
|
||||
package nova_api_os_volume_package do
|
||||
action :upgrade
|
||||
options nova_api_os_volume_package_options
|
||||
platform_options["api_os_volume_packages"].each do |pkg|
|
||||
package pkg do
|
||||
action :upgrade
|
||||
options platform_options["package_overrides"]
|
||||
end
|
||||
end
|
||||
|
||||
service nova_api_os_volume_service do
|
||||
service "nova-api-os-volume" do
|
||||
service_name platform_options["api_os_volume_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-volume/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-volume/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
|
||||
ks_admin_endpoint = get_access_endpoint("keystone", "keystone", "admin-api")
|
||||
ks_service_endpoint = get_access_endpoint("keystone", "keystone", "service-api")
|
||||
keystone = get_settings_by_role("keystone","keystone")
|
||||
|
||||
template "/etc/nova/api-paste.ini" do
|
||||
source "api-paste.ini.erb"
|
||||
@@ -80,11 +56,11 @@ 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
|
||||
"component" => node["package_component"],
|
||||
"service_port" => ks_service_endpoint["port"],
|
||||
"keystone_api_ipaddress" => ks_service_endpoint["host"],
|
||||
"admin_port" => ks_admin_endpoint["port"],
|
||||
"admin_token" => keystone["admin_token"]
|
||||
)
|
||||
notifies :restart, resources(:service => nova_api_os_volume_service), :delayed
|
||||
notifies :restart, resources(:service => "nova-api-os-volume"), :delayed
|
||||
end
|
||||
|
||||
@@ -6,80 +6,55 @@
|
||||
include_recipe "nova::nova-common"
|
||||
include_recipe "nova::api-os-volume"
|
||||
|
||||
# Distribution specific settings go here
|
||||
if platform?(%w{fedora})
|
||||
# Fedora
|
||||
nova_volume_package = "openstack-nova"
|
||||
nova_volume_service = "openstack-nova-volume"
|
||||
nova_volume_package_options = ""
|
||||
else
|
||||
# All Others (right now Debian and Ubuntu)
|
||||
nova_volume_package = "nova-volume"
|
||||
nova_volume_service = nova_volume_package
|
||||
nova_volume_package_options = "-o Dpkg::Options::='--force-confold' --force-yes"
|
||||
end
|
||||
platform_options = node["nova"]["platform"]
|
||||
|
||||
package "python-keystone" do
|
||||
action :upgrade
|
||||
end
|
||||
|
||||
package nova_volume_package do
|
||||
action :upgrade
|
||||
options nova_volume_package_options
|
||||
platform_options["nova_volume_packages"].each do |pkg|
|
||||
package pkg do
|
||||
action :upgrade
|
||||
options platform_options["package_overrides"]
|
||||
end
|
||||
end
|
||||
|
||||
service nova_volume_service do
|
||||
service "nova-volume" do
|
||||
service_name platform_options["nova_volume_service"]
|
||||
supports :status => true, :restart => true
|
||||
action :disable
|
||||
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::volume/keystone: using search")
|
||||
keystone_api_ip = keystone[0]['keystone']['api_ipaddress']
|
||||
keystone_admin_port = keystone[0]['keystone']['admin_port']
|
||||
keystone_admin_token = keystone[0]['keystone']['admin_token']
|
||||
else
|
||||
Chef::Log.info("nova::volume/keystone: NOT using search")
|
||||
keystone_api_ip = node['keystone']['api_ipaddress']
|
||||
keystone_admin_port = node['keystone']['admin_port']
|
||||
keystone_admin_token = node['keystone']['admin_token']
|
||||
end
|
||||
end
|
||||
ks_admin_endpoint = get_access_endpoint("keystone", "keystone", "admin-api")
|
||||
ks_service_endpoint = get_access_endpoint("keystone", "keystone", "service-api")
|
||||
keystone = get_settings_by_role("keystone","keystone")
|
||||
volume_endpoint = get_access_endpoint("nova-volume", "nova", "volume")
|
||||
|
||||
# Register Volume Service
|
||||
keystone_register "Register Volume 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 "Volume Service"
|
||||
service_type "volume"
|
||||
service_description "Nova Volume Service"
|
||||
action :create_service
|
||||
end
|
||||
|
||||
node["nova"]["volume"]["adminURL"] = "http://#{node["nova"]["volume"]["ipaddress"]}:#{node["nova"]["volume"]["api_port"]}/v1/%(tenant_id)s"
|
||||
node["nova"]["volume"]["internalURL"] = node["nova"]["volume"]["adminURL"]
|
||||
node["nova"]["volume"]["publicURL"] = node["nova"]["volume"]["adminURL"]
|
||||
|
||||
# Register Image Endpoint
|
||||
keystone_register "Register Volume 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 "volume"
|
||||
endpoint_region "RegionOne"
|
||||
endpoint_adminurl node["nova"]["volume"]["adminURL"]
|
||||
endpoint_internalurl node["nova"]["volume"]["internalURL"]
|
||||
endpoint_publicurl node["nova"]["volume"]["publicURL"]
|
||||
endpoint_adminurl volume_endpoint["uri"]
|
||||
endpoint_internalurl volume_endpoint["uri"]
|
||||
endpoint_publicurl volume_endpoint["uri"]
|
||||
action :create_endpoint
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user