Thursday, February 18, 2016

OpenStack - How to Create/Access Ubuntu VM with SSH Keys and Preserve DevStack Environment



I will use the DevStack environment that I created recently for this post (see my earlier post on how to built this particular environment).  The first step that we need to do will be to download a working Ubuntu image. I usually go to this link to get the latest image.  You should see a section for the official Ubuntu images.  Note that we will want to use the qcow2 format in this case.  

Click on the link to download the Ubuntu 14.04 image (highlighted in yellow below).  It might take a while to download, depending on the speed of your internet connection.



After the image is downloaded to your local machine, go to the "Images" tab under "Project".  We will see the Cirros images that come with the DevStack installation.




Click on the "Create Image" button and we will see a "Create An Image" form.  You will need to give your image a name.  You will also have to set "Image Source" to be "Image File" and select the Ubuntu qcow2 file that was downloaded earlier from your local laptop.  Select the Format as "QCOW2 - QEMU Emulator" and leave the rest as default for now.  Next, click on the "Create Image" button at bottom right of the form to upload the image.




You will see the Ubuntu image upon successful upload.  One thing that you will notice is that this image is only visible to the demo project as we did not select the "Public" check-box (as seen in the above screen shot) when we created that image.  You can make it visible to all tenants if you make it a public image, i.e. if you select the "Public" check-box. 




Next, we will need to create SSH key pairs in order to access the Ubuntu VM that we will be creating.  Go to the "Access & Security" tab and click on "Import Key Pair". 



As you might have noticed, there are instructions on how to generate key pairs if you do not have one.  We can do the following (just hit enter for the prompts, i.e. do not set passphrase):




You will get the private and public key after that.  Copy the content of id_rsa.pub and paste it in the "Public Key" box. Click "Import Key Pair" after that.




We will see the newly imported key after that




Once that is done, go back to the "Instances" tab




Click on the "Launch Instance" and you will see a "Launch Instance" form.  Fill in the Instance Name, select "m1.small" as the Flavor and select the Ubuntu image that was uploaded earlier.




On the "Access & Security" tab, select "Key1" as the Key Pair



On the "Networking" tab, select the "Management Network".  Click on the "Launch" button after that to create the Ubuntu VM.



The Ubuntu VM will take a while to become "Active" if you are building it for the first time.  Check the console of the Ubuntu VM to make sure that it reaches the login prompt (refer to earlier post on how to access VM console if you need guidance).  Note that the Ubuntu VM will take a while to reach the login prompt. 




Next, we will use the SSH key to log into the VM as ubuntu user via the Management Network



Preserving Current State of DevStack Environment (VirtualBox)


In many cases we would like to keep our environment intact and preserve our work.  I have tried several methods and the one that seems to work best is to create a snapshot of the DevStack VM.  

As you can see below, I saved a snapshot of my DevStack VM after initial installation and named it as "DevStack-Working-State".  Now that I have successfully uploaded Ubuntu Image and created an Ubuntu VM, I would like to be able to resume my work at a later stage.  I want to be able to continue my work even if I shut down Virtualbox or my laptop.


The way to achieve that will be to create a new snapshot of the current DevStack VM state



We will click on the "Take Snapshot" button and give a name to the snapshot




You will see the new snapshot if everything is goes well


To make sure that things are working as expected, we will send a signal to shut down the current DevStack VM (right click on the VM and select ACPI Shutdown). Wait for DevStack VM to fully shut down.




Next, we will restore the DevStack image with the running Ubuntu VM. Remember to unselect the checkbox for "Create a snapshot of the current machine state" as we do not want the shutdown state of the DevStack machine to be saved.





Click the "Start" button to start the DevStack VM




Check that the DevStack VM has been successfully restored and log back into the Horizon Dashboard.  You will see that the Ubuntu VM remains active and pingable from the DevStack VM.







I hope that this post helped those (like me) who were thinking of ways to save their work in DevStack =)





Tuesday, February 16, 2016

DevStack - OpenStack Tacker


It has been nearly a year since my last post.  A lot of things have changed in the OpenStack realm, i.e. Kilo, Liberty and in the near future, Mitaka.  I have been very busy with OpenStack roll-out with Tier 1 Telco Operator and did not manage to find time to post new material for the past 11 months (I did try and answer questions posted on my blog though).  It has been a fun and rewarding experience working with, and learning from the OpenStack experts. Now that things are less hectic, I am starting to look at some of the new stuff.  It is really amazing how things have progressed over the past year with all the cool stuff.  One of the interesting OpenStack projects that I came across recently is Tacker and I am going to walk you through the installation steps in this post (note that the configurations are mainly derived from those provided in https://wiki.openstack.org/wiki/Tacker/Installation).

As described in the Wiki, Tacker is based on ETSI MANO Architectural Framework and provides full functional stack to Orchestrate Virtual Network Functions (VNFs) on an NFV Platform (End-to-End).

We will still make use of the steps from my earlier post to create the DevStack VM using VirtualBox

This time round we will use the Master Branch instead of Stable branch as we want to use the latest code for Tacker.  As seen in my earlier post, the IP address of the eth0 interface of my DevStack VM is 10.0.2.15.  This will be the value of the HOST_IP in our local.conf file.  I have also added the Murano Plugins as I have been working on it in recent days.  As always, you can make changes to your local.conf based on your needs and preference.

[[local|localrc]]
############################################################
# Customize the following HOST_IP based on your installation
############################################################
HOST_IP=10.0.2.15

ADMIN_PASSWORD=devstack
MYSQL_PASSWORD=devstack
RABBIT_PASSWORD=devstack
SERVICE_PASSWORD=$ADMIN_PASSWORD
SERVICE_TOKEN=devstack

############################################################
# Customize the following section based on your installation
############################################################

# Pip
PIP_USE_MIRRORS=False
USE_GET_PIP=1

#OFFLINE=False
#RECLONE=True

# Logging
LOGFILE=$DEST/logs/stack.sh.log
SCREEN_LOGDIR=$DEST/logs/screen
VERBOSE=True
ENABLE_DEBUG_LOG_LEVEL=True
ENABLE_VERBOSE_LOG_LEVEL=True

# Neutron ML2 with OpenVSwitch

Q_PLUGIN=ml2
Q_AGENT=openvswitch

#PUBLIC NETWORK CONFIGURATION
Q_USE_PROVIDERNET_FOR_PUBLIC=False
FLOATING_RANGE=192.168.56.0/24
Q_FLOATING_ALLOCATION_POOL="start=192.168.56.150,end=192.168.56.201"
PUBLIC_NETWORK_NAME=external
PUBLIC_NETWORK_GATEWAY=192.168.56.11
PUBLIC_PHYSICAL_NETWORK=public

# Required for l3-agent to connect to external-network-bridge
PUBLIC_BRIDGE=br-ext

#PRIVATE NETWORK CONFIGURATION

NETWORK_GATEWAY=${NETWORK_GATEWAY:-15.0.0.1}
FIXED_RANGE=${FIXED_RANGE:-15.0.0.0/24}

enable_plugin tacker https://git.openstack.org/openstack/tacker master

enable_plugin murano git://git.openstack.org/openstack/murano

enable_service n-novnc
enable_service n-cauth
disable_service tempest


Run the following command to start the deployment of devstack and the system should be up and running after some time (the script is located in the devstack folder): 

$ ./stack.sh 


Using the same steps from my earlier post, we will be able to access the Horizon Dashboard (on localhost port 2221) with the demo user (password is 'devstack' in this case)

You will see the "NFV Management" tab in the Horizon Dashboard



To prove that things are actually working, we can make use of one of the sample templates to create multiple VDU (Virtualization Deployment Unit) - VDU is a subset of a VNF and can be mapped to a single VM 

Save the content of the sample template as sample-vnfd-multi-vdu.yaml. After that, go to the "VNF Catalog" tab, click on the "Onboard VNF" button and select the yaml file from your local machine.



You will see a newly created catalog upon successful onboarding



Next, proceed to the "VNF Manager" Tab and click on the "Deploy VNF" button to deploy a new VNF with the Catalog



The VNF will become "Active" if everything goes well (note that this sample template creates 3 VMs - my laptop is quite powerful and has enough resources for that.  You can always reduce the number of VMs created by editing the yaml file)



You can see the 3 VMs if you log in as the admin user (same 'devstack' password, look under System -> Instances tab as shown below)


As mentioned in my earlier post, you can access the console of the VMs by doing port-forwarding on port 6080



Although this is just a simple example with Cirros image, we can see that Tacker can offer much more if we make use of its potential =)


Related Post

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