A Virtual Machine in an OpenStack Cloud

Installation of OpenStack using packstack is very simple. After a test installation in a virtual machine, you will find that the basic operations for creating and using virtual machines is now quite simple using a web interface.

The Environment

It is important to understand the virtual environment. While everything is running on a desktop, the setup consists of multiple logical networks interconnected via virtual routers and switches. You need to make sure that the routes are defined properly because otherwise you will not be able to access the virtual machines you create.

On the desktop, the virt-manager creates a NAT based network by default. NAT assures that if your desktop can access the internet, so can the virtual machine. The internet access had been used when the OpenStack distribution was installed in the virtual machine.

The packstack installation process creates a virtual public network for use by the various networks created within the cloud environment. The virtual machine on which openstack is installed is the gateway to the physical network.

Virtual Network on the Desktop (virbr0 interface) : 192.168.122.0/32

IP address of eth0 interface on OpenStack VM : 192.168.122.54

Public Virtual Network created by packstack on OpenStack VM: 172.24.4.224/28

IP address of the br-ex interface OpenStack VM: 172.24.4.225


Testing the Environment

In the OpenStack VM console, verify the network addresses. In my case, I had to explicitly give an ip to br-ex interface,

# ifconfig

# ip addr add 172.24.4.225/28 dev br-ex

On the desktop, add a route to the public virtual network on OpenStack VM

# route add -net 172.24.4.224 netmask 255.255.255.240 gw 192.168.122.54

Now, browse http://192.168.122.54/dashboard and create a new project and a user associated with the project.

  1. Sign in as admin.

  2. Under Identity panel - Create a user (youser) and a project (Bigdata)

Sign out and sign in as youser to create and test a cloud VM.

  1. Create a private network for the project under Project/Network/Networks

    1. Create Private network, 192.168.10.0/24 with gateway 192.168.10.254

    2. Create a Router and set gateway to the public network.

      1. Add an interface to the Private network and ip address 192.168.10.254.

  2. To be able to sign in using ssh, under the Project/Compute/Access & Security, in the Security Groups tab, add the following rules to the default security group.

    1. Allow ssh access: Custom TCP Rule with Port 22

    2. Allow icmp access: Custom ICMP Rule with Type and Code value -1.

  3. For password-less signing into the VM, under the Project/Compute/Access & Security, in the Key Pairs tab

    1. Select Import Key Pair option and give it a name, e.g. desktop user login.

    2. In your desktop terminal window, use ssh-keygen to create a public/private key pair in case you don't already have one

    3. Copy contents of ~/.ssh/id_rsa.pub from your desktop account and paste them in public key

  4. Allocate a public IP for accessing the VM under the Project/Compute/Access & Security, in the Floating Ips tab, allocate IP to project. You may get a value like 172.24.4.229

  5. Now launch the instance under Project/Compute/Instance:

    1. Give it a name – test and choose the m1-tiny flavor.

    2. Select boot source as 'Boot from image' with image name 'cirros', a very small image included in the installation.

    3. Once it is launched, associate the floating ip obtained above with this instance.

Now, you are ready to login in to the VM created in your local cloud. In a terminal window:

  1. ssh cirros@172.24.4.229

  2. you should be signed into the virtual machine without needing a password.

You can experiment with importing the Fedora VM image you used for the OpenStack VM and launching it in the cloud. Whether you succeed will depend on the resources available in the OpenStack VM.

Installing only the needed OpenStack services

You would have observed that OpenStack comes with a very wide range of services. Some of which are not likely to be very useful for your experiments on the desktop, e.g. the additional networks and router created in the tests above. Here is a part of the dialog for installing the needed services on the desktop:

[root@amd ~]# packstack

Welcome to Installer setup utility

Enter the path to your ssh Public key to install on servers:

Packstack changed given value to required value /root/.ssh/id_rsa.pub

Should Packstack install MySQL DB [y|n] [y] : y

Should Packstack install OpenStack Image Service (Glance) [y|n] [y] : y

Should Packstack install OpenStack Block Storage (Cinder) service [y|n] [y] : n

Should Packstack install OpenStack Compute (Nova) service [y|n] [y] : y

Should Packstack install OpenStack Networking (Neutron) service [y|n] [y] : n

Should Packstack install OpenStack Dashboard (Horizon) [y|n] [y] : y

Should Packstack install OpenStack Object Storage (Swift) [y|n] [y] : n

Should Packstack install OpenStack Metering (Ceilometer) [y|n] [y] : n

Should Packstack install OpenStack Orchestration (Heat) [y|n] [n] : n

Should Packstack install OpenStack client tools [y|n] [y] : y

...

The answers to the other questions will depend on the network interface and the IP address of your desktop but there is no ambiguity in it. You should answer with the interface 'lo' for CONFIG_NOVA_COMPUTE_PRIVIF and CONFIG_NOVA_NETWORK_PRIVIF. You don't need an extra physical interface as the compute services are running on the same server.

Now, you are ready to test your openstack installation on the desktop. You may want to create a project and add a user to the project. Under Project/Compute/Access & Security, you will need to add firewall rules and key pairs as above.

However, you will not need to create any additional private network or a router.

Import a basic cloud image, e.g. from http://fedoraproject.org/get-fedora#clouds, under Project/Compute/Images.

You may want to create an additional flavor for a virtual machine between the m1.tiny and the m1.small, say, m1.mini with 1GB RAM and 10GB disk. This will need to be done as the admin user.

Now, you can create an instance of the basic cloud image. The default user is fedora and your setup is ready for exploration of hadoop data.

Comments