update deployment engine for multi node scenario

This commit is contained in:
Vladimir Kuklin 2013-08-02 18:16:46 +04:00 committed by Evgeniy L
parent 488b0b5162
commit 08ea5191bc
1 changed files with 27 additions and 23 deletions

View File

@ -39,34 +39,38 @@ module Astute
raise "Method #{method} is not implemented for #{self.class}"
end
def attrs_singlenode(nodes, attrs)
ctrl_management_ip = nodes[0]['network_data'].select {|nd| nd['name'] == 'management'}[0]['ip']
ctrl_public_ip = nodes[0]['network_data'].select {|nd| nd['name'] == 'public'}[0]['ip']
attrs['controller_node_address'] = ctrl_management_ip.split('/')[0]
attrs['controller_node_public'] = ctrl_public_ip.split('/')[0]
attrs
end
# def attrs_singlenode(nodes, attrs)
# ctrl_management_ip = nodes[0]['network_data'].select {|nd| nd['name'] == 'management'}[0]['ip']
# ctrl_public_ip = nodes[0]['network_data'].select {|nd| nd['name'] == 'public'}[0]['ip']
# attrs['controller_node_address'] = ctrl_management_ip.split('/')[0]
# attrs['controller_node_public'] = ctrl_public_ip.split('/')[0]
# attrs
# end
def deploy_singlenode(nodes, attrs)
# TODO(mihgen) some real stuff is needed
Astute.logger.info "Starting deployment of single node OpenStack"
deploy_piece(nodes, attrs)
end
# def deploy_singlenode(nodes, attrs)
# # TODO(mihgen) some real stuff is needed
# Astute.logger.info "Starting deployment of single node OpenStack"
# deploy_piece(nodes, attrs)
# end
# we mix all attrs and prepare them for Puppet
# Works for multinode deployment mode
def attrs_multinode(nodes, attrs)
ctrl_nodes = attrs['controller_nodes']
# TODO(mihgen): we should report error back if there are not enough metadata passed
ctrl_management_ips = []
ctrl_public_ips = []
ctrl_nodes.each do |n|
ctrl_management_ips << n['network_data'].select {|nd| nd['name'] == 'management'}[0]['ip']
ctrl_public_ips << n['network_data'].select {|nd| nd['name'] == 'public'}[0]['ip']
attrs['nodes'] = nodes.map do |n|
{
'fqdn' => n['fqdn'],
'name' => n['fqdn'].split(/\./)[0],
'role' => n['role'],
'internal_address' => n['network_data'].select {|nd| select_ifaces(nd['name'], 'management')}[0]['ip'].split(/\//)[0],
'internal_br' => n['internal_br'],
'internal_netmask' => n['network_data'].select {|nd| select_ifaces(nd['name'], 'management')}[0]['netmask'],
'public_address' => n['network_data'].select {|nd| select_ifaces(nd['name'], 'public')}[0]['ip'].split(/\//)[0],
'public_br' => n['public_br'],
'public_netmask' => n['network_data'].select {|nd| select_ifaces(nd['name'], 'public')}[0]['netmask'],
'default_gateway' => n['default_gateway']
}
end
attrs['controller_node_address'] = ctrl_management_ips[0].split('/')[0]
attrs['controller_node_public'] = ctrl_public_ips[0].split('/')[0]
# TODO(mihgen): we should report error back if there are not enough metadata passed
attrs
end
@ -74,7 +78,7 @@ module Astute
# It should not contain any magic with attributes, and should not directly run any type of MC plugins
# It does only support of deployment sequence. See deploy_piece implementation in subclasses.
def deploy_multinode(nodes, attrs)
ctrl_nodes = nodes.select {|n| n['role'] == 'controller'}
ctrl_nodes = nodes.select {|n| n['role'] == 'controller'}.first
compute_nodes = nodes.select {|n| n['role'] == 'compute'}
Astute.logger.info "Starting deployment of primary controller"