Tuesday, 1 November 2016

OpenStack Newton release multi node installation with Linux Bridge (no OVS) by shell script.

Installation of a multi node OpenStack setup (the Newton release) using Shell Scripts.
Source:- http://docs.openstack.org/newton/install-guide-rdo/common/conventions.html 

We'll use Linux Bridge instead of OVS for ml2 driver mechanism which supports beyond Kilo release.

System Requirements.(We need a minimum of two nodes as below). and Prerequisites

This setup has prepared for CentOS7 using OpenStack Repos.

1. Controller Node with Neutron. (controller01)

      Mem- 8GB
      Proc- 2 CPU
      Storage- 20GB
     A minimum of 3 Nics.
     eth0 (will use for management)
     cat ifcfg-eth0
                    DEVICE=eth0
                    BOOTPROTO=static
                    ONBOOT=yes
                    IPADDR=192.168.10.10
                    NETMASK=255.255.255.0
                    GATEWAY = 192.168.10.1
                    TYPE=Ethernet
    eth1 (will use for tunneling/data network)
     cat ifcfg-eth1
                    DEVICE=eth1
                    BOOTPROTO=static
                    ONBOOT=yes
                    IPADDR=192.168.20.10
                    NETMASK=255.255.255.0
                    TYPE=Ethernet
   eth2(will use for External Network)
    cat ifcfg-eth1
                    DEVICE=eth2
                    BOOTPROTO=none
                    ONBOOT=yes
                    TYPE=Ethernet
   

2. Compute Node. (compute01) 

      Mem- 4GB
      Proc- 2 CPU
      Storage- 20GB
      cat ifcfg-eth0
                    DEVICE=eth0
                    BOOTPROTO=static
                    ONBOOT=yes
                    IPADDR=192.168.10.11
                    NETMASK=255.255.255.0
                    GATEWAY = 192.168.10.1
                    TYPE=Ethernet
    eth1 (will use for tunneling/data network)
     cat ifcfg-eth1
                    DEVICE=eth1
                    BOOTPROTO=static
                    ONBOOT=yes
                    IPADDR=192.168.20.11
                    NETMASK=255.255.255.0
                    TYPE=Ethernet

* Add the the IPs and Name to /etc/hosts on both and all the nodes should resolve their IP and Name.
* Read the READ ME section before execution of the script.

    OpenStack packages.

Install the below package to enable the OpenStack repository from root.(on all the nodes)
   
yum install centos-release-openstack-newton.

After successful installation you should see the repo list under  /etc/yum.repos.d/

#ls /etc/yum.repos.d/

 epel.repo  rdo-qemu-ev.repo  rdo-release.repo  rdo-testing.repo

Create an additional repo if required (may failed to install common packages.).
#cat /etc/yum.repos.d/rdo_extra.repo
     [openstack-newton-extra]
     name= OpenStack  Extra Repository
     baseurl=http://mirror.yandex.ru/centos/7/extras/x86_64
     gpgcheck=1
     enabled=1
     gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Cloud

#yum clean all
#yum repolist.
#yum upgrade -y

Once upgrade done please reboot the system to New Kernel.


Script for Controller and Neutron(2 in 1).

READ ME
--------------------
* The below script can be copied to a file on controller, make it executable and execute.
During execution of the script it will ask the mysql setup for root user. Please follow  that only.
* This is a demo setup and the hostname and IPs are predefined inside the script into a variable. If your setup has different IP then modify the IP and host name accordingly.
========================================================================

yum install -y python-openstackclient openstack-selinux rabbitmq-server mongodb-server mongodb mariadb mariadb-server python2-PyMySQL memcached python-memcached openstack-keystone httpd mod_wsgi

#read -p "Give mgmt ip.." mgmt_ip
local_ip=192.168.10.10
tunnel_ip=192.168.20.10
mgmt_interfacce="eth0"
tunnel_interface="eth1"
external_interface="eth2"
mgmt_hostname=controller01
rabbit_user="rabbit_user_ost"
#generate password file...

admin_token=$(openssl rand -hex 10)
rabbit_pass=$(openssl rand -hex 10)
glance_pass=$(openssl rand -hex 10)
nova_pass=$(openssl rand -hex 10)
keystone_pass=$(openssl rand -hex 10)
cinder_pass=$(openssl rand -hex 10)
neutron_pass=$(openssl rand -hex 10)
metadata_pass=$(openssl rand -hex 10)
ADMIN_PASS =$(openssl rand -hex 10)
demo_pass =$(openssl rand -hex 10)



echo rabbit_user="rabbit_user_ost" > /root/password_list
echo mgmt_hostname=$mgmt_hostname >> /root/password_list
echo admin_token=$admin_token >> /root/password_list
echo rabbit_pass=$rabbit_pass >> /root/password_list
echo glance_pass=$glance_pass >> /root/password_list
echo nova_pass=$nova_pass >> /root/password_list
echo keystone_pass=$keystone_pass >> /root/password_list
echo cinder_pass=$cinder_pass >> /root/password_list
echo neutron_pass=$neutron_pass >> /root/password_list
echo metadata_pass=$metadata_pass >> /root/password_list
echo ADMIN_PASS=$ADMIN_PASS >> /root/password_list
echo demo_pass=$demo_pass >> /root/password_list



echo 'net.ipv4.ip_forward=1' >> /etc/sysctl.conf
echo 'net.ipv4.conf.all.rp_filter=0' >> /etc/sysctl.conf
echo 'net.ipv4.conf.default.rp_filter=0' >> /etc/sysctl.conf
setenforce 0
echo "Setting up mysql db..."
echo "[mysqld]
bind-address = $local_ip
default-storage-engine = innodb
innodb_file_per_table
max_connections = 4096
collation-server = utf8_general_ci
character-set-server = utf8" > /etc/my.cnf.d/openstack.cnf

systemctl enable mariadb.service
systemctl start mariadb.service

echo 'now run through the mysql_secure_installation'
mysql_secure_installation


echo 'Enter the new MySQL root password'

mysql -u root -p <<EOF
CREATE DATABASE nova;
CREATE DATABASE cinder;
CREATE DATABASE glance;
CREATE DATABASE keystone;
CREATE DATABASE neutron;
CREATE DATABASE nova_api;
GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost' IDENTIFIED BY '$nova_pass';
GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'localhost' IDENTIFIED BY '$cinder_pass';
GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' IDENTIFIED BY '$glance_pass';
GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'localhost' IDENTIFIED BY '$keystone_pass';
GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'localhost' IDENTIFIED BY '$neutron_pass';
GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' IDENTIFIED BY '$nova_pass';
GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'%' IDENTIFIED BY '$cinder_pass';
GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' IDENTIFIED BY '$glance_pass';
GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'%' IDENTIFIED BY '$keystone_pass';
GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'%' IDENTIFIED BY '$neutron_pass';
GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'localhost' IDENTIFIED BY '$nova_pass';
GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'%' IDENTIFIED BY '$nova_pass';
FLUSH PRIVILEGES;
EOF

########==============================================================================================

echo "Enabling rabbit MQ server.."

systemctl enable rabbitmq-server.service
systemctl start rabbitmq-server.service
rabbitmqctl add_user $rabbit_user $rabbit_pass
rabbitmqctl set_permissions $rabbit_user ".*" ".*" ".*"

echo "Enabling memcached..."
systemctl enable memcached.service
systemctl start memcached.service

read -p "Press a key to Configure Keystone"

#edit /etc/keystone.conf


sed -i.bak "s/#admin_token = <None>/admin_token=$admin_token/g" /etc/keystone/keystone.conf
sed  -i "/^\[database\]$/a\
connection = mysql+pymysql://keystone:$keystone_pass@$mgmt_hostname/keystone" /etc/keystone/keystone.conf
sed -i "/^\[token\]$/a\
provider = fernet" /etc/keystone/keystone.conf

su -s /bin/sh -c "keystone-manage db_sync" keystone
keystone-manage fernet_setup --keystone-user keystone --keystone-group keystone
##These below two are in new newton...
keystone-manage credential_setup --keystone-user keystone --keystone-group keystone
keystone-manage bootstrap --bootstrap-password $ADMIN_PASS --bootstrap-admin-url http://$mgmt_hostname:35357/v3/ --bootstrap-internal-url http://$mgmt_hostname:35357/v3/ --bootstrap-public-url http://$mgmt_hostname:5000/v3/  --bootstrap-region-id RegionOne

#edit /etc/httpd/conf/httpd.conf
sed -i.bak "s/#ServerName www.example.com:80/ServerName $mgmt_hostname/g" /etc/httpd/conf/httpd.conf
ln -s /usr/share/keystone/wsgi-keystone.conf /etc/httpd/conf.d/
systemctl enable httpd.service
systemctl start httpd.service
echo "Wating for http enable...."
sleep 10

echo "export OS_USERNAME=admin
export OS_PASSWORD=$ADMIN_PASS
export OS_PROJECT_NAME=admin
export OS_USER_DOMAIN_NAME=Default
export OS_PROJECT_DOMAIN_NAME=Default
export OS_AUTH_URL=http://$mgmt_hostname:35357/v3
export OS_IDENTITY_API_VERSION=3" > /root/temp_cred.sh



source /root/temp_cred.sh

echo ===========================
env
echo ===========================
echo "Creating domain/user/project.."

echo "Creating service domain...."
openstack project create --domain default --description "Service Project" service
echo "Creating demo domain...."
openstack project create --domain default --description "Demo Project" demo
openstack user create --domain default --password $demo_pass demo
openstack role create user
openstack role add --project demo --user demo user

unset OS_URL

openstack --os-auth-url http://$mgmt_hostname:35357/v3  --os-project-domain-name default --os-user-domain-name default  --os-project-name admin --os-username admin token issue
openstack --os-auth-url http://$mgmt_hostname:5000/v3 --os-project-domain-name default --os-user-domain-name default --os-project-name demo --os-username demo token issue

echo "export OS_PROJECT_DOMAIN_NAME=default
export OS_USER_DOMAIN_NAME=default
export OS_PROJECT_NAME=admin
export OS_USERNAME=admin
export OS_PASSWORD=$ADMIN_PASS
export OS_AUTH_URL=http://$mgmt_hostname:35357/v3
export OS_IDENTITY_API_VERSION=3
export OS_IMAGE_API_VERSION=2" > /root/admin-rc.sh

echo "export OS_PROJECT_DOMAIN_NAME=default
export OS_USER_DOMAIN_NAME=default
export OS_PROJECT_NAME=demo
export OS_USERNAME=demo
export OS_PASSWORD=$demo_pass
export OS_AUTH_URL=http://$mgmt_hostname:5000/v3
export OS_IDENTITY_API_VERSION=3
export OS_IMAGE_API_VERSION=2" > /root/demo-rc.sh

#read -p "Hit  a key to proceed for Image.."

source /root/admin-rc.sh
# echo "Creating glance user..."
# openstack user create --domain default --password $glance_pass glance
# echo "adding role to glance..."
# openstack role add --project service --user glance admin
# openstack service create --name glance --description "OpenStack Image" image
# openstack endpoint create --region RegionOne image public http://$mgmt_hostname:9292
# openstack endpoint create --region RegionOne image internal http://$mgmt_hostname:9292
# openstack endpoint create --region RegionOne image admin http://$mgmt_hostname:9292


echo "Configuring Image services..."

source /root/admin-rc.sh
echo ===========================
env
echo ===========================
openstack user create --domain default --password $glance_pass glance
openstack role add --project service --user glance admin
openstack service create --name glance --description "OpenStack Image" image
openstack endpoint create --region RegionOne image public http://$mgmt_hostname:9292
openstack endpoint create --region RegionOne image internal http://$mgmt_hostname:9292
openstack endpoint create --region RegionOne image admin http://$mgmt_hostname:9292

yum install openstack-glance -y

#edit /etc/glance/glance-api.conf
sed -i.bak "/\[database\]$/a connection =  mysql+pymysql://glance:$glance_pass@$mgmt_hostname/glance" /etc/glance/glance-api.conf

sed -i "/^\[keystone_authtoken\]$/a \
auth_uri = http://$mgmt_hostname:5000/v2.0\n\
auth_url = http://$mgmt_hostname:35357\n\
memcached_servers = $mgmt_hostname:11211\n\
auth_type = password\n\
project_domain_name = default\n\
user_domain_name = default\n\
project_name = service\n\
username = glance\n\
password = $glance_pass " /etc/glance/glance-api.conf

sed -i "/^\[paste_deploy\]$/a \
flavor = keystone" /etc/glance/glance-api.conf

sed -i "/^\[glance_store\]$/a \
default_store = file,http\n\
default_store = file \n\
filesystem_store_datadir = /var/lib/glance/images/" /etc/glance/glance-api.conf

#edit /etc/glance/glance-registry.conf

sed -i.bak "/^\[database\]$/a connection =  mysql+pymysql://glance:$glance_pass@$mgmt_hostname/glance" /etc/glance/glance-registry.conf

sed -i "/^\[keystone_authtoken\]$/a \
auth_uri = http://$mgmt_hostname:5000/v2.0\n\
auth_url = http://$mgmt_hostname:35357\n\
memcached_servers = $mgmt_hostname:11211\n\
auth_type = password\n\
project_domain_name = default\n\
user_domain_name = default\n\
project_name = service\n\
username = glance\n\
password = $glance_pass " /etc/glance/glance-registry.conf

sed -i "/^\[paste_deploy\]$/a \
flavor = keystone" /etc/glance/glance-registry.conf


su -s /bin/sh -c "glance-manage db_sync" glance
systemctl enable openstack-glance-api.service openstack-glance-registry.service
systemctl start openstack-glance-api.service  openstack-glance-registry.service

source /root/admin-rc.sh
wget http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img

openstack image create "cirros"  --file cirros-0.3.4-x86_64-disk.img --disk-format qcow2 --container-format bare --public
openstack image list


##+==================##+==================##+==================##+==================##+==================##+==================##+==================##+==================
source /root/admin-rc.sh
echo "Configure nova service..."

openstack user create --domain default --password $nova_pass nova
openstack role add --project service --user nova admin
openstack service create --name nova --description "OpenStack Compute" compute
openstack endpoint create --region RegionOne compute public http://$mgmt_hostname:8774/v2.1/%\(tenant_id\)s
openstack endpoint create --region RegionOne compute internal http://$mgmt_hostname:8774/v2.1/%\(tenant_id\)s
openstack endpoint create --region RegionOne compute admin http://$mgmt_hostname:8774/v2.1/%\(tenant_id\)#!/bin/sh

yum install openstack-nova-api openstack-nova-conductor openstack-nova-console openstack-nova-novncproxy openstack-nova-scheduler -y

#edit /etc/nova/nova.conf

sed -i.bak "/^\[database\]$/a \
connection = mysql+pymysql://nova:$nova_pass@$mgmt_hostname/nova" /etc/nova/nova.conf

sed -i "/^\[api_database\]$/a \
connection = mysql+pymysql://nova:$nova_pass@$mgmt_hostname/nova_api" /etc/nova/nova.conf


sed -i "/^\[DEFAULT\]$/a \
auth_strategy = keystone\n\
my_ip = $local_ip\n\
use_neutron = True\n\
firewall_driver = nova.virt.firewall.NoopFirewallDriver" /etc/nova/nova.conf

# sed -i "/^\[oslo_messaging_rabbit\]$/a \
# rabbit_host = $mgmt_hostname\n\
# rabbit_userid = $rabbit_user\n\
# rabbit_password = $rabbit_pass\n\
# enabled_apis = osapi_compute,metadata" /etc/nova/nova.conf




sed -i "/^\[vnc\]$/a \
vncserver_listen = \$my_ip\n\
vncserver_proxyclient_address = \$my_ip" /etc/nova/nova.conf

sed -i "/^\[glance\]$/a \
api_servers = http://$mgmt_hostname:9292" /etc/nova/nova.conf

sed -i "/^\[oslo_concurrency\]$/a \
lock_path = /var/lib/nova/tmp" /etc/nova/nova.conf

# sed -i "/\[neutron\]/a \
# url = http://$mgmt_hostname:9696\n\
# auth_url = http://$mgmt_hostname:35357\n\
# auth_type = password\n\
# project_domain_name = default\n\
# user_domain_name = default\n\
# region_name = RegionOne\n\
# project_name = service\n\
# username = neutron\n\
# password = $neutron_pass\n\
# service_metadata_proxy = True\n\
# metadata_proxy_shared_secret = $neutron_pass" /etc/nova/nova.conf



sed -i "/^\[keystone_authtoken\]$/a \
auth_uri = http://$mgmt_hostname:5000\n\
auth_url = http://$mgmt_hostname:35357\n\
memcached_servers = $mgmt_hostname:11211\n\
auth_type = password\n\
project_domain_name = default\n\
user_domain_name = default\n\
project_name = service\n\
username = nova\n\
password = $nova_pass" /etc/nova/nova.conf

su -s /bin/sh -c "nova-manage api_db sync" nova
su -s /bin/sh -c "nova-manage db sync" nova


systemctl enable openstack-nova-api.service openstack-nova-consoleauth.service openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service
systemctl start openstack-nova-api.service openstack-nova-consoleauth.service openstack-nova-scheduler.service  openstack-nova-conductor.service openstack-nova-novncproxy.service

##+==================##+==================##+==================##+==================##+==================##+==================##+==================##+==================
#neutron services...
source /root/admin-rc.sh
openstack user create --domain default --password $neutron_pass neutron
openstack role add --project service --user neutron admin
openstack service create --name neutron  --description "OpenStack Networking" network
openstack endpoint create --region RegionOne network public http://$mgmt_hostname:9696
openstack endpoint create --region RegionOne network internal http://$mgmt_hostname:9696
openstack endpoint create --region RegionOne network admin http://$mgmt_hostname:9696

#Install neutron packages

yum install openstack-neutron openstack-neutron-ml2 openstack-neutron-linuxbridge ebtables -y

#edit /etc/neutron/metadata_agent.ini
# sed -i "/^\[DEFAULT\]$/a \
# nova_metadata_ip = $mgmt_hostname\n\
# metadata_proxy_shared_secret = $metadata_pass" /etc/neutron/metadata_agent.ini


#edit /etc/nova/nova.conf


sed -i "/^\[neutron\]$/a \
url = http://$mgmt_hostname:9696\n\
auth_url = http://$mgmt_hostname:35357\n\
auth_type = password\n\
project_domain_name = default\n\
user_domain_name = default\n\
region_name = RegionOne\n\
project_name = service\n\
username = neutron\n\
password = $neutron_pass\n\
service_metadata_proxy = True\n\
metadata_proxy_shared_secret = $metadata_pass" /etc/nova/nova.conf

#edit /etc/neutron/neutron.conf
sed -i "/^\[DEFAULT\]$/a \
verbose = True\n\
core_plugin = ml2\n\
service_plugins = router\n\
allow_overlapping_ips = True\n\
rpc_backend = rabbit\n\
auth_strategy = keystone\n\
notify_nova_on_port_status_changes = True\n\
notify_nova_on_port_data_changes = True" /etc/neutron/neutron.conf

sed -i "/^\[database\]$/a \
connection = mysql+pymysql://neutron:$neutron_pass@$mgmt_hostname/neutron" /etc/neutron/neutron.conf

sed -i "/^\[oslo_messaging_rabbit\]$/a \
rabbit_host = $mgmt_hostname\n\
rabbit_userid = $rabbit_user\n\
rabbit_password = $rabbit_pass" /etc/neutron/neutron.conf



sed -i "/^\[nova\]$/a \
auth_url = http://$mgmt_hostname:35357\n\
auth_type = password\n\
project_domain_name = default\n\
user_domain_name = default\n\
region_name = RegionOne\n\
project_name = service\n\
username = nova\n\
password = $nova_pass" /etc/neutron/neutron.conf



sed -i "/^\[oslo_concurrency\]$/a \
lock_path = /var/lib/neutron/tmp" /etc/neutron/neutron.conf

sed -i "/^\[keystone_authtoken\]/a \
auth_uri = http://$mgmt_hostname:5000\n\
auth_url = http://$mgmt_hostname:35357\n\
memcached_servers = $mgmt_hostname:11211\n\
auth_type = password\n\
project_domain_name = default\n\
user_domain_name = default\n\
project_name = service\n\
username = neutron\n\
password = $neutron_pass" /etc/neutron/neutron.conf

#edit /etc/neutron/plugins/ml2/ml2_conf.ini
sed -i "/^\[ml2\]$/a \
type_drivers = flat,vlan,vxlan\n\
tenant_network_types = vlan,vxlan\n\
mechanism_drivers = linuxbridge,l2population\n\
extension_drivers = port_security" /etc/neutron/plugins/ml2/ml2_conf.ini

sed -i "/^\[ml2\]$/a \
type_drivers = flat,vlan,vxlan\n\
tenant_network_types = vxlan\n\
mechanism_drivers = linuxbridge,l2population\n\
extension_drivers = port_security" /etc/neutron/plugins/ml2/ml2_conf.ini

sed -i "/^\[ml2_type_flat\]$/a \
flat_networks = external" /etc/neutron/plugins/ml2/ml2_conf.ini

sed -i "/^\[ml2_type_vlan\]$/a \
network_vlan_ranges = external,vlan:1:1000" /etc/neutron/plugins/ml2/ml2_conf.ini

sed -i "/^\[ml2_type_vxlan\]$/a \
vni_ranges = 1:1000" /etc/neutron/plugins/ml2/ml2_conf.ini

sed -i "/^\[securitygroup\]$/a \
firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver\n\
enable_ipset = True" /etc/neutron/plugins/ml2/ml2_conf.ini

#edit /etc/neutron/plugins/ml2/linuxbridge_agent.ini

sed -i.back "/^\[linux_bridge\]$/a \
physical_interface_mappings = external:$external_interface" /etc/neutron/plugins/ml2/linuxbridge_agent.ini

sed -i "/^\[vxlan\]$/a \
enable_vxlan = True\n\
local_ip = $tunnel_ip\n\
l2_population = True" /etc/neutron/plugins/ml2/linuxbridge_agent.ini

sed -i "/^\[securitygroup\]$/a \
enable_vxlan = True\n\
enable_security_group = True\n\
firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver" /etc/neutron/plugins/ml2/linuxbridge_agent.ini


#edit /etc/neutron/l3_agent.ini

sed -i.bak "/^\[DEFAULT\]$/a \
verbose = True\n\
interface_driver = neutron.agent.linux.interface.BridgeInterfaceDriver\n\
use_namespaces = True\n\
external_network_bridge =\n\
router_delete_namespaces = True" /etc/neutron/l3_agent.ini

#edit  /etc/neutron/dhcp_agent.ini


sed -i "/^\[DEFAULT\]$/a \
verbose = True\n\
interface_driver = neutron.agent.linux.interface.BridgeInterfaceDriver\n\
dhcp_driver = neutron.agent.linux.dhcp.Dnsmasq\n\
use_namespaces = True\n\
dhcp_delete_namespaces = True"  /etc/neutron/dhcp_agent.ini


#edit /etc/neutron/dnsmasq-neutron.conf

#echo "dhcp-option-force=26,1450" >   /etc/neutron/dnsmasq-neutron.conf

#edit /etc/neutron/metadata_agent.ini
sed -i "/^\[DEFAULT\]$/a \
verbose = True\n\
nova_metadata_ip = $mgmt_hostname\n\
metadata_proxy_shared_secret = $metadata_pass" /etc/neutron/metadata_agent.ini

ln -s /etc/neutron/plugins/ml2/ml2_conf.ini /etc/neutron/plugin.ini
su -s /bin/sh -c "neutron-db-manage --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade head" neutron
systemctl restart openstack-nova-api.service
systemctl enable neutron-server.service neutron-linuxbridge-agent.service neutron-dhcp-agent.service neutron-metadata-agent.service
systemctl restart neutron-server.service neutron-linuxbridge-agent.service neutron-dhcp-agent.service neutron-metadata-agent.service
systemctl enable neutron-l3-agent.service
systemctl restart neutron-l3-agent.service

==================================================
Now Please check the nova service and neutron agent all should be in happy state. 



source /root/admin-rc.sh (from Controller)
source admin-rc.sh
openstack image list
+--------------------------------------+--------+--------+
| ID                                   | Name   | Status |
+--------------------------------------+--------+--------+
| 03bfe151-82f8-4b4e-a21a-26a40ba49429 | cirros | active |
+--------------------------------------+--------+--------+
nova service-list
+----+------------------+-----------------+----------+---------+-------+----------------------------+-----------------+
| Id | Binary           | Host            | Zone     | Status  | State | Updated_at                 | Disabled Reason |
+----+------------------+-----------------+----------+---------+-------+----------------------------+-----------------+
| 1  | nova-conductor   | controller01    | internal | enabled | up    | 2016-11-01T09:55:37.000000 | -               |
| 2  | nova-consoleauth | controller01    | internal | enabled | up    | 2016-11-01T09:55:36.000000 | -               |
| 3  | nova-scheduler   | controller01    | internal | enabled | up    | 2016-11-01T09:55:40.000000 | -               |
+----+------------------+-----------------+----------+---------+-------+----------------------------+-----------------+
neutron agent-list
+--------------------------------------+--------------------+-----------------+-------------------+-------+----------------+---------------------------+
| id                                   | agent_type         | host            | availability_zone | alive | admin_state_up | binary                    |
+--------------------------------------+--------------------+-----------------+-------------------+-------+----------------+---------------------------+
| 3176703c-9fd3-4483-964b-6be97c7a74ce | DHCP agent         | controller01    | nova              | :-)   | True           | neutron-dhcp-agent        |
| 9be26c2c-a1e2-46a3-ad3c-2ecb84cd96fa | Linux bridge agent | controller01    |                   | :-)   | True           | neutron-linuxbridge-agent |
| e253afe3-ee42-4454-9619-8626effbc902 | L3 agent           | controller01    | nova              | :-)   | True           | neutron-l3-agent          |
| ed04011c-5969-45c6-ade0-9673ed5b53be | Metadata agent     | controller01    |                   | :-)   | True           | neutron-metadata-agent    |
+--------------------------------------+--------------------+-----------------+-------------------+-------+----------------+---------------------------+



==================================================

If any error you found on both of above please troubleshoot them and fix, then go ahead for compute node.
========================================================

           Script for Compute Node.

READ ME
-------------------
* Before execution of the script for compute node, Please copy the file password_list from controllernode, it will generate by the above script under /root  during setup. This file contains the list of password are being used by controller.

* The below script can be copied to a file on compute node, make it executable and execute.
During execution of the script it will ask the mysql setup for root user. Please follow  that only.
* This is a demo setup and the hostname and IPs are predefined inside the script into a variable. If your setup has different IP then modify the IP and host name accordingly.
============================================================

yum install -y ntp openstack-nova-compute python-openstackclient openstack-neutron-linuxbridge ebtables ipset

systemctl enable ntpd.service
systemctl start ntpd.service
#echo 'net.ipv4.ip_forward=1' >> /etc/sysctl.conf
echo 'net.ipv4.conf.all.rp_filter=0' >> /etc/sysctl.conf
echo 'net.ipv4.conf.default.rp_filter=0' >> /etc/sysctl.conf
echo "net.bridge.bridge-nf-call-iptables=1" >> /etc/sysctl.conf
echo "net.bridge.bridge-nf-call-ip6tables=1" >> /etc/sysctl.conf
setenforce 0
local_ip=192.168.10.11
tunnel_ip=192.168.20.11

# Copy the file password_list from controller generated by the controller node script for set of passwords.

if [[ -f password_list ]]; then
   #statements
   echo "File exist..."
   cat password_list
   chmod a+x password_list
   export `cat password_list | grep -w rabbit_user`
   export `cat password_list | grep -w rabbit_pass`
   export `cat password_list | grep -w mgmt_hostname`
   export `cat password_list | grep -w nova_pass`
   export `cat password_list | grep -w neutron_pass`
   export `cat password_list | grep -w cinder_pass`

else
   echo "password_list file does not exist"
   exit
fi

#edit /etc/nova/nova.conf
sed -i.bak "/^\[DEFAULT\]$/a \
verbose = True\n\
enabled_apis = osapi_compute,metadata\n\
transport_url = rabbit://$rabbit_user:$rabbit_pass@$mgmt_hostname\n\
auth_strategy = keystone\n\
my_ip = $local_ip\n\
use_neutron = True\n\
firewall_driver = nova.virt.firewall.NoopFirewallDriver" /etc/nova/nova.conf


sed -i "/^\[keystone_authtoken\]$/a \
auth_uri = http://$mgmt_hostname:5000\n\
auth_url = http://$mgmt_hostname:35357\n\
memcached_servers = $mgmt_hostname:11211\n\
auth_type = password\n\
project_domain_name = default\n\
user_domain_name = default\n\
project_name = service\n\
username = nova\n\
password = $nova_pass" /etc/nova/nova.conf

sed -i "/^\[vnc\]$/a \
enabled = True\n\
vncserver_listen = 0.0.0.0\n\
vncserver_proxyclient_address = \$my_ip\n\
novncproxy_base_url = http://$mgmt_hostname:6080/vnc_auto.html" /etc/nova/nova.conf

sed -i "/^\[glance\]$/a \
api_servers = http://$mgmt_hostname:9292" /etc/nova/nova.conf


sed -i "/^\[oslo_concurrency\]$/a \
lock_path = /var/lib/nova/tmp" /etc/nova/nova.conf

if [[ `egrep -c '(vmx|svm)' /proc/cpuinfo` == 0 ]]; then
   #statements
   sed -i "/^\[libvirt\]$/a \
   virt_type = qemu" /etc/nova/nova.conf
fi

systemctl enable libvirtd.service openstack-nova-compute.service
systemctl start libvirtd.service openstack-nova-compute.service


#edit  /etc/neutron/neutron.conf
sed -i "/^\[DEFAULT\]$/a \
rpc_backend = rabbit\n\
verbose = True\n\
auth_strategy = keystone" /etc/neutron/neutron.conf




sed -i "/^\[keystone_authtoken\]$/a \
auth_uri = http://$mgmt_hostname:5000\n\
auth_url = http://$mgmt_hostname:35357\n\
memcached_servers = $mgmt_hostname:11211\n\
auth_type = password\n\
project_domain_name = default\n\
user_domain_name = default\n\
project_name = service\n\
username = neutron\n\
password = $neutron_pass" /etc/neutron/neutron.conf



sed -i "/^\[oslo_messaging_rabbit\]$/a \
rabbit_host = $mgmt_hostname\n\
rabbit_userid = $rabbit_user\n\
rabbit_password = $rabbit_pass" /etc/neutron/neutron.conf

sed -i "/^\[oslo_concurrency\]$/a \
lock_path = /var/lib/neutron/tmp" /etc/neutron/neutron.conf



#edit /etc/nova/nova.conf


sed -i "/^\[neutron\]$/a \
url = http://$mgmt_hostname:9696\n\
auth_url = http://$mgmt_hostname:35357\n\
auth_type = password\n\
project_domain_name = default\n\
user_domain_name = default\n\
region_name = RegionOne\n\
project_name = service\n\
username = neutron\n\
password = $neutron_pass" /etc/nova/nova.conf



#edit /etc/neutron/plugins/ml2/linuxbridge_agent.ini
sed -i "/^\[linux_bridge\]$/a \
physical_interface_mappings = vlan:eth1" /etc/neutron/plugins/ml2/linuxbridge_agent.ini

sed -i "/^\[vxlan\]$/a \
enable_vxlan = True\n\
local_ip =  $tunnel_ip\n\
l2_population = True" /etc/neutron/plugins/ml2/linuxbridge_agent.ini

sed -i "/^\[securitygroup\]$/a \
firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver\n\
enable_security_group = True\n\
enable_ipset = True" /etc/neutron/plugins/ml2/linuxbridge_agent.ini

systemctl restart openstack-nova-compute.service
systemctl enable neutron-linuxbridge-agent.service
systemctl start neutron-linuxbridge-agent.service

==============================================

Please check on compute node the services openstack-nova-compute and neutron-linuxbridge-agent should up running.
===================================================================

Now if everything went fine you should see all the service are smiling...
source admin-rc.sh
 nova service-list
+----+------------------+-----------------+----------+---------+-------+----------------------------+-----------------+
| Id | Binary           | Host            | Zone     | Status  | State | Updated_at                 | Disabled Reason |
+----+------------------+-----------------+----------+---------+-------+----------------------------+-----------------+
| 1  | nova-conductor   | controller01    | internal | enabled | up    | 2016-11-01T09:55:37.000000 | -               |
| 2  | nova-consoleauth | controller01    | internal | enabled | up    | 2016-11-01T09:55:36.000000 | -               |
| 3  | nova-scheduler   | controller01    | internal | enabled | up    | 2016-11-01T09:55:40.000000 | -               |
| 9  | nova-compute     | compute01       | nova     | enabled | up    | 2016-11-01T09:55:39.000000 | -               |
+----+------------------+-----------------+----------+---------+-------+----------------------------+-----------------+
neutron agent-list+--------------------------------------+----------------------+------------------------+-------------------+-------+----------------+---------------------------+
| id                                   | agent_type           | host                    | availability_zone | alive | admin_state_up | binary                    |
+--------------------------------------+----------------------+-------------------------+-------------------+-------+----------------+---------------------------+
| 34757124-456f-4fb1-871a-34745041082c | Linux bridge agent   | compute01.localdomain   |                   | :-)   | True           | neutron-linuxbridge-agent |
| 56b83c9f-a727-4fde-a267-285077ae6bc2 | Metadata agent       | controller01            |                   | :-)   | True           | neutron-metadata-agent    |
| b936f9b8-ce29-41ba-9c5e-95bb195cae64 | DHCP agent           | controller01            | nova              | :-)   | True           | neutron-dhcp-agent        |
| c70a551a-eda3-4b02-b3db-18701617f0cd | Linux bridge agent   | controller01            |                   | :-)   | True           | neutron-linuxbridge-agent |
+--------------------------------------+----------------------+------------------------+-------------------+-------+----------------+---------------------------+

Create New work (Flat network for External). The below network can be used as Floating IP.

neutron net-create ext-net --router:external True   --provider:physical_network external --provider:network_type flat
Created a new network:
+---------------------------+--------------------------------------+
| Field                     | Value                                |
+---------------------------+--------------------------------------+
| admin_state_up            | True                                 |
| availability_zone_hints   |                                      |
| availability_zones        |                                      |
| created_at                | 2016-11-01T10:32:46Z                 |
| description               |                                      |
| id                        | d8892cee-aa05-4ece-acc1-2406c61ad348 |
| ipv4_address_scope        |                                      |
| ipv6_address_scope        |                                      |
| is_default                | False                                |
| mtu                       | 1500                                 |
| name                      | ext01-net                            |
| port_security_enabled     | True                                 |
| project_id                | 74808d4c7cd14eef9b7ba1f5cbea04f6     |
| provider:network_type     | flat                                 |
| provider:physical_network | external                             |
| provider:segmentation_id  |                                      |
| revision_number           | 3                                    |
| router:external           | True                                 |
| shared                    | False                                |
| status                    | ACTIVE                               |
| subnets                   |                                      |
| tags                      |                                      |
| tenant_id                 | 74808d4c7cd14eef9b7ba1f5cbea04f6     |
| updated_at                | 2016-11-01T10:32:46Z                 |
+---------------------------+--------------------------------------+
neutron subnet-create ext01-net --name ext-subnet --allocation-pool   start=203.0.113.101,end=203.0.113.200 --disable-dhcp   --gateway 203.0.113.1 203.0.113.0/24
Created a new subnet:
+-------------------+----------------------------------------------------+
| Field             | Value                                              |
+-------------------+----------------------------------------------------+
| allocation_pools  | {"start": "203.0.113.101", "end": "203.0.113.200"} |
| cidr              | 203.0.113.0/24                                     |
| created_at        | 2016-11-01T10:37:06Z                               |
| description       |                                                    |
| dns_nameservers   |                                                    |
| enable_dhcp       | False                                              |
| gateway_ip        | 203.0.113.1                                        |
| host_routes       |                                                    |
| id                | 176b6df1-8e05-4e83-973f-960ee0d52ef3               |
| ip_version        | 4                                                  |
| ipv6_address_mode |                                                    |
| ipv6_ra_mode      |                                                    |
| name              | ext-subnet                                         |
| network_id        | d8892cee-aa05-4ece-acc1-2406c61ad348               |
| project_id        | 74808d4c7cd14eef9b7ba1f5cbea04f6                   |
| revision_number   | 2                                                  |
| service_types     |                                                    |
| subnetpool_id     |                                                    |
| tenant_id         | 74808d4c7cd14eef9b7ba1f5cbea04f6                   |
| updated_at        | 2016-11-01T10:37:06Z                               |
+-------------------+----------------------------------------------------+


Now you can configure the horizon using the below link...
    http://docs.openstack.org/newton/install-guide-rdo/horizon.html

You need to create a private network , router and attach the router to External network Interface. Add the appropriate security group rules.

Spin an Instance using horizon & Cheers OpenStack.

==============================Happy Stack================================
If any difficulties during setup or addition information, I can contacted via mymail8500@gmail.com
=======================================================================


2 comments:

Prasanta Kumar Behera. Mob- 8147470101