From 2616d09bcc4b355dd031d6827899cb46f406e8b5 Mon Sep 17 00:00:00 2001 From: Darren Birkett Date: Thu, 26 Apr 2012 13:06:47 +0100 Subject: [PATCH] bring nova attrs into nova namespace - edited attributes - updated readme - updated relevant recipes to use new attrs - updated cookbook version - updated libvirt template --- README.md | 46 +++++++++++++-------------- attributes/default.rb | 49 ++++++++++++++--------------- metadata.rb | 2 +- recipes/api-os-volume.rb | 4 +-- recipes/compute.rb | 4 +-- recipes/libvirt.rb | 8 ++--- recipes/nova-common.rb | 2 +- recipes/nova-setup.rb | 12 +++---- recipes/volume.rb | 12 +++---- templates/default/libvirtd.conf.erb | 2 +- 10 files changed, 69 insertions(+), 72 deletions(-) diff --git a/README.md b/README.md index 8bdb1396..d2edb2ea 100644 --- a/README.md +++ b/README.md @@ -120,33 +120,33 @@ Attributes * `nova["ec2"]["internalURL"]` - defines the url used to access the AWS EC2 compatible API for user functions from an internal network * `nova["ec2"]["publicURL"]` - defines the url used to access the AWS EC2 compatible API for user functions from an external network -* `volume["api_port"]` - port on which nova volumes api runs -* `volume["ipaddress"]` - ip address where nova volumes api runs -* `volume["adminURL"]` - the url used to access the nova volumes API for admin functions -* `volume["internalURL"]` - the url used to access the nova volumes API for user functions from an internal network -* `volume["publicURL"]` - the url used to access the nova volumes API for user functions from an external network +* `nova["volume"]["api_port"]` - port on which nova volumes api runs +* `nova["volume"]["ipaddress"]` - ip address where nova volumes api runs +* `nova["volume"]["adminURL"]` - the url used to access the nova volumes API for admin functions +* `nova["volume"]["internalURL"]` - the url used to access the nova volumes API for user functions from an internal network +* `nova["volume"]["publicURL"]` - the url used to access the nova volumes API for user functions from an external network -* `public["label"]` - network label to be assigned to the public network on creation -* `public["ipv4_cidr"]` - network to be created (in cidr notation eg 192.168.100.0/24) -* `public["num_networks"]` - number of networks to be created -* `public["network_size"]` - number of IP addresses to be used in this network -* `public["bridge"]` - bridge to be created for accessing the vm network (eg br100) -* `public["bridge_dev"]` - physical device on which the bridge device should be attached (eg eth2) -* `public["dns1"]` - dns server 1 -* `public["dns2"]` - dns server 2 +* `nova["network"]["public"]["label"]` - network label to be assigned to the public network on creation +* `nova["network"]["public"]["ipv4_cidr"]` - network to be created (in cidr notation eg 192.168.100.0/24) +* `nova["network"]["public"]["num_networks"]` - number of networks to be created +* `nova["network"]["public"]["network_size"]` - number of IP addresses to be used in this network +* `nova["network"]["public"]["bridge"]` - bridge to be created for accessing the vm network (eg br100) +* `nova["network"]["public"]["bridge_dev"]` - physical device on which the bridge device should be attached (eg eth2) +* `nova["network"]["public"]["dns1"]` - dns server 1 +* `nova["network"]["public"]["dns2"]` - dns server 2 -* `private["label"]` - network label to be assigned to the private network on creation -* `private["ipv4_cidr"]` - network to be created (in cidr notation eg 192.168.200.0/24) -* `private["num_networks"]` - number of networks to be created -* `private["network_size"]` - number of IP addresses to be used in this network -* `private["bridge"]` - bridge to be created for accessing the vm network (eg br200) -* `private["bridge_dev"]` - physical device on which the bridge device should be attached (eg eth3) +* `nova["network"]["private"]["label"]` - network label to be assigned to the private network on creation +* `nova["network"]["private"]["ipv4_cidr"]` - network to be created (in cidr notation eg 192.168.200.0/24) +* `nova["network"]["private"]["num_networks"]` - number of networks to be created +* `nova["network"]["private"]["network_size"]` - number of IP addresses to be used in this network +* `nova["network"]["private"]["bridge"]` - bridge to be created for accessing the vm network (eg br200) +* `nova["network"]["private"]["bridge_dev"]` - physical device on which the bridge device should be attached (eg eth3) -* `virt_type` - what hypervisor software layer to use with libvirt (eg kvm, qemu) +* `nova["libvirt"]["virt_type"]` - what hypervisor software layer to use with libvirt (eg kvm, qemu) -* `libvirt["auth_tcp"]` - the type of authentication your libvirt layer requires -* `libvirt["ssh"]["private_key"]` - private key to use if using ssh authentication to your libvirt layer -* `libvirt["ssh"]["public_key"]` - public key to use if using ssh authentication to your libvirt layer +* `nova["libvirt"]["auth_tcp"]` - the type of authentication your libvirt layer requires +* `nova["libvirt"]["ssh"]["private_key"]` - private key to use if using ssh authentication to your libvirt layer +* `nova["libvirt"]["ssh"]["public_key"]` - public key to use if using ssh authentication to your libvirt layer Templates ===== diff --git a/attributes/default.rb b/attributes/default.rb index cb095596..3b01373d 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -14,38 +14,35 @@ default["nova"]["ec2"]["adminURL"] = "" default["nova"]["ec2"]["internalURL"] = "" default["nova"]["ec2"]["publicURL"] = "" -# TODO: This needs to be moved into the nova namespace -default["volume"]["api_port"] = 8776 -default["volume"]["ipaddress"] = node["controller_ipaddress"] -default["volume"]["adminURL"] = "http://#{default["controller_ipaddress"]}:#{default["volume"]["api_port"]}/v1" -default["volume"]["internalURL"] = default["volume"]["adminURL"] -default["volume"]["publicURL"] = default["volume"]["adminURL"] +default["nova"]["volume"]["api_port"] = 8776 +default["nova"]["volume"]["ipaddress"] = node["controller_ipaddress"] +default["nova"]["volume"]["adminURL"] = "http://#{default["controller_ipaddress"]}:#{default["nova"]["volume"]["api_port"]}/v1" +default["nova"]["volume"]["internalURL"] = default["nova"]["volume"]["adminURL"] +default["nova"]["volume"]["publicURL"] = default["nova"]["volume"]["adminURL"] # TODO: This needs to be moved into the nova namespace -default["public"]["label"] = "public" -default["public"]["ipv4_cidr"] = "192.168.100.0/24" -default["public"]["num_networks"] = "1" -default["public"]["network_size"] = "255" -default["public"]["bridge"] = "br100" -default["public"]["bridge_dev"] = "eth2" -default["public"]["dns1"] = "8.8.8.8" -default["public"]["dns2"] = "8.8.4.4" +default["nova"]["network"]["public"]["label"] = "public" +default["nova"]["network"]["public"]["ipv4_cidr"] = "192.168.100.0/24" +default["nova"]["network"]["public"]["num_networks"] = "1" +default["nova"]["network"]["public"]["network_size"] = "255" +default["nova"]["network"]["public"]["bridge"] = "br100" +default["nova"]["network"]["public"]["bridge_dev"] = "eth2" +default["nova"]["network"]["public"]["dns1"] = "8.8.8.8" +default["nova"]["network"]["public"]["dns2"] = "8.8.4.4" # TODO: This needs to be moved into the nova namespace -default["private"]["label"] = "private" -default["private"]["ipv4_cidr"] = "192.168.200.0/24" -default["private"]["num_networks"] = "1" -default["private"]["network_size"] = "255" -default["private"]["bridge"] = "br200" -default["private"]["bridge_dev"] = "eth3" +default["nova"]["network"]["private"]["label"] = "private" +default["nova"]["network"]["private"]["ipv4_cidr"] = "192.168.200.0/24" +default["nova"]["network"]["private"]["num_networks"] = "1" +default["nova"]["network"]["private"]["network_size"] = "255" +default["nova"]["network"]["private"]["bridge"] = "br200" +default["nova"]["network"]["private"]["bridge_dev"] = "eth3" default["controller_ipaddress"] = node["ipaddress"] -# TODO: This needs to be moved into the nova namespace -default["virt_type"] = "kvm" - -default["libvirt"]["auth_tcp"] = "none" -default["libvirt"]["ssh"]["private_key"] = "-----BEGIN DSA PRIVATE KEY----- +default["nova"]["libvirt"]["virt_type"] = "kvm" +default["nova"]["libvirt"]["auth_tcp"] = "none" +default["nova"]["libvirt"]["ssh"]["private_key"] = "-----BEGIN DSA PRIVATE KEY----- MIIBvAIBAAKBgQDUIz3rg0afavOwNeTJL/112U/l4B08kzZVx+QcflxllpW4sn/f c+j+BeQ/sm2oW67vY9O/1GbN3FIN7Um3p0F9ycpfXpEiwk4UYneJtXFNhlu9rSrK hWsEWENoKrCFhZ4Zuu8ads0DCMkU/ErumXMvJZQpSe+8CfguYSMbXvkYhQIVAPzY @@ -57,4 +54,4 @@ CYiYhwoK8RM+z0TNXjBIWXpHwAqX5kFhg/xPySxWS58GePmPOXDbFEYq5FRWTx47 sQqRmVHmlZZ9AhsRfs65g4LlgJyBlWPeZ0xsfShYHKLKg5RrOGn90egCFQCcok5v 1TpUNWQC3NPFkwWHkp1zrg== -----END DSA PRIVATE KEY-----" -default["libvirt"]["ssh"]["public_key"] = "ssh-dss AAAAB3NzaC1kc3MAAACBANQjPeuDRp9q87A15Mkv/XXZT+XgHTyTNlXH5Bx+XGWWlbiyf99z6P4F5D+ybahbru9j07/UZs3cUg3tSbenQX3Jyl9ekSLCThRid4m1cU2GW72tKsqFawRYQ2gqsIWFnhm67xp2zQMIyRT8Su6Zcy8llClJ77wJ+C5hIxte+RiFAAAAFQD82LMjyqjmt7HLIS6sD7pWReuJ2QAAAIAFjrS6pwVInxqA9jZhmYtOxD86tVtSyfBP5ER5eOpqh9S92UrjeRYbDwjW/0GuH7faYVxi7YvSLO/dm8f3B3Y4SJmcfG1kSiMAsF0owVFsLw8sLYibPfK83ASj5mSBKjkvM/2dJzI78kONvI4kA8SwK0pHGa2HhcFy5jmU8C1OUQAAAIEAtFtXDovPhgvLGhFrRZjBzp3HREWW1tihsWZA4qIFib+Rd+/s3lWGCYiYhwoK8RM+z0TNXjBIWXpHwAqX5kFhg/xPySxWS58GePmPOXDbFEYq5FRWTx47sQqRmVHmlZZ9AhsRfs65g4LlgJyBlWPeZ0xsfShYHKLKg5RrOGn90eg= root@example.com" +default["nova"]["libvirt"]["ssh"]["public_key"] = "ssh-dss AAAAB3NzaC1kc3MAAACBANQjPeuDRp9q87A15Mkv/XXZT+XgHTyTNlXH5Bx+XGWWlbiyf99z6P4F5D+ybahbru9j07/UZs3cUg3tSbenQX3Jyl9ekSLCThRid4m1cU2GW72tKsqFawRYQ2gqsIWFnhm67xp2zQMIyRT8Su6Zcy8llClJ77wJ+C5hIxte+RiFAAAAFQD82LMjyqjmt7HLIS6sD7pWReuJ2QAAAIAFjrS6pwVInxqA9jZhmYtOxD86tVtSyfBP5ER5eOpqh9S92UrjeRYbDwjW/0GuH7faYVxi7YvSLO/dm8f3B3Y4SJmcfG1kSiMAsF0owVFsLw8sLYibPfK83ASj5mSBKjkvM/2dJzI78kONvI4kA8SwK0pHGa2HhcFy5jmU8C1OUQAAAIEAtFtXDovPhgvLGhFrRZjBzp3HREWW1tihsWZA4qIFib+Rd+/s3lWGCYiYhwoK8RM+z0TNXjBIWXpHwAqX5kFhg/xPySxWS58GePmPOXDbFEYq5FRWTx47sQqRmVHmlZZ9AhsRfs65g4LlgJyBlWPeZ0xsfShYHKLKg5RrOGn90eg= root@example.com" diff --git a/metadata.rb b/metadata.rb index 7a27103f..764e2708 100644 --- a/metadata.rb +++ b/metadata.rb @@ -2,7 +2,7 @@ maintainer "Rackspace Hosting, Inc." license "Apache 2.0" description "Installs and configures Openstack" long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version "1.0.1" +version "1.0.3" # recipe "mysql", "Includes the client recipe to configure a client" # recipe "mysql::client", "Installs packages required for mysql clients using run_action magic" diff --git a/recipes/api-os-volume.rb b/recipes/api-os-volume.rb index 015f7396..7e3de066 100644 --- a/recipes/api-os-volume.rb +++ b/recipes/api-os-volume.rb @@ -60,13 +60,13 @@ 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("api-os-volume/keystone: using search") + 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("api-os-volume/keystone: NOT using search") + 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'] diff --git a/recipes/compute.rb b/recipes/compute.rb index 44f4427c..96dd573e 100644 --- a/recipes/compute.rb +++ b/recipes/compute.rb @@ -36,9 +36,9 @@ else nova_compute_package = "nova-compute" nova_compute_service = nova_compute_package nova_compute_package_options = "-o Dpkg::Options::='--force-confold' --force-yes" - if node["virt_type"] == "kvm" + if node["nova"]["libvirt"]["virt_type"] == "kvm" nova_compute_package = "nova-compute-kvm" - elsif node["virt_type"] == "qemu" + elsif node["nova"]["libvirt"]["virt_type"] == "qemu" nova_compute_package = "nova-compute-qemu" end end diff --git a/recipes/libvirt.rb b/recipes/libvirt.rb index 164f6307..2a2fc30f 100644 --- a/recipes/libvirt.rb +++ b/recipes/libvirt.rb @@ -51,7 +51,7 @@ template "/var/lib/nova/.ssh/id_dsa.pub" do group "nova" mode "0644" variables( - :public_key => node['libvirt']['ssh']['public_key'] + :public_key => node["nova"]["libvirt"]["ssh"]["public_key"] ) end @@ -62,7 +62,7 @@ template "/var/lib/nova/.ssh/id_dsa" do group "nova" mode "0600" variables( - :private_key => node['libvirt']['ssh']['private_key'] + :private_key => node["nova"]["libvirt"]["ssh"]["private_key"] ) end @@ -81,7 +81,7 @@ template "/var/lib/nova/.ssh/authorized_keys" do group "nova" mode "0600" variables( - :public_key => node['libvirt']['ssh']['public_key'] + :public_key => node["nova"]["libvirt"]["ssh"]["public_key"] ) end @@ -94,7 +94,7 @@ template "/etc/libvirt/libvirtd.conf" do group "root" mode "0644" variables( - :auth_tcp => node['libvirt']['auth_tcp'] + :auth_tcp => node["nova"]["libvirt"]["auth_tcp"] ) notifies :restart, resources(:service => libvirt_service), :immediately end diff --git a/recipes/nova-common.rb b/recipes/nova-common.rb index e98be0d1..58050d35 100644 --- a/recipes/nova-common.rb +++ b/recipes/nova-common.rb @@ -108,7 +108,7 @@ template "/etc/nova/nova.conf" do :keystone_api_ipaddress => keystone_api_ip, :glance_api_ipaddress => glance_api_ip, :api_port => glance_api_port, - :ipv4_cidr => node["public"]["ipv4_cidr"], + :ipv4_cidr => node["nova"]["network"]["public"]["ipv4_cidr"], :virt_type => node["virt_type"] ) end diff --git a/recipes/nova-setup.rb b/recipes/nova-setup.rb index b6d17acb..b156dba1 100644 --- a/recipes/nova-setup.rb +++ b/recipes/nova-setup.rb @@ -65,21 +65,21 @@ execute "nova-manage db sync" do end execute "nova-manage network create --label=public" do - command "nova-manage network create --multi_host='T' --label=#{node["public"]["label"]} --fixed_range_v4=#{node["public"]["ipv4_cidr"]} --num_networks=#{node["public"]["num_networks"]} --network_size=#{node["public"]["network_size"]} --bridge=#{node["public"]["bridge"]} --bridge_interface=#{node["public"]["bridge_dev"]} --dns1=#{node["public"]["dns1"]} --dns2=#{node["public"]["dns2"]}" + command "nova-manage network create --multi_host='T' --label=#{node["nova"]["network"]["public"]["label"]} --fixed_range_v4=#{node["nova"]["network"]["public"]["ipv4_cidr"]} --num_networks=#{node["nova"]["network"]["public"]["num_networks"]} --network_size=#{node["nova"]["network"]["public"]["network_size"]} --bridge=#{node["nova"]["network"]["public"]["bridge"]} --bridge_interface=#{node["nova"]["network"]["public"]["bridge_dev"]} --dns1=#{node["nova"]["network"]["public"]["dns1"]} --dns2=#{node["nova"]["network"]["public"]["dns2"]}" action :run - not_if "nova-manage network list | grep #{node["public"]["ipv4_cidr"]}" + not_if "nova-manage network list | grep #{node["nova"]["network"]["public"]["ipv4_cidr"]}" end execute "nova-manage network create --label=private" do - command "nova-manage network create --multi_host='T' --label=#{node["private"]["label"]} --fixed_range_v4=#{node["private"]["ipv4_cidr"]} --num_networks=#{node["private"]["num_networks"]} --network_size=#{node["private"]["network_size"]} --bridge=#{node["private"]["bridge"]} --bridge_interface=#{node["private"]["bridge_dev"]}" + command "nova-manage network create --multi_host='T' --label=#{node["nova"]["network"]["private"]["label"]} --fixed_range_v4=#{node["nova"]["network"]["private"]["ipv4_cidr"]} --num_networks=#{node["nova"]["network"]["private"]["num_networks"]} --network_size=#{node["nova"]["network"]["private"]["network_size"]} --bridge=#{node["nova"]["network"]["private"]["bridge"]} --bridge_interface=#{node["nova"]["network"]["private"]["bridge_dev"]}" action :run - not_if "nova-manage network list | grep #{node["private"]["ipv4_cidr"]}" + not_if "nova-manage network list | grep #{node["nova"]["network"]["private"]["ipv4_cidr"]}" end -if node.has_key?(:floating) and node["floating"].has_key?(:ipv4_cidr) +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["floating"]["ipv4_cidr"]}" + command "nova-manage floating create --ip_range=#{node["nova"]["network"]["floating"]["ipv4_cidr"]}" action :run not_if "nova-manage floating list" end diff --git a/recipes/volume.rb b/recipes/volume.rb index 84571605..ecbb60d9 100644 --- a/recipes/volume.rb +++ b/recipes/volume.rb @@ -65,9 +65,9 @@ keystone_register "Register Volume Service" do action :create_service end -node["volume"]["adminURL"] = "http://#{node["volume"]["ipaddress"]}:#{node["volume"]["api_port"]}/v1/%(tenant_id)s" -node["volume"]["internalURL"] = node["volume"]["adminURL"] -node["volume"]["publicURL"] = node["volume"]["adminURL"] +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 @@ -78,8 +78,8 @@ keystone_register "Register Volume Endpoint" do auth_token keystone_admin_token service_type "volume" endpoint_region "RegionOne" - endpoint_adminurl node["volume"]["adminURL"] - endpoint_internalurl node["volume"]["internalURL"] - endpoint_publicurl node["volume"]["publicURL"] + endpoint_adminurl node["nova"]["volume"]["adminURL"] + endpoint_internalurl node["nova"]["volume"]["internalURL"] + endpoint_publicurl node["nova"]["volume"]["publicURL"] action :create_endpoint end diff --git a/templates/default/libvirtd.conf.erb b/templates/default/libvirtd.conf.erb index e19319c7..9fcab8ba 100644 --- a/templates/default/libvirtd.conf.erb +++ b/templates/default/libvirtd.conf.erb @@ -143,7 +143,7 @@ auth_unix_rw = "none" # Don't do this outside of a dev/test scenario. For real world # use, always enable SASL and use the GSSAPI or DIGEST-MD5 # mechanism in /etc/sasl2/libvirt.conf -auth_tcp = "<%= node[:libvirt][:auth_tcp] %>" +auth_tcp = "<%= node["nova"]["libvirt"]["auth_tcp"] %>" # Change the authentication scheme for TLS sockets. #