Mindmajix

Creating a sandbox Compute server with VirtualBox and Vagrant

Create a Sandbox Compute Server

Creating a sandbox server for running the OpenStack Compute services is very easy using VirtualBox and Vagrant. It allows us to discover and experiment with the OpenStack services.

VirtualBox gives us the ability to spin up virtual machines and networks without affecting the rest of our working environment and is freely available for Windows, Mac OSX, and Linux. Vagrant allows us to automate this task, meaning we can spend less time creating our test environments and more time using OpenStack. A Vagrant is installable using Ubuntu’s package management. This test environment is being used for the rest of this section.

It is assumed that the computer you will be using to run your test environment in has enough processing power that includes hardware virtualization support (modern AMDs and Intel IX processors) with at least 8 GB RAM. Remember, we’re creating a virtual machine that itself will be used to spin up other virtual machines, so the more RAM you have, the better it would be.

Getting started

To begin with, ensure that VirtualBox and Vagrant are installed and networking is set up as described in Previous Post, Keystone OpenStack Identity Service.

How to achieve it…

To create our sandbox server for running OpenStack Compute within VirtualBox, we will use Vagrant to define a second virtual machine that allows us to run OpenStack Cloud instances. This virtual machine, that we will refer to as the OpenStack Compute node, will be configured with at least 3 GB RAM, 2 CPUs, and 20 GB of hard drive space, and has three network interfaces. The first will be a NAT interface that allows our virtual machine to connect to the network outside of VirtualBox to download packages, the second interface which is the public interface of our OpenStack Compute host, and the third interface will be in our private network that OpenStack Compute uses for internal communication between different OpenStack Compute hosts.

Carry out the following steps to create the virtual machine with Vagrant that will be used to run OpenStack Compute services:

1. Execute the steps mentioned in the ‘Creating a sandbox environment’ with a VirtualBox recipe of Previous Post, Keystone OpenStack Identity Service.

2. We are now editing the Vagrant file we have been working with, it looks like the following to add in our compute node:

  • -*- mode: ruby -*-
  • vi: set ft=ruby :
nodes = { => [1, 200],  
‘controller’  
‘compute’  => [1, 201],  
}    

Vagrant.configure(“2”) do |config| config.vm.box = “precise64” config.vm.box_url

=”http://files.vagrantup.com/precise64.box”

nodes.each do |prefix, (count, ip_start)| count.times do |i|

hostname = “%s” % [prefix, (i+1)]

config.vm.define “#{hostname}” do |box| box.vm.hostname = “#{hostname}.book” box.vm.network :private_network, ip:

“172.16.0.#{ip_start+i}”, :netmask => “255.255.0.0”

box.vm.network :private_network, ip: “10.10.0.#{ip_start+i}”, :netmask =>

“255.255.0.0”

# If using VirtualBox

box.vm.provider :virtualbox do |vbox| vbox.customize [“modifyvm”, :id,

“–memory”, 1024]

if prefix == “compute”

vbox.customize [“modifyvm”, :id, “–memory”, 3172]

vbox.customize [“modifyvm”, :id, “–cpus”, 2]

end

end

end

end

end

end

3. We are now ready to power on our compute node. We do this by simply running the following command:

vagrant up compute

Note

Congratulations! We have successfully created the VirtualBox virtual machine running Ubuntu 12.04, which is able to run OpenStack Compute.

How it works…

What we have done here is created a virtual machine within VirtualBox by defining it in Vagrant. Vagrant then configures this virtual machine, based on the settings given in the Vagrant file in the directory where we want to store and run our VirtualBox virtual machines from. This file is based on Ruby syntax, but the lines are relatively self-explanatory. We have specified the following:

The hostname is called to compute

The VM is based on Precise64, an alias for Ubuntu 12.04 LTS 64-Bit. We have specified 3GB Ram and two CPUs.

We then launch this VirtualBox VM using Vagrant with the help of the following simple command:

vagrant up compute

Still more…

There are a number of virtualization products available that are suitable for trying OpenStack, for example, VMware Server, VMware Player, and VMware Fusion etc.

Enroll for Live Instructor Led OpenStack Training


0 Responses on Creating a sandbox Compute server with VirtualBox and Vagrant"

Leave a Message

Your email address will not be published. Required fields are marked *

Copy Rights Reserved © Mindmajix.com All rights reserved. Disclaimer.
Course Adviser

Fill your details, course adviser will reach you.