Introduced new networking option for cluster

Now Savanna can provision cluster without floating IPs. Also removed 'apt-get install xsltproc' crutch from the setup script

Change-Id: I9240fe7402a398f5642823d87edc2408129eec2d
Fixes: bug #1163226
This commit is contained in:
Dmitry Mescheryakov 2013-04-02 16:35:02 +04:00
parent a742f0e674
commit 75affe206e
6 changed files with 46 additions and 71 deletions

View File

@ -7,11 +7,9 @@ Savanna quickstart guide
1.1 OpenStack environment (Folsom+ version) installed.
1.2 OpenStack compute has to have floating IP autoassigment. You can read more here: http://docs.openstack.org/trunk/openstack-compute/admin/content/associating-public-ip.html
1.2 Git should be installed on the machine where Savanna_API will be deployed.
1.3 Git should be installed on the machine where Savanna_API will be deployed.
1.4 Your OpenStack should have flavors with 'm1.small' and 'm1.medium' names defined because these flavors are referenced by Savanna's default Node Templates.
1.3 Your OpenStack should have flavors with 'm1.small' and 'm1.medium' names defined because these flavors are referenced by Savanna's default Node Templates.
You can check which flavors you have by running
.. sourcecode:: bash
@ -100,42 +98,7 @@ You should see the output similar to the following:
cp ./etc/savanna/savanna.conf.sample ./etc/savanna/savanna.conf
3.6 In savanna.conf you should edit the following parameters:
.. sourcecode:: bash
[DEFAULT]
# REST API config
#port=8080
#allow_cluster_ops=false
# Address and credentials that will be used to check auth tokens
#os_auth_host=openstack
#os_auth_port=35357
#os_admin_username=admin
#os_admin_password=nova
#os_admin_tenant_name=admin
# Nova network name that will be used to access VMs
#nova_internal_net_name=novanetwork
# (Optional) Name of log file to output to. If not set,
# logging will go to stdout. (string value)
#log_file=<None>
[cluster_node]
# An existing user on Hadoop image (string value)
#username=root
# User's password (string value)
#password=swordfish
[sqlalchemy]
# URL for sqlalchemy database (string value)
#database_uri=sqlite:////tmp/savanna-server.db
3.6 Look through the savanna.conf and change parameters which default values do not suite you.
**Note:** Config file could be specified for ``savanna-api`` and ``savanna-manage`` commands using ``--config-file`` flag.

View File

@ -11,9 +11,6 @@
#os_admin_password=nova
#os_admin_tenant_name=admin
# Nova network name that will be used to access VMs
#nova_internal_net_name=novanetwork
# (Optional) Name of log file to output to. If not set,
# logging will go to stdout. (string value)
#log_file=<None>
@ -26,6 +23,14 @@
# User's password (string value)
#password=swordfish
# When set to false, Savanna uses only internal IP of VMs.
# When set to true, Savanna expects OpenStack to auto-assign
# floating IPs to cluster nodes. Internal IPs will be used for
# inter-cluster communication, while floating ones will be
# used by Savanna to configure nodes. Also floating IPs will
# be exposed in service URLs (boolean value)
#use_floating_ips=true
[sqlalchemy]
# URL for sqlalchemy database (string value)

View File

@ -10,12 +10,6 @@
# set port (integer value)
#port=8080
# resets DB (boolean value)
#reset_db=false
# populates DB with stub data (boolean value)
#stub_data=false
# without that option the application operates in dry run mode
# and does not send any requests to the OpenStack cluster
# (boolean value)
@ -48,10 +42,6 @@
# Name of tenant where the user is admin (string value)
#os_admin_tenant_name=admin
# Name of network which IPs are given to the VMs (string
# value)
#nova_internal_net_name=novanetwork
#
# Options defined in savanna.openstack.common.log
@ -165,18 +155,26 @@
# User's password (string value)
#password=swordfish
# When set to false, Savanna uses only internal IP of VMs.
# When set to true, Savanna expects OpenStack to auto-assign
# floating IPs to cluster nodes. Internal IPs will be used for
# inter-cluster communication, while floating ones will be
# used by Savanna to configure nodes. Also floating IPs will
# be exposed in service URLs (boolean value)
#use_floating_ips=true
[sqlalchemy]
#
# Options defined in savanna.main
# Options defined in savanna.storage.db
#
# URL for sqlalchemy database (string value)
#database_uri=sqlite:////tmp/savanna-server.db
#database_uri=sqlite:////tmp/savanna.db
# Sqlalchemy echo (boolean value)
#echo=false
# Total option count: 40
# Total option count: 37

View File

@ -53,10 +53,7 @@ opts = [
help='Password of the admin user'),
cfg.StrOpt('os_admin_tenant_name',
default='admin',
help='Name of tenant where the user is admin'),
cfg.StrOpt('nova_internal_net_name',
default='novanetwork',
help='Name of network which IPs are given to the VMs')
help='Name of tenant where the user is admin')
]
CONF = cfg.CONF

View File

@ -23,7 +23,6 @@ mv /tmp/hadoop-env.sh /etc/hadoop/hadoop-env.sh
echo "----- Setting up Hadoop config through XSLT"
apt-get install -y xsltproc
xsltproc /tmp/savanna-hadoop-cfg.xsl /etc/hadoop/core-site.xml | tee /tmp/core-site.xml
mv /tmp/core-site.xml /etc/hadoop/core-site.xml
xsltproc /tmp/savanna-hadoop-cfg.xsl /etc/hadoop/mapred-site.xml | tee /tmp/mapred-site.xml

View File

@ -37,11 +37,18 @@ cluster_node_opts = [
help='An existing user on Hadoop image'),
cfg.StrOpt('password',
default='swordfish',
help='User\'s password')
help='User\'s password'),
cfg.BoolOpt('use_floating_ips',
default=True,
help='When set to false, Savanna uses only internal IP of VMs.'
' When set to true, Savanna expects OpenStack to auto-'
'assign floating IPs to cluster nodes. Internal IPs will '
'be used for inter-cluster communication, while floating '
'ones will be used by Savanna to configure nodes. Also '
'floating IPs will be exposed in service URLs')
]
CONF.register_opts(cluster_node_opts, 'cluster_node')
#CONF.import_opt('nova_internal_net_name', 'savanna.main')
def _find_by_id(lst, id):
@ -211,24 +218,30 @@ def _check_if_up(nova, node):
srv = _find_by_id(nova.servers.list(), node['id'])
nets = srv.networks
if CONF.nova_internal_net_name not in nets:
if len(nets) == 0:
# VM's networking is not configured yet
return
ips = nets[CONF.nova_internal_net_name]
if len(ips) < 2:
# public IP is not assigned yet
return
ips = nets.values()[0]
# we assume that public floating IP comes last in the list
node['ip'] = ips[-1]
if CONF.cluster_node.use_floating_ips:
if len(ips) < 2:
# floating IP is not assigned yet
return
# we assume that floating IP comes last in the list
node['ip'] = ips[-1]
else:
if len(ips) < 1:
# private IP is not assigned yet
return
node['ip'] = ips[0]
try:
ret = _execute_command_on_node(node['ip'], 'ls -l /')
_ensure_zero(ret)
except Exception:
# ssh is not up yet
# TODO(dmescheryakov) log error that takes > 5 minutes to start-up
return
node['is_up'] = True