Sunday, February 1, 2015

OpenStack (Juno) - DevStack Installation Using VirtualBox (with Neutron), VM Creation and Console Access


This is my 2nd post on OpenStack and I am going to install DevStack (with Neutron) on my Ubuntu Virtual Machine (my 1st post was on OpenStack installation using Mirantis Fuel 6.0)

The Host Machine that I will be using this time is a MacBook Pro running on OS X Yosemite (version 10.10.2) with i-7 quad-core processor and 16 GB RAM.

You will need VirtualBox (https://www.virtualbox.org/wiki/Downloads) and Ubuntu 14.04 ISO image (https://help.ubuntu.com/community/Installation/MinimalCD) for this installation. While I am using OS X, the installation procedures will be similar for a Windows Host machine (I have used VirtualBox 4.3.20 and Ubuntu 14.04 minimal CD (64-bit PC) for this post)



Steps:

1) Create Ubuntu VM using VirtualBox. I have assigned 8 GB RAM, 4 CPU Cores and 250GB to my VM (you can assign resources according to your needs but I feel that it will be good to assign at least 4GB of RAM, 50GB of storage space and 2 CPU Cores for decent performance). We will use the default Adapter 1 (NAT) that is defined in VirtualBox.


I selected "Basic Ubuntu Server" and "OpenSSH Server" for Ubuntu installation (press space bar to select the option)


I also created a default user and named it "stack" - I will use this user account to install DevStack (you are free to use any user name, it need not be stack)

Follow through the installation instructions to install Ubuntu on the VM


2) Once the installation is completed, click on Settings
-> Network on VirtualBox to arrive at this screen:


Click on the "Port Forwarding" button and you will see an empty table. Click on the green color '+' icon on the right side of the window to create a new entry for SSH. Fill in the data as follows so that we can SSH to the Ubuntu VM from the Mac Host Machine (you can use any port that is available in your system, I chose port 2220 in this case):


Open a terminal window in the Mac Host machine (you can install and use MobaXterm for this purpose if you are using a Windows Host Machine). Key in the following command (note that the port number depends on what you set above) to log into the Ubuntu VM (the username and password will be whatever you have defined during the earlier installation):


$ ssh -p 2220 stack@127.0.0.1


Since we are using NAT, we will have internet connections on this VM as long as the Mac Host machine is connected to the internet (note that we need internet connections in order to proceed with the installation).


3) I will be installing Juno release. Start by downloading DevStack to the Ubuntu VM:

$ sudo apt-get install git -y
$ git clone -b stable/juno https://git.openstack.org/openstack-dev/devstack
$ cd devstack

Create a local.conf file in the devstack folder
$ touch local.conf

Change the read/write permission of the file so that it can be accessed by the system
$ chmod 664 local.conf

Edit the local.conf file (see below for my configurations). You can make changes to the localrc file based on your needs. I have set 'stack' as my admin password and am installing most of the OpenStack projects, including trove. I have decided to use GRE Tunnel for my Neutron Networks (you can use other setting, e.g. VLAN or VXLAN).

[[local|localrc]]
ADMIN_PASSWORD=stack
SERVICE_TOKEN=$ADMIN_PASSWORD
MYSQL_PASSWORD=$ADMIN_PASSWORD
RABBIT_PASSWORD=$ADMIN_PASSWORD
SERVICE_PASSWORD=$ADMIN_PASSWORD

# Branch
GLANCE_BRANCH=stable/juno
HORIZON_BRANCH=stable/juno
KEYSTONE_BRANCH=stable/juno
NOVA_BRANCH=stable/juno
NEUTRON_BRANCH=stable/juno
HEAT_BRANCH=stable/juno
CEILOMETER_BRANCH=stable/juno
TROVE_BRANCH=stable/juno

# Services
ENABLED_SERVICES=rabbit,mysql,key
ENABLED_SERVICES+=,n-api,n-crt,n-obj,n-cpu,n-cond,n-sch,n-novnc,n-cauth 
ENABLED_SERVICES+=,s-proxy,s-object,s-container,s-account 
ENABLED_SERVICES+=,g-api,g-reg 
ENABLED_SERVICES+=,cinder,c-api,c-vol,c-sch,c-bak 
ENABLED_SERVICES+=,trove,tr-api,tr-tmgr,tr-cond
ENABLED_SERVICES+=,horizon

# Ceilometer
ENABLED_SERVICES+=,ceilometer-acompute,ceilometer-acentral,ceilometer-collector,ceilometer-api
ENABLED_SERVICES+=,ceilometer-alarm-notify,ceilometer-alarm-eval

# Heat
ENABLED_SERVICES+=,heat,h-api,h-api-cfn,h-api-cw,h-eng

# Neutron
DISABLED_SERVICES=n-net
ENABLED_SERVICES+=,q-svc,q-agt,q-dhcp,q-l3,q-meta,q-metering,neutron

# Neutron - Load Balancing
ENABLED_SERVICES+=,q-lbaas

# VLAN configuration
Q_PLUGIN=ml2
ENABLE_TENANT_VLANS=True

# GRE tunnel configuration
Q_PLUGIN=ml2
ENABLE_TENANT_TUNNELS=True
Q_ML2_TENANT_NETWORK_TYPE=gre

# Logging
LOGFILE=$DEST/logs/stack.sh.log
SCREEN_LOGDIR=$DEST/logs/screen
LOGDAYS=2

# Swift
SWIFT_HASH=66a3d6b56c1f479c8b4e70ab5c2000f5
SWIFT_REPLICAS=1 
SWIFT_DATA_DIR=$DEST/data

# Tempest
enable_service tempest


Run the following command to start the deployment of devstack (the script is located in the devstack folder):
$ ./stack.sh

The installation will take some time and when it is completed, you will see the IP address of the Horizon Dashboard (it is 10.0.2.15 in my case): 

        


4) In order to access the Horizon Dashboard and console of the VM, we will need to enable port-forwarding on port 80 (HTTP) and port 6080 (for VNC Console) for Adapter 1. I have mapped it to port 2221 and 6080 on my Mac Host Machine respectively.

                                     


Key in "http://localhost:2221" for your web browser (I am using Firefox; it will work for other browsers too, e.g. Google Chrome) to arrive at the Horizon login page. Log in using the credentials for demo user (the password will be 'stack' in my case):



Fill in the information for VM creation and click on the launch button (you can look at my 1st post if you have problems locating the "Launch Instance" button)



After the VM becomes active, click on "Actions" and you will see a drop-down list. Click on "Console".


We will see the "Instance Console" window. However, we will not be able to load the Console as it is port-forwarded to 6080 on our local host machine. We can open the link to the console in another tab with port forward to 6080.


The new tab will have the URL starting with "10.0.2.15:6080" (which is the Controller IP for my DevStack). We need to change this to "localhost:6080" instead. In this way, we will be able to access the console of the Test VM.


Cheers!


Other Related Posts:

Click here if you want to understand more about the OpenStack Tacker hands-on lab that my friend and I presented in the OpenStack Summit 2016 (Austin)  

Click here if you want to set up OpenStack (Juno) + OpenContrail (SDN) using Mirantis Fuel 6.1
Click here if you want to install OpenStack (Juno) using Mirantis Fuel 6.0

Click here if you want to install OpenStack Tacker (VNF) on DevStack
Click here if you want to spin Ubuntu VM and Preserve your DevStack environment
Click here if you want to create new networks, change security rules and/or assign floating IPs to VMs
Click here if you want to access VM using SSH Key Pairs
Click here if you want to manage project, user, role



13 comments:

subrat sahoo said...

Thanks ,
It works for me .Nicely explained.
I added following in local.conf file.

# Forcing devstack to use cirros-0.3.2-x86_64-uec image
DEFAULT_IMAGE_NAME="cirros-0.3.2-x86_64-uec.tar.gz"
IMAGE_URLS="http://download.cirros-cloud.net/0.3.2/cirros-0.3.2-x86_64-uec.tar.gz"

Uli!i!i!i!.. said...

Wonderful tutorial. I was able to install. One error I faced was regarding GIT and HTTPS connection for source.

I was able to login to GUI and make different things. After I reboot my VM and when I try to login to dashboard I am getting following problem. Can you please help.

ConnectionFailed at /project/

Connection to neutron failed: HTTPConnectionPool(host='10.0.2.15', port=9696): Max retries exceeded with url: //v2.0/extensions.json (Caused by : [Errno 111] Connection refused)

Request Method: GET
Request URL: http://127.0.0.1:2221/project/
...

Juncheng Anthony Lin said...

Hi,

I think the Dev Stack environment was not really meant to survive reboot (since it is really meant for development work and can be easily redeployed). I performed some steps in the past on an environment with Nova, Neutron, Cinder, Ceilometer and Cinder on it. The steps below did restore some of the OpenStack functionalities but certain parts of the environment, e.g. parts of neutron networking remained broken.

The steps are as follows:

1) Shut down the Virtual Machine with DevStack running on it

$ sudo init 0


2) Start up the machine in VirtualBox
3) Using the root user, make the following changes to the ownership of the following folders:

$ sudo -i
$ chown stack:stack /etc/ceilometer/
$ chown stack:stack /etc/neutron/
$ chown stack:stack /etc/nova/
$ chown stack:stack /etc/cinder/
$ chown stack:stack /etc/keystone/


4) As stack user, go into the devstack folder (this is the folder where the local.conf, stack.sh are stored)
5) Execute the rejoin-stack.sh

$ cd
$ cd devstack/
$ ./rejoin-stack.sh


You can try them and see if it works for you.

/Anthony

Uli!i!i!i!.. said...

Hi,

Thanks for reply. It is helping but partially. After these steps I can login but when I try to do some operations it is giving error.

If I run stack.sh again it is working good but all what I have done is gone.

Thanks

Juncheng Anthony Lin said...

Hi,

I think my latest post (see below link) might be useful for you (I wrote about how to preserve the DevStack environment using snapshot). You will need to scroll down on that article, the instructions is somewhere in the middle.

http://openstack-cloud-mylearning.blogspot.com/2016/02/openstack-how-to-createaccess-ubuntu-vm.html


Hope it helps.

/Anthony

Safarnama said...

IMAGE_URLS="http://download.cirros-cloud.net/0.3.2/cirros-0.3.2-x86_64-uec.tar.gz"
got an error in repository
log file attaching below
Compute consoles
================
()
()
nova-compute Guru Meditation Report
===================================
()
Skipping as nova-compute does not appear to be running
()
neutron-dhcp-agent Guru Meditation Report
=========================================
()
Skipping as neutron-dhcp-agent does not appear to be running
neutron-l3-agent Guru Meditation Report
=======================================
()
Skipping as neutron-l3-agent does not appear to be running
()
neutron-linuxbridge-agent Guru Meditation Report
================================================
()
Skipping as neutron-linuxbridge-agent does not appear to be running
()
neutron-metadata-agent Guru Meditation Report
=============================================
()
Skipping as neutron-metadata-agent does not appear to be running
()
neutron-openvswitch-agent Guru Meditation Report
================================================
()
Skipping as neutron-openvswitch-agent does not appear to be running


Juncheng Anthony Lin said...

Hi Deepak,

I did not get your message. Do you have a particular question that you want to ask?

As far as I can see, "http://download.cirros-cloud.net/0.3.2/cirros-0.3.2-x86_64-uec.tar.gz" is still a valid link.

/Anthony

Safarnama said...

I got an issue sir, Its not your falut / link fault its problem of private proxy network, who denied to download Image.

Anonymous said...

Great tutorial, thanks!

One issue I ran into: after logging into the dashboard from my laptop's web browser, it kept displaying error messages to the effect of "Cannot find this, cannot find that..." I ran the script "unstack", then ran the script "stack," and everything worked fine after that. I don't know what caused this, but it worked after I re-ran those scripts.

ICS Cyber Security said...

Being new to the blogging world I feel like there is still so much to learn. Your tips helped to clarify a few things for me as well as giving..


Openstack demo install

Unknown said...

Good Morning, my compliment for your tutorial very nice and concise.
When I create a nova instance with a flavor a get an Error :
No valid host was found. There are not enough hosts available
Code 500
Détails: <<
File "/opt/stack/nova/nova/conductor/manager.py", line 1113, in schedule_and_build_instances instance_uuids, return_alternates=True) File "/opt/stack/nova/nova/conductor/manager.py", line 715, in _schedule_instances return_alternates=return_alternates) File "/opt/stack/nova/nova/scheduler/utils.py", line 840, in wrapped return func(*args, **kwargs) File "/opt/stack/nova/nova/scheduler/client/__init__.py", line 53, in select_destinations instance_uuids, return_objects, return_alternates) File "/opt/stack/nova/nova/scheduler/client/__init__.py", line 37, in __run_method return getattr(self.instance, __name)(*args, **kwargs) File "/opt/stack/nova/nova/scheduler/client/query.py", line 42, in select_destinations instance_uuids, return_objects, return_alternates) File "/opt/stack/nova/nova/scheduler/rpcapi.py", line 158, in select_destinations return cctxt.call(ctxt, 'select_destinations', **msg_args) File "/usr/local/lib/python2.7/dist-packages/oslo_messaging/rpc/client.py", line 179, in call retry=self.retry) File "/usr/local/lib/python2.7/dist-packages/oslo_messaging/transport.py", line 133, in _send retry=retry) File "/usr/local/lib/python2.7/dist-packages/oslo_messaging/_drivers/amqpdriver.py", line 584, in send call_monitor_timeout, retry=retry) File "/usr/local/lib/python2.7/dist-packages/oslo_messaging/_drivers/amqpdriver.py", line 575, in _send raise result>>

Any help, will be very appreciated.
Thanks in advance
Francesco

Azure DevOps said...

Thank you for posting valuable information.
DevOps and Cloud Course Videos

MS Azure Training in Hyderabad said...

This concept is a good way to enhance the knowledge.thanks for sharing..
OpenStack Online Training
Openstack Training Course
Openstack Training in Hyderabad