In my previous post I wrote about installing the RDO OpenStack distribution in Ravello. Installing OpenStack in an on-demand, cloud-based infrastructure such as Amazon EC2 is ideal for development and test. It saves you from having to deal with hardware, and you pay only for what you use. However, when installing OpenStack in the cloud, you will run into the following issues:
- Virtual machines in none of the major IaaS clouds of today have Intel VT. This means that your guests will typically run using QEmu’s TCG mode, which is very slow.
- Network access is limited to a subset of IPv4, making things like VLANs, VXLAN or GRE impossible.
Both shortcomings are addressed by Ravello. We support both Intel VT (actually the AMD variant called SVM), making nested guests very fast. And we also support full layer-2 network access, allowing you to set up fancy networking configurations.
In the previous blog post, I manually set up the 4 VMs on which I installed RDO. This was a time consuming exercise, and so it’s time to automate that! In this post I will create a 2-node environment, on which I will install DevStack on top of Ubuntu 14.04 “Trusty Tahr”. We will then run this environment through the Ravello Service on Amazon EC2.
Please note that the nested SVM feature used in this blog is currently experimental. It is made available to our customer as a beta, and we only provide best-efforts support for it.
Creating the Virtual Bare-Metal
Let’s get straight into it. The first step in creating our OpenStack infrastructure (sometimes called the “undercloud”) is to download and install the Ravello SDK. If you have “pip” installed on your system, you can simply do:
sudo pip install ravello-sdk
This will install the Ravello Python SDK, and also a script called “ravello-create-nodes”. Using this script we create our “virtual bare metal” nodes, like this:
ravello-create-nodes --flavor ubuntu --memory 6144 --cpus 2 \ --network 192.168.0.0/24 --default-user stack --svm \ --service http --service 6080 -user <username> \ --keypair <keyname> --public-ip 2
A few notes:
- The <username> argument is your Ravello user ID (we offer a 2 week free trial). To prevent the script from prompting for a password, you can set the $RAVELLO_PASSWORD environment variable.
- You will need to upload the Ubuntu “Trusty Tahr” cloud image into your account in Ravello (we are working on a way to have shared images but it’s not there yet). The image can be downloaded here, and to upload it into Ravello you need to download our image uploader utility as described here.
- You need to create a keypair so that you can access the VMs. This can be done in the Ravello Web UI. Navigate to Library, Key Pairs, and then “Create Key Pair”. The name of the keypair you create should be passed as the argument to –keypair.
- You can watch progress in the Ravello UI. The VMs will run in a new application called something like “Cloud-XX” and will be named “VM-0″ and “VM-1″. The VMs will reboot once to bring up the static IPs correctly. If you’re watching progress from the VNC console, please wait for the VM to reboot once.
After about 5 minutes you will have 2 VMs that can run KVM, and that are connected by a private L2 network!
Installing DevStack Controller
The first thing to do is to get the IP address and port number of the first VM (VM-0) from the Ravello web UI. To do this, select the VM and note its IP address from the blue pane at the bottom right of the screen. Then open up an ssh session to this VM:
ssh -i <path-to-keypair> stack@<ipaddr>
Here, <path-to-keypair> is the path to the private key of the keypair you created in the Ravello UI.
When logged onto this VM, use these commands to download DevStack:
sudo apt-get install -y git git clone https://github.com/openstack-dev/devstack cd devstack
Now we create a configuration and kick off the installer (note that you might want to change the passwords below):
cat >local.conf <<EOM [[local|localrc]] HOST_IP=192.168.0.10 FLAT_INTERFACE=eth0 FIXED_RANGE=10.0.0.0/20 FIXED_NETWORK_SIZE=4096 FLOATING_RANGE=192.168.0.128/25 MULTI_HOST=1 LOGFILE=/opt/stack/logs/stack.sh.log ADMIN_PASSWORD=labstack MYSQL_PASSWORD=supersecret RABBIT_PASSWORD=supersecret SERVICE_PASSWORD=supersecret SERVICE_TOKEN=lazydog EOM ./stack.sh
After some time, we’ll have our first node running. It’s already functional, as DevStack installed a nova-compute agent on this VM itself as well. To use the Horizon dashboard locate the “http” service on VM-0 and click the “Go” link. The Horizon dashboard should open. The username is “admin” and the password is the $ADMIN_PASSWORD specified in local.conf above.
You’ll see that you’ll be able to deploy an instance, and it won’t take ages for it to boot because it’s running directly on the CPU using KVM!
Adding a second Compute Node
Let’s add a compute node. Locate the ip and port number for VM1 through the Ravello UI, and ssh to it. Note that unlike VM-0, secure shell on VM-1 will not run on port 22. This is because by default VM-1 is configured to use port mapping instead of a public IP. When connecting to the node via ssh, be sure to add the “-p <port>” argument.
When logged on to VM-1, clone DevStack again from Github and change to its directory. This time we’ll use the following configuration:
cat >local.conf <<EOM [[local|localrc]] HOST_IP=192.168.0.11 FLAT_INTERFACE=eth0 FIXED_RANGE=10.0.0.0/20 FIXED_NETWORK_SIZE=4096 FLOATING_RANGE=192.168.0.128/25 MULTI_HOST=1 LOGFILE=/opt/stack/logs/stack.sh.log ADMIN_PASSWORD=labstack MYSQL_PASSWORD=supersecret RABBIT_PASSWORD=supersecret SERVICE_PASSWORD=supersecret SERVICE_TOKEN=lazydog DATABASE_TYPE=mysql SERVICE_HOST=192.168.0.10 MYSQL_HOST=192.168.0.10 RABBIT_HOST=192.168.0.10 GLANCE_HOSTPORT=192.168.0.10:9292 ENABLED_SERVICES=n-cpu,n-net,n-api,c-sch,c-api,c-vol EOM ./stack.sh
When this is done, you can go to the Horizon dashboard again, and you will see a second hypervisor present.
Our DevStack installation is now ready to launch instances. You can do this through the Horizon dashboard, under Project -> Instances. A few notes:
- The nodes were created with 6GB of memory, of which at least 2GB will used by OpenStack itself. You should be able to launch one “m1.small” instance which has 2GB of RAM. Two of these instances would be tight.
- The VNC console will not work right of out of the box. The link that is generated for the VNC console will refer to the internal IP of the controller node rather than the external IP. To fix this, copy/paste the link and manually insert the correct IP, or change the “novncproxy_base_url” setting in “/etc/nova/nova.conf” on both nodes and then restart nova.
Summary and Next Steps
In this post I’ve demonstrated how to use our “ravello-create-nodes” script to set up a complete OpenStack environment very quickly. In the next couple of weeks, we’ll continue making it easier to install dev/test instances of OpenStack. One thing that we’re working on is an Ironic driver for Ravello!Virtual Bare Metal: DevStack Multi Node on EC2