From 36ff13c7a2fcd55e792245e52bac41bd42fca700 Mon Sep 17 00:00:00 2001 From: SamSu Date: Mon, 31 Mar 2014 20:24:48 -0700 Subject: [PATCH] add novnc and glance to support ha Change-Id: I4ca69efc58988a031c8d81d44c2471c627119537 --- chef/cookbooks/haproxy/attributes/default.rb | 7 +++++++ chef/cookbooks/haproxy/recipes/tcp_lb.rb | 7 ++++++- chef/cookbooks/openstack-common/recipes/databag.rb | 3 ++- chef/cookbooks/openstack-image/recipes/api.rb | 9 ++++++++- chef/databags/openstack/openstack.json | 2 +- 5 files changed, 24 insertions(+), 4 deletions(-) diff --git a/chef/cookbooks/haproxy/attributes/default.rb b/chef/cookbooks/haproxy/attributes/default.rb index 091c3c8..f503dfd 100644 --- a/chef/cookbooks/haproxy/attributes/default.rb +++ b/chef/cookbooks/haproxy/attributes/default.rb @@ -152,6 +152,13 @@ default['haproxy']['services'] = { "balance" => "source", "options" => [ "option tcpka", "option httpchk", "option tcplog"] }, + "novncproxy" => { + "role" => "os-compute-single-controller", + "frontend_port" => "6080", + "backend_port" => "6080", + "balance" => "source", + "options" => [ "option tcpka", "option http-server-close", "option tcplog"] + }, "nova_metadata_api" => { "role" => "os-compute-single-controller", "frontend_port" => "8775", diff --git a/chef/cookbooks/haproxy/recipes/tcp_lb.rb b/chef/cookbooks/haproxy/recipes/tcp_lb.rb index f31d02b..d1afbbb 100644 --- a/chef/cookbooks/haproxy/recipes/tcp_lb.rb +++ b/chef/cookbooks/haproxy/recipes/tcp_lb.rb @@ -76,7 +76,12 @@ node['haproxy']['services'].each do |name, service| pool = ["options httpchk #{node['haproxy']['httpchk']}"] if node['haproxy']['httpchk'] pool = service[:options] servers = pool_members.uniq.map do |s| - "#{s[:hostname]} #{s[:ipaddress]}:#{service[:backend_port]} check inter 2000 rise 2 fall 5" + # novncproxy cannot to be checked + if name.eql?("novncproxy") + "#{s[:hostname]} #{s[:ipaddress]}:#{service[:backend_port]}" + else + "#{s[:hostname]} #{s[:ipaddress]}:#{service[:backend_port]} check inter 2000 rise 2 fall 5" + end end haproxy_lb name do diff --git a/chef/cookbooks/openstack-common/recipes/databag.rb b/chef/cookbooks/openstack-common/recipes/databag.rb index a3514b0..6a09a8b 100644 --- a/chef/cookbooks/openstack-common/recipes/databag.rb +++ b/chef/cookbooks/openstack-common/recipes/databag.rb @@ -77,7 +77,8 @@ node['openstack']['services'].each_key do |service| end end -if mydata['ha']['status'].eql?('enable') +node.set["openstack"]["ha"]["status"] = mydata['ha']['status'] +if node["openstack"]["ha"]["status"].eql?('enable') node.set["openstack"]["identity"]["bind_interface"] = mydata['networking']['control']['interface'] node.set["openstack"]["image"]["api"]["bind_interface"] = mydata['networking']['control']['interface'] node.set["openstack"]["image"]["registry"]["bind_interface"] = mydata['networking']['control']['interface'] diff --git a/chef/cookbooks/openstack-image/recipes/api.rb b/chef/cookbooks/openstack-image/recipes/api.rb index 2dd27e1..92ad442 100644 --- a/chef/cookbooks/openstack-image/recipes/api.rb +++ b/chef/cookbooks/openstack-image/recipes/api.rb @@ -149,6 +149,12 @@ else bind_address = address_for node["openstack"]["image"]["api"]["bind_interface"] end +if node["openstack"]["ha"]["status"].eql?('enable') + registry_ip_address = address_for node["openstack"]["image"]["registry"]["bind_interface"] +else + registry_ip_address = registry_endpoint.host +end + template "/etc/glance/glance-api.conf" do source "glance-api.conf.erb" owner node["openstack"]["image"]["user"] @@ -157,7 +163,8 @@ template "/etc/glance/glance-api.conf" do variables( :api_bind_address => bind_address, :api_bind_port => api_endpoint.port, - :registry_ip_address => registry_endpoint.host, +# :registry_ip_address => registry_endpoint.host, + :registry_ip_address => registry_ip_address, :registry_port => registry_endpoint.port, :sql_connection => sql_connection, :glance_flavor => glance_flavor, diff --git a/chef/databags/openstack/openstack.json b/chef/databags/openstack/openstack.json index 01327a4..9fe7300 100644 --- a/chef/databags/openstack/openstack.json +++ b/chef/databags/openstack/openstack.json @@ -139,7 +139,7 @@ "haproxy": { "vip": "", "roles": { - "os-controller": ["dashboard_http","dashboard_https","keystone_admin", "keystone_public_internal","nova_ec2_api","nova_compute_api","cinder_api","neutron_api","novnc"], + "os-controller": ["dashboard_http","dashboard_https","keystone_admin", "keystone_public_internal","nova_ec2_api","nova_compute_api","cinder_api","neutron_api","novncproxy"], "os-image": ["glance_api","glance_registry_cluster"] } },