Hello Friends, today we will discuss how to create virtual machines (known as “instances” in openstack terminology) using Horizon Dashboard. We tested these steps on openstack Liberty and Kilo release. All these steps can be done via command line too, but we will cover command line instructions in another article. Openstack is the most convient way to quickly setup a production ready cloud infrastructure, all you need is a pool of hardware to act as storage , compute and network devices and simple installation of openstack can manage it to take your productivity to the highest level.
Without wasting much time, lets get straight to the point of discussion, here are five steps to be performed in order to setup/create/add virtual machines in openstack.
1. Add cloud image to Glance
2. Add internal Network
3. Add external Network
4. Setup a new Router and add both internal and external network to it
5. Boot virtual machines
Lets review each of the above mentioned steps in details with proper screenshots for easier understanding.
1. Add Cloud Image to Glance
Glance is the image service for openstack. In order to boot and use virtual machines in openstack, we need to upload images/ISO for the operating systems to openstack Glance service. For example, if you want to use CentOS operating system for your instances/virtual machines, you need to upload CentOS cloud image/ISO to Glance first. Once done, it will be available for use. Cloud images for all popular operating systems can be found easily from the internet. For the demonstration purpose, we will use Cirros OS image here. For those unaware of Cirros, it is a tiny Linux distribution used solely for testing purposes only. It’s hardly around 20 MB in size.
Please login your openstack setup’s horizon dashboard and browse to Project > Compute > Images and click “Create Image” option from here. Following screen will be loaded, from here you can upload image/ISO of your choice to the Glance service.
Specify image name, description, in image location type the URL for the online location from where cloud image is hosted (in case of cirros, we used http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img) , and in image format, choose the correct type of the image, if you are using .iso file, then choose “ISO” here, if you are using .img file then use “QCOW2″ here and for images of other extensions, you will be able to find appropriate format type in the drop down menu.
Click “Create Image”option at the bottom of this window and your cloud image will be uploaded to the Glance service now and should be available for use for your new virtual machines.
2. Add Internal Network
Once the image has been uploaded to Glance, next step is to create internal network for the private communication between virtual machines. Browse to Compute >> Network >> Network option and click on “Create Network” to add a new internal network. Here is the very first screen you should see; specify network name here and click “Next”.
On the next step, specify the subnet of your choice and gateway IP to be used by virtual machines for internal communication. Click “Next” once done.
Specify IP address allocation pool on this step (all virtual machines will get internal IP address from the range specified here). You can specify DNS resolver IPs here too.
3. Add External Network
Since we have added an internal network, so our instances will be able to communicate with each other fine but so far they will not be able to communicate with outside world. We need to add external network in our openstack project so that our instances/virtual machines may use this external network to send traffic out and receive traffic from internet. Please make sure that your ISP/Data center provider /Network provider has given you IP ranges for your external network along with gateway IP address. Once you know this information, click Project > System > Network option from your horizon dashboard and click “Create Network” option from here. Here specify you network name, in network type drop down option, you can choose “GRE”, “FLAT” or “VLAN” for networks providing external connectivity and segmentation ID should be a unique value with respect to GRE, VLAN or Flat network you selected above. In order to understand the different between these three type of networks, we recommend reading openstack official forum. Make sure to tick “External Network” check box here.
Anyways, once you are done with these setting, click “Create Network” , congratulations, external network is added now. We need to add subnet to this network now. Click the external network name in the network lists and click “create subnet” option. Here is the pop up window, specify your external network’s IP address ranges and gateway IP.
Click “Next” and specify the IP address allocation pool here, make sure that this Pool falls into the same range as you defined in the above screen and is actually available IP range for your use. You can also specify DNS resolver IPs for your network here.
Click “Create” and your external network has been added to the list of the available external networks now. Good job so far, we are almost there !
4. Add Router
This is second last step, we will add a Router to be used as communication point between virtual machines and the outside internet world. Browse to Project > Network > Router and click “Create Router” from here. Specify router name, and choose the external network we added earlier from drop down option.
Click “Create Router” and router has been added successfully now. You should be able to see it in the router’s list, we need to add internal network to this router as well so that both private and public communication of instances should work fine. Click the router name and go to the “interface” tab, from here click “Add interface” button. Here simply choose your internal network’s subnet and hit “Add interface” to add our internal network to the router.
5. Create Virtual Machines/Instances
Browse to Project > Compute> Instances and click “Launch Instances” option to create a new virtual machine. Here is the very first screen you should see, here specify your instance name, and under “Instance Boot Source” option, choose “Boot from image” and under “Image Name” drop down choose the cirros image we uploaded in the very first step of this article.
Click “Launch” and it will take you to the network selection window, here choose both internal and external networks we created and hit “Launch”.
That’s it, it should take less than a minute and launch your instance/virtual machine. It will also display both internal and external IP address for the virtual machine once launch process is complete.
Congratulations! Your openstack setup is successfully provisioning instances now. All of the above mentioned steps can be done via command line too but it requires certain level of system administration experience, we will later cover the command line process for creating instances as well.
Hope you find this article useful and intersting, openstack is being considered the future of cloud computing and many renowned organizations like NASA, Rackspace, AT&T, Softlayer, HP, IBM are empowering their cloud setups with Openstack. Its good time to learn and expertise in Openstack. We will continue writing detailed articles on different technical aspects of Openstack, stay tuned!