formatting changes to conform to a common standard

This commit is contained in:
John Dewey 2012-11-21 22:22:34 -08:00
parent 2819753246
commit 4f35444f8c
15 changed files with 264 additions and 209 deletions

View File

@ -19,21 +19,22 @@
class ::Chef::Recipe
include ::Openstack
include ::Opscode::OpenSSL::Password
end
::Chef::Recipe.send(:include, Opscode::OpenSSL::Password)
include_recipe "nova::nova-common"
platform_options=node["nova"]["platform"]
platform_options = node["nova"]["platform"]
# Set a secure keystone service password
node.set_unless['nova']['service_pass'] = secure_password
directory "/var/lock/nova" do
owner "nova"
group "nova"
mode "0755"
action :create
owner "nova"
group "nova"
mode 00755
action :create
end
package "python-keystone" do
@ -42,25 +43,27 @@ end
platform_options["api_ec2_packages"].each do |pkg|
package pkg do
action :upgrade
options platform_options["package_overrides"]
action :upgrade
end
end
service "nova-api-ec2" do
service_name platform_options["api_ec2_service"]
supports :status => true, :restart => true
action :enable
subscribes :restart, resources(:template => "/etc/nova/nova.conf"), :delayed
action :enable
end
identity_admin_endpoint = endpoint('identity-admin')
identity_endpoint = endpoint('identity-api')
identity_admin_endpoint = endpoint "identity-admin"
identity_endpoint = endpoint "identity-api"
keystone_service_role = node["nova"]["keystone_service_chef_role"]
keystone = get_settings_by_role(keystone_service_role, "keystone")
keystone = get_settings_by_role keystone_service_role, "keystone"
ec2_admin_endpoint = endpoint('compute-ec2-admin')
ec2_public_endpoint = endpoint('compute-ec2-api')
ec2_admin_endpoint = endpoint "compute-ec2-admin"
ec2_public_endpoint = endpoint "compute-ec2-api"
# Register Service Tenant
keystone_register "Register Service Tenant" do
@ -72,6 +75,7 @@ keystone_register "Register Service Tenant" do
tenant_name node["nova"]["service_tenant_name"]
tenant_description "Service Tenant"
tenant_enabled "true" # Not required as this is the default
action :create_tenant
end
@ -86,10 +90,11 @@ keystone_register "Register Service User" do
user_name node["nova"]["service_user"]
user_pass node["nova"]["service_pass"]
user_enabled "true" # Not required as this is the default
action :create_user
end
## Grant Admin role to Service User for Service Tenant ##
# Grant Admin role to Service User for Service Tenant
keystone_register "Grant 'admin' Role to Service User for Service Tenant" do
auth_host identity_admin_endpoint["host"]
auth_port identity_admin_endpoint["port"]
@ -99,6 +104,7 @@ keystone_register "Grant 'admin' Role to Service User for Service Tenant" do
tenant_name node["nova"]["service_tenant_name"]
user_name node["nova"]["service_user"]
role_name node["nova"]["service_role"]
action :grant_role
end
@ -112,20 +118,22 @@ keystone_register "Register EC2 Service" do
service_name "ec2"
service_type "ec2"
service_description "EC2 Compatibility Layer"
action :create_service
end
template "/etc/nova/api-paste.ini" do
source "api-paste.ini.erb"
owner "root"
group "root"
mode "0644"
owner "root"
group "root"
mode 00644
variables(
"keystone_api_ipaddress" => identity_admin_endpoint["host"],
"service_port" => identity_endpoint["port"],
"admin_port" => identity_admin_endpoint["port"],
"admin_token" => keystone["admin_token"]
:keystone_api_ipaddress => identity_admin_endpoint["host"],
:service_port => identity_endpoint["port"],
:admin_port => identity_admin_endpoint["port"],
:admin_token => keystone["admin_token"]
)
notifies :restart, resources(:service => "nova-api-ec2"), :delayed
end
@ -141,5 +149,6 @@ keystone_register "Register Compute Endpoint" do
endpoint_adminurl ec2_admin_endpoint["uri"]
endpoint_internalurl ec2_public_endpoint["uri"]
endpoint_publicurl ec2_public_endpoint["uri"]
action :create_endpoint
end

View File

@ -28,7 +28,8 @@ platform_options = node["nova"]["platform"]
directory "/var/lock/nova" do
owner "nova"
group "nova"
mode "0755"
mode 00755
action :create
end
@ -38,33 +39,36 @@ end
platform_options["nova_api_metadata_packages"].each do |pkg|
package pkg do
action :upgrade
options platform_options["package_overrides"]
action :upgrade
end
end
service "nova-api-metadata" do
service_name platform_options["nova_api_metadata_service"]
supports :status => true, :restart => true
action :enable
subscribes :restart, resources(:template => "/etc/nova/nova.conf"), :delayed
action :enable
end
identity_admin_endpoint = endpoint('identity-admin')
identity_endpoint = endpoint('identity-api')
identity_admin_endpoint = endpoint "identity-admin"
identity_endpoint = endpoint "identity-api"
keystone_service_role = node["nova"]["keystone_service_chef_role"]
keystone = get_settings_by_role(keystone_service_role, "keystone")
keystone = get_settings_by_role keystone_service_role, "keystone"
template "/etc/nova/api-paste.ini" do
source "api-paste.ini.erb"
owner "root"
group "root"
mode "0644"
owner "root"
group "root"
mode 00644
variables(
"keystone_api_ipaddress" => identity_admin_endpoint["host"],
"service_port" => identity_endpoint["port"],
"admin_port" => identity_admin_endpoint["port"],
"admin_token" => keystone["admin_token"]
:keystone_api_ipaddress => identity_admin_endpoint["host"],
:service_port => identity_endpoint["port"],
:admin_port => identity_admin_endpoint["port"],
:admin_token => keystone["admin_token"]
)
notifies :restart, resources(:service => "nova-api-metadata"), :delayed
end

View File

@ -33,7 +33,8 @@ platform_options = node["nova"]["platform"]
directory "/var/lock/nova" do
owner "nova"
group "nova"
mode "0755"
mode 00755
action :create
end
@ -43,23 +44,26 @@ end
platform_options["api_os_compute_packages"].each do |pkg|
package pkg do
action :upgrade
options platform_options["package_overrides"]
action :upgrade
end
end
service "nova-api-os-compute" do
service_name platform_options["api_os_compute_service"]
supports :status => true, :restart => true
action :enable
subscribes :restart, resources(:template => "/etc/nova/nova.conf"), :delayed
action :enable
end
keystone_service_role = node["nova"]["keystone_service_chef_role"]
keystone = get_settings_by_role(keystone_service_role, "keystone")
identity_admin_endpoint = endpoint('identity-admin')
identity_endpoint = endpoint('identity-api')
nova_api_endpoint = endpoint('compute-api')
keystone = get_settings_by_role keystone_service_role, "keystone"
identity_admin_endpoint = endpoint "identity-admin"
identity_endpoint = endpoint "identity-api"
nova_api_endpoint = endpoint "compute-api"
# Register Service Tenant
keystone_register "Register Service Tenant" do
@ -71,6 +75,7 @@ keystone_register "Register Service Tenant" do
tenant_name node["nova"]["service_tenant_name"]
tenant_description "Service Tenant"
tenant_enabled "true" # Not required as this is the default
action :create_tenant
end
@ -85,6 +90,7 @@ keystone_register "Register Service User" do
user_name node["nova"]["service_user"]
user_pass node["nova"]["service_pass"]
user_enabled "true" # Not required as this is the default
action :create_user
end
@ -98,6 +104,7 @@ keystone_register "Grant 'admin' Role to Service User for Service Tenant" do
tenant_name node["nova"]["service_tenant_name"]
user_name node["nova"]["service_user"]
role_name node["nova"]["service_role"]
action :grant_role
end
@ -111,21 +118,23 @@ keystone_register "Register Compute Service" do
service_name "nova"
service_type "compute"
service_description "Nova Compute Service"
action :create_service
end
template "/etc/nova/api-paste.ini" do
source "api-paste.ini.erb"
owner "root"
group "root"
mode "0644"
owner "root"
group "root"
mode 00644
variables(
"custom_template_banner" => node["nova"]["custom_template_banner"],
"keystone_api_ipaddress" => identity_endpoint["host"],
"service_port" => identity_endpoint["port"],
"admin_port" => identity_admin_endpoint["port"],
"admin_token" => keystone["admin_token"]
:custom_template_banner => node["nova"]["custom_template_banner"],
:keystone_api_ipaddress => identity_endpoint["host"],
:service_port => identity_endpoint["port"],
:admin_port => identity_admin_endpoint["port"],
:admin_token => keystone["admin_token"]
)
notifies :restart, resources(:service => "nova-api-os-compute"), :delayed
end
@ -141,5 +150,6 @@ keystone_register "Register Compute Endpoint" do
endpoint_adminurl nova_api_endpoint["uri"]
endpoint_internalurl nova_api_endpoint["uri"]
endpoint_publicurl nova_api_endpoint["uri"]
action :create_endpoint
end

View File

@ -28,7 +28,8 @@ platform_options = node["nova"]["platform"]
directory "/var/lock/nova" do
owner "nova"
group "nova"
mode "0755"
mode 00755
action :create
end
@ -38,34 +39,37 @@ end
platform_options["api_os_volume_packages"].each do |pkg|
package pkg do
action :upgrade
options platform_options["package_overrides"]
action :upgrade
end
end
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
action :enable
end
identity_admin_endpoint = endpoint('identity-admin')
identity_endpoint = endpoint('identity-api')
identity_admin_endpoint = endpoint "identity-admin"
identity_endpoint = endpoint "identity-api"
keystone_service_role = node["nova"]["keystone_service_chef_role"]
keystone = get_settings_by_role(keystone_service_role, "keystone")
keystone = get_settings_by_role keystone_service_role, "keystone"
template "/etc/nova/api-paste.ini" do
source "api-paste.ini.erb"
owner "root"
group "root"
mode "0644"
owner "root"
group "root"
mode 00644
variables(
"custom_template_banner" => node["nova"]["custom_template_banner"],
"keystone_api_ipaddress" => identity_endpoint["host"],
"service_port" => identity_endpoint["port"],
"admin_port" => identity_admin_endpoint["port"],
"admin_token" => keystone["admin_token"]
:custom_template_banner => node["nova"]["custom_template_banner"],
:keystone_api_ipaddress => identity_endpoint["host"],
:service_port => identity_endpoint["port"],
:admin_port => identity_admin_endpoint["port"],
:admin_token => keystone["admin_token"]
)
notifies :restart, resources(:service => "nova-api-os-volume"), :delayed
end

View File

@ -38,22 +38,25 @@ end
nova_compute_packages.each do |pkg|
package pkg do
action :upgrade
options platform_options["package_overrides"]
action :upgrade
end
end
cookbook_file "/etc/nova/nova-compute.conf" do
source "nova-compute.conf"
mode "0644"
mode 00644
action :create
end
service "nova-compute" do
service_name platform_options["nova_compute_service"]
supports :status => true, :restart => true
action :enable
subscribes :restart, resources(:template => "/etc/nova/nova.conf"), :delayed
action :enable
end
include_recipe "nova::libvirt"

View File

@ -38,5 +38,6 @@ else
end
db_create_with_user("compute",
node["nova"]["db"]["username"],
node["nova"]["db"]["password"])
node["nova"]["db"]["username"],
node["nova"]["db"]["password"]
)

View File

@ -16,4 +16,3 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#

View File

@ -30,10 +30,11 @@ bash "create libvirtd group" do
cwd "/tmp"
user "root"
code <<-EOH
groupadd -f libvirtd
usermod -G libvirtd nova
groupadd -f libvirtd
usermod -G libvirtd nova
EOH
only_if { platform?(%w{fedora redhat centos}) }
only_if { platform? %w{fedora redhat centos} }
end
# oh redhat
@ -41,7 +42,8 @@ end
# ln -s /usr/libexec/qemu-kvm /usr/bin/qemu-system-x86_64
link "/usr/bin/qemu-system-x86_64" do
to "/usr/libexec/qemu-kvm"
only_if { platform?(%w{fedora redhat centos}) }
only_if { platform? %w{fedora redhat centos} }
end
service "dbus" do
@ -51,6 +53,7 @@ end
service "libvirt-bin" do
service_name platform_options["libvirt_service"]
supports :status => true, :restart => true
action [:enable, :start]
end
@ -61,39 +64,42 @@ end
execute "Deleting default libvirt network" do
command "virsh net-destroy default"
only_if "virsh net-list | grep -q default"
end
#
# TODO(breu): this section needs to be rewritten to support key privisioning
#
template "/etc/libvirt/libvirtd.conf" do
source "libvirtd.conf.erb"
owner "root"
group "root"
mode "0644"
owner "root"
group "root"
mode 00644
variables(
"custom_template_banner" => node["nova"]["custom_template_banner"],
"auth_tcp" => node["nova"]["libvirt"]["auth_tcp"]
:custom_template_banner => node["nova"]["custom_template_banner"],
:auth_tcp => node["nova"]["libvirt"]["auth_tcp"]
)
notifies :restart, resources(:service => "libvirt-bin"), :immediately
end
template "/etc/default/libvirt-bin" do
source "libvirt-bin.erb"
owner "root"
group "root"
mode "0644"
owner "root"
group "root"
mode 00644
notifies :restart, resources(:service => "libvirt-bin"), :immediately
only_if { platform?(%w{ubuntu debian}) }
only_if { platform? %w{ubuntu debian} }
end
template "/etc/sysconfig/libvirtd" do
source "libvirtd.erb"
owner "root"
group "root"
mode "0644"
notifies :restart, resources(:service => "libvirt-bin"), :immediately
only_if { platform?(%w{fedora redhat centos}) }
end
owner "root"
group "root"
mode 00644
notifies :restart, resources(:service => "libvirt-bin"), :immediately
only_if { platform? %w{fedora redhat centos} }
end

View File

@ -23,14 +23,16 @@ platform_options = node["nova"]["platform"]
platform_options["nova_network_packages"].each do |pkg|
package pkg do
action :upgrade
options platform_options["package_overrides"]
action :upgrade
end
end
service "nova-network" do
service_name platform_options["nova_network_service"]
supports :status => true, :restart => true
action :enable
subscribes :restart, resources(:template => "/etc/nova/nova.conf"), :delayed
action :enable
end

View File

@ -22,14 +22,16 @@ platform_options=node["nova"]["platform"]
platform_options["nova_cert_packages"].each do |pkg|
package pkg do
action :upgrade
options platform_options["package_overrides"]
action :upgrade
end
end
service "nova-cert" do
service_name platform_options["nova_cert_service"]
supports :status => true, :restart => true
action :enable
subscribes :restart, resources(:template => "/etc/nova/nova.conf"), :delayed
action :enable
end

View File

@ -29,30 +29,31 @@ platform_options = node["nova"]["platform"]
platform_options["common_packages"].each do |pkg|
package pkg do
action :upgrade
options platform_options["package_overrides"]
action :upgrade
end
end
directory "/etc/nova" do
action :create
owner "nova"
group "nova"
mode "0755"
mode 00755
action :create
end
rabbit_server_role = node["nova"]["rabbit_server_chef_role"]
rabbit_info = get_settings_by_role(rabbit_server_role, "queue")
rabbit_info = get_settings_by_role rabbit_server_role, "queue"
# Still need this but only to get the nova db password...
# TODO(jaypipes): Refactor password generation/lookup into
# openstack-common.
nova_setup_role = node["nova"]["nova_setup_chef_role"]
nova_setup_info = get_settings_by_role(nova_setup_role, "nova")
nova_setup_info = get_settings_by_role nova_setup_role, "nova"
db_user = node['nova']['db']['username']
db_pass = nova_setup_info['db']['password']
sql_connection = db_uri("compute", db_user, db_pass)
keystone_service_role = node["nova"]["keystone_service_chef_role"]
keystone = get_settings_by_role(keystone_service_role, "keystone")
@ -79,76 +80,76 @@ Chef::Log.debug("nova::nova-common:image_endpoint|#{image_endpoint}")
# TODO: need to re-evaluate this for accuracy
template "/etc/nova/nova.conf" do
source "nova.conf.erb"
owner "root"
group "root"
mode "0644"
owner "root"
group "root"
mode 00644
variables(
"custom_template_banner" => node["nova"]["custom_template_banner"],
"use_syslog" => node["nova"]["syslog"]["use"],
"log_facility" => node["nova"]["syslog"]["facility"],
"sql_connection" => sql_connection,
"vncserver_listen" => "0.0.0.0",
"vncserver_proxyclient_address" => novnc_proxy_endpoint["host"],
"novncproxy_base_url" => novnc_endpoint["uri"],
"xvpvncproxy_bind_host" => xvpvnc_endpoint["host"],
"xvpvncproxy_bind_port" => xvpvnc_endpoint["port"],
"xvpvncproxy_base_url" => xvpvnc_endpoint["uri"],
"rabbit_ipaddress" => rabbit_info["host"],
"rabbit_port" => rabbit_info["port"],
"keystone_api_ipaddress" => identity_endpoint["host"],
"keystone_service_port" => identity_endpoint["port"],
:custom_template_banner => node["nova"]["custom_template_banner"],
:use_syslog => node["nova"]["syslog"]["use"],
:log_facility => node["nova"]["syslog"]["facility"],
:sql_connection => db_uri("compute", db_user, db_pass),
:vncserver_listen => "0.0.0.0",
:vncserver_proxyclient_address => novnc_proxy_endpoint["host"],
:novncproxy_base_url => novnc_endpoint["uri"],
:xvpvncproxy_bind_host => xvpvnc_endpoint["host"],
:xvpvncproxy_bind_port => xvpvnc_endpoint["port"],
:xvpvncproxy_base_url => xvpvnc_endpoint["uri"],
:rabbit_ipaddress => rabbit_info["host"],
:rabbit_port => rabbit_info["port"],
:keystone_api_ipaddress => identity_endpoint["host"],
:keystone_service_port => identity_endpoint["port"],
# TODO(jaypipes): No support here for >1 image API servers
# with the glance_api_servers configuration option...
"glance_api_ipaddress" => image_endpoint["host"],
"glance_api_port" => image_endpoint["port"],
"iscsi_helper" => platform_options["iscsi_helper"],
"public_interface" => node["nova"]["network"]["public_interface"],
"vlan_interface" => node["nova"]["network"]["vlan_interface"],
"network_manager" => node["nova"]["network"]["network_manager"],
"scheduler_driver" => node["nova"]["scheduler"]["scheduler_driver"],
"scheduler_default_filters" => node["nova"]["scheduler"]["default_filters"].join(","),
"availability_zone" => node["nova"]["config"]["availability_zone"],
"default_schedule_zone" => node["nova"]["config"]["default_schedule_zone"],
"virt_type" => node["nova"]["libvirt"]["virt_type"],
"remove_unused_base_images" => node["nova"]["libvirt"]["remove_unused_base_images"],
"remove_unused_resized_minimum_age_seconds" => node["nova"]["libvirt"]["remove_unused_resized_minimum_age_seconds"],
"remove_unused_original_minimum_age_seconds" => node["nova"]["libvirt"]["remove_unused_original_minimum_age_seconds"],
"checksum_base_images" => node["nova"]["libvirt"]["checksum_base_images"],
"fixed_range" => node["nova"]["network"]["fixed_range"],
"force_raw_images" => node["nova"]["config"]["force_raw_images"],
"dmz_cidr" => node["nova"]["network"]["dmz_cidr"],
"allow_same_net_traffic" => node["nova"]["config"]["allow_same_net_traffic"],
"osapi_max_limit" => node["nova"]["config"]["osapi_max_limit"],
"cpu_allocation_ratio" => node["nova"]["config"]["cpu_allocation_ratio"],
"ram_allocation_ratio" => node["nova"]["config"]["ram_allocation_ratio"],
"snapshot_image_format" => node["nova"]["config"]["snapshot_image_format"],
"start_guests_on_host_boot" => node["nova"]["config"]["start_guests_on_host_boot"],
"resume_guests_state_on_host_boot" => node["nova"]["config"]["resume_guests_state_on_host_boot"],
"quota_security_groups" => node["nova"]["config"]["quota_security_groups"],
"quota_security_group_rules" => node["nova"]["config"]["quota_security_group_rules"]
:glance_api_ipaddress => image_endpoint["host"],
:glance_api_port => image_endpoint["port"],
:iscsi_helper => platform_options["iscsi_helper"],
:public_interface => node["nova"]["network"]["public_interface"],
:vlan_interface => node["nova"]["network"]["vlan_interface"],
:network_manager => node["nova"]["network"]["network_manager"],
:scheduler_driver => node["nova"]["scheduler"]["scheduler_driver"],
:scheduler_default_filters => node["nova"]["scheduler"]["default_filters"].join(","),
:availability_zone => node["nova"]["config"]["availability_zone"],
:default_schedule_zone => node["nova"]["config"]["default_schedule_zone"],
:virt_type => node["nova"]["libvirt"]["virt_type"],
:remove_unused_base_images => node["nova"]["libvirt"]["remove_unused_base_images"],
:remove_unused_resized_minimum_age_seconds => node["nova"]["libvirt"]["remove_unused_resized_minimum_age_seconds"],
:remove_unused_original_minimum_age_seconds => node["nova"]["libvirt"]["remove_unused_original_minimum_age_seconds"],
:checksum_base_images => node["nova"]["libvirt"]["checksum_base_images"],
:fixed_range => node["nova"]["network"]["fixed_range"],
:force_raw_images => node["nova"]["config"]["force_raw_images"],
:dmz_cidr => node["nova"]["network"]["dmz_cidr"],
:allow_same_net_traffic => node["nova"]["config"]["allow_same_net_traffic"],
:osapi_max_limit => node["nova"]["config"]["osapi_max_limit"],
:cpu_allocation_ratio => node["nova"]["config"]["cpu_allocation_ratio"],
:ram_allocation_ratio => node["nova"]["config"]["ram_allocation_ratio"],
:snapshot_image_format => node["nova"]["config"]["snapshot_image_format"],
:start_guests_on_host_boot => node["nova"]["config"]["start_guests_on_host_boot"],
:resume_guests_state_on_host_boot => node["nova"]["config"]["resume_guests_state_on_host_boot"],
:quota_security_groups => node["nova"]["config"]["quota_security_groups"],
:quota_security_group_rules => node["nova"]["config"]["quota_security_group_rules"]
)
end
# TODO: need to re-evaluate this for accuracy
template "/root/openrc" do
source "openrc.erb"
owner "root"
group "root"
mode "0600"
owner "root"
group "root"
mode 00600
variables(
"custom_template_banner" => node["nova"]["custom_template_banner"],
"user" => keystone["admin_user"],
"tenant" => keystone["users"][keystone["admin_user"]]["default_tenant"],
"password" => keystone["users"][keystone["admin_user"]]["password"],
"keystone_api_ipaddress" => identity_endpoint["host"],
"keystone_service_port" => identity_endpoint["port"],
"nova_api_ipaddress" => nova_api_endpoint["host"],
"nova_api_version" => "1.1",
"keystone_region" => node["nova"]["compute"]["region"],
"auth_strategy" => "keystone",
"ec2_url" => ec2_public_endpoint["uri"],
"ec2_access_key" => node["credentials"]["EC2"]["admin"]["access"],
"ec2_secret_key" => node["credentials"]["EC2"]["admin"]["secret"]
:custom_template_banner => node["nova"]["custom_template_banner"],
:user => keystone["admin_user"],
:tenant => keystone["users"][keystone["admin_user"]]["default_tenant"],
:password => keystone["users"][keystone["admin_user"]]["password"],
:keystone_api_ipaddress => identity_endpoint["host"],
:keystone_service_port => identity_endpoint["port"],
:nova_api_ipaddress => nova_api_endpoint["host"],
:nova_api_version => "1.1",
:keystone_region => node["nova"]["compute"]["region"],
:auth_strategy => "keystone",
:ec2_url => ec2_public_endpoint["uri"],
:ec2_access_key => node["credentials"]["EC2"]["admin"]["access"],
:ec2_secret_key => node["credentials"]["EC2"]["admin"]["secret"]
)
end

View File

@ -31,53 +31,56 @@ keystone_admin_tenant = keystone["users"][keystone_admin_user]["default_tenant"]
execute "nova-manage db sync" do
command "nova-manage db sync"
action :run
not_if "nova-manage db version && test $(nova-manage db version) -gt 0"
action :run
end
node["nova"]["networks"].each do |net|
execute "nova-manage network create --label=#{net['label']}" do
# The only two required keys in each network Hash
# are "label" and "ipv4_cidr".
cmd = "nova-manage network create --label=#{net['label']} --fixed_range_v4=#{net['ipv4_cidr']}"
if net.has_key?("multi_host")
cmd += " --multi_host='#{net['multi_host']}'"
end
if net.has_key?("num_networks")
cmd += " --num_networks=#{net['num_networks']}"
end
if net.has_key?("network_size")
cmd += " --network_size=#{net['network_size']}"
end
if net.has_key?("bridge")
cmd += " --bridge=#{net['bridge']}"
end
# Older attributes have the key as "bridge_dev" instead
# of "bridge_interface"...
if net.has_key?("bridge_interface") or net.has_key?("bridge_dev")
val = net.has_key?("bridge_interface") ? net["bridge_interface"] : net["bridge_dev"]
cmd += " --bridge_interface=#{val}"
end
if net.has_key?("dns1")
cmd += " --dns1=#{net['dns1']}"
end
if net.has_key?("dns2")
cmd += " --dns2=#{net['dns2']}"
end
if net.has_key?("vlan")
cmd += " --vlan=#{net['vlan']}"
end
command cmd
action :run
not_if "nova-manage network list | grep #{net['ipv4_cidr']}"
execute "nova-manage network create --label=#{net['label']}" do
# The only two required keys in each network Hash
# are "label" and "ipv4_cidr".
cmd = "nova-manage network create --label=#{net['label']} --fixed_range_v4=#{net['ipv4_cidr']}"
if net.has_key?("multi_host")
cmd += " --multi_host='#{net['multi_host']}'"
end
if net.has_key?("num_networks")
cmd += " --num_networks=#{net['num_networks']}"
end
if net.has_key?("network_size")
cmd += " --network_size=#{net['network_size']}"
end
if net.has_key?("bridge")
cmd += " --bridge=#{net['bridge']}"
end
# Older attributes have the key as "bridge_dev" instead
# of "bridge_interface"...
if net.has_key?("bridge_interface") or net.has_key?("bridge_dev")
val = net.has_key?("bridge_interface") ? net["bridge_interface"] : net["bridge_dev"]
cmd += " --bridge_interface=#{val}"
end
if net.has_key?("dns1")
cmd += " --dns1=#{net['dns1']}"
end
if net.has_key?("dns2")
cmd += " --dns2=#{net['dns2']}"
end
if net.has_key?("vlan")
cmd += " --vlan=#{net['vlan']}"
end
command cmd
not_if "nova-manage network list | grep #{net['ipv4_cidr']}"
action :run
end
end
if node.has_key?(:floating) and node["nova"]["network"]["floating"].has_key?(:ipv4_cidr)
execute "nova-manage floating create" do
command "nova-manage floating create --ip_range=#{node["nova"]["network"]["floating"]["ipv4_cidr"]}"
action :run
not_if "nova-manage floating list"
action :run
end
end

View File

@ -24,20 +24,23 @@ platform_options = node["nova"]["platform"]
directory "/var/lock/nova" do
owner "nova"
group "nova"
mode "0755"
mode 00755
action :create
end
platform_options["nova_scheduler_packages"].each do |pkg|
package pkg do
action :upgrade
options platform_options["package_overrides"]
action :upgrade
end
end
service "nova-scheduler" do
service_name platform_options["nova_scheduler_service"]
supports :status => true, :restart => true
action [:enable, :start]
subscribes :restart, resources(:template => "/etc/nova/nova.conf"), :delayed
action [:enable, :start]
end

View File

@ -23,8 +23,9 @@ platform_options = node["nova"]["platform"]
platform_options["nova_vncproxy_packages"].each do |pkg|
package pkg do
action :upgrade
options platform_options["package_overrides"]
action :upgrade
end
end
@ -38,13 +39,15 @@ end
service "nova-vncproxy" do
service_name platform_options["nova_vncproxy_service"]
supports :status => true, :restart => true
action :enable
subscribes :restart, resources(:template => "/etc/nova/nova.conf"), :delayed
action :enable
end
service "nova-consoleauth" do
service_name platform_options["nova_vncproxy_consoleauth_service"]
supports :status => true, :restart => true
action :enable
subscribes :restart, resources(:template => "/etc/nova/nova.conf"), :delayed
action :enable
end

View File

@ -32,16 +32,18 @@ end
platform_options["nova_volume_packages"].each do |pkg|
package pkg do
action :upgrade
options platform_options["package_overrides"]
action :upgrade
end
end
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
action :disable
end
# TODO(rp): need the flag on whether or not to start nova-volume service
@ -54,11 +56,12 @@ end
# stop_cmd "/usr/sbin/service #{service_name} stop"
# end
identity_admin_endpoint = endpoint('identity-admin')
identity_endpoint = endpoint('identity-api')
identity_admin_endpoint = endpoint "identity-admin"
identity_endpoint = endpoint "identity-api"
keystone_service_role = node["nova"]["keystone_service_chef_role"]
keystone = get_settings_by_role(keystone_service_role, "keystone")
volume_endpoint = endpoint('compute-volume')
keystone = get_settings_by_role keystone_service_role, "keystone"
volume_endpoint = endpoint "compute-volume"
# Register Volume Service
keystone_register "Register Volume Service" do
@ -70,6 +73,7 @@ keystone_register "Register Volume Service" do
service_name "Volume Service"
service_type "volume"
service_description "Nova Volume Service"
action :create_service
end
@ -85,5 +89,6 @@ keystone_register "Register Volume Endpoint" do
endpoint_adminurl volume_endpoint["uri"]
endpoint_internalurl volume_endpoint["uri"]
endpoint_publicurl volume_endpoint["uri"]
action :create_endpoint
end