[OpenStack Beginner’s Guide for Ubuntu 11.04] – Instance Management
Instance management
An instance is a virtual machine provisioned by OpenStack on one of the nova-compute servers. When you launch an instance, a series of steps are triggered on various components of the OpenStack. During the life cycles of an instance, it moves through various stages as shown in the diagram below:
There are four interfaces that can be used for managing instances in nova.
- Firefox with Hybridfox Plugin
- Command line tools like euca2ools
- Openstack Dashboard
- Custom applications developed using EC2 APIs
Hybridfox
Elasticfox is an open source Mozilla Firefox extension that works on Firefox Version 2.0 or later to help you with managing AWS compute and associated resources – Launch new instances, mount Elastic Block Storage volumes, map Elastic IP addresses, and more. This was originally written for EC2, but, since version xxx.xxx, it has become possible to use to manage resources from other cloud platforms that are API compatible with EC2 as well, particularly Eucalyptus.
Hybridfox is a fork from Elasticfox to make it usable with Eucalyptus, when Elasticfox worked only with AWS. The aim of Hybridfox was to be usable as the single interface to AWS and Eucalyptus as well as other cloud platforms API compatible with AWS. Recent versions of Hybridfox have been quick to add support for newer features from AWS such as handling streaming media etc.
Features
- List available Machine images (AMI)
- List running instances
- Launch new instances of an AMI
- Manage security groups and rules
- Manage Snapshots/EBS volumes
Installation
You can install the extension from http://code.google.com/p/hybridfox/downloads/list. The latest version (at the time of writing) is hybridfox-1.6.000040.xpi.
Configuration
Define a Region
Click on Regions button
- Enter a logical name for the region (Example: “Eucalyptus” , “MyEucalyptus” etc.)
- Enter the value of EC2_URL from your eucarc file as the Endpoint URL(http://192.168.10.121:8773/services/Eucalyptus in our sample setup)
Define Credentials
- Click on Credentials button
- Enter a logical name for the credential set (Example: “EucaAcc1″ etc.)
- Enter EC2_ACCESS_KEY and EC2_SECRET_KEY from your eucarc file as the AWS Access Key and AWS Secret Access Key respectively
Define Key Pairs
- Click on KeyPairs tab
- Click on “Create a ney keypair” icon
- Enter a name for the key pair (Example: “eucakey” etc.)
- Choose location on the client machine to save the id file to (You will need this to use with putty etc. to make an SSH connection)
Define Security Groups
- Click on SecurityGroups tab
- Enter a name for the group (Example: “Eucalyptus”, “EucaGroup” etc.)
- Enter the description and click on create button
You will have an option to specify some basic ports like SSH/RDP to be opened up while creating the group itself. After the group is created, you can add rules any time by choosing the security group in the left pane titled “Your groups” and adding rules in the right pane titled “Group Permissions”
Euca2ools-Command Line Tools
Euca2ools from Eucalyptus provide a bunch of command line tools to manage the eucalyptus setup. These commands help you manage images, instances, storage, networking etc. A few commands related to managing the instances are given below.
For a complete list of commands, see Appendix.
Installation
sudo apt-get install euca2ools
Creation of Key Pairs
Openstack expects the client tools to use 2 kinds of credentials. One set of credentials are called Access Key and Secret Key that all clients would need to use to make any requests to the Cloud Controller. Each user registered on the web interface has this set created for him. You can download it from the web interface as mentioned in the chapter on “Web Interface”.
You will also need to generate a keypair consisting of private key/public key to be able to launch instances on Eucalyptus. These keys are injected into the instances to make passwordless SSH access to the instance possible. This depends on the way the necessary tools are bundled into the images. Please refer to the chapter on Image Management for more details.
Keypairs can also be generated using the following commands.
cd ~/creds euca-add-keypair mykey > mykey.priv chmod 600 mykey.priv
This creates a new keypair called mykey. The private key mykey.priv is saved locally which can be used to connect to an instance launched with mykey as the keypair. euca-describe-keypairs command to list the available keypairs. The output should like this:
uecadmin@client1:~$ euca-describe-keypairs KEYPAIR mykey f7:ac:8e:f5:05:19:2b:31:28:8c:9b:d7:b8:07:0c:3c:b6:34:8f:79 KEYPAIR helloworld 12:96:b3:21:34:8d:6a:3f:92:2e:2b:70:23:ff:7f:51:b5:b7:ad:37 KEYPAIR ubuntu f6:af:9a:59:65:35:32:c4:3a:c4:62:0e:e1:44:0f:71:29:03:2d:91 KEYPAIR lucid 74:04:70:33:ed:57:7a:30:36:1f:ca:c6:ec:d5:4f:10:34:1a:52:51 KEYPAIR karmic 01:f9:aa:5f:4d:20:e2:53:d1:29:d0:0f:e2:f3:8c:21:91:70:7e:c8
To delete an existing keypair:
euca-delete-keypair helloworld
The above tasks can be achieved using Hybridfox from the “Keypairs” tab.
Launch and manage instances
There are several commands that help in managing the instances. Here are a few examples:
$ euca-run-instances emi-721D0EBA -k mykey -t c1.medium RESERVATION r-55560977 admin admin-default INSTANCE i-50630A2A emi-721D0EBA 0.0.0.0 0.0.0.0 pending mykey 2010-05-07T07:17:48.23Z eki-675412F5 eri-A1E113E0 $ euca-describe-instances RESERVATION r-55560977 admin default INSTANCE i-50630A2A emi-721D0EBA 192.168.3.130 192.168.3.130 running mykey 0 c1.medium 2010-05-07T07:17:48.23Z myueccluster eki-675412F5 eri-A1E113E0 $ euca-reboot-instances i-50630A2A $ euca-terminate-instances i-50630A2A $ euca-run-instances ami-XXXXXXXX -k mykey $ euca-get-console-output i-50630A2A i-50630A2A 2010-05-07T07:22:40.795Z [ 0.000000] Initializing cgroup subsys cpuset [ 0.000000] Initializing cgroup subsys cpu [ 0.000000] Linux version 2.6.32-21-server (buildd@yellow) (gcc version 4. 4.3 (Ubuntu 4.4.3-4ubuntu5) ) #32-Ubuntu SMP Fri Apr 16 09:17:34 UTC 2010 (Ub untu 2.6.32-21.32-server 2.6.32.11+drm33.2) [ 0.000000] Command line: root=/dev/sda1 console=ttyS0 [ 0.000000] KERNEL supported cpus: [ 0.000000] Intel GenuineIntel [ 0.000000] AMD AuthenticAMD [ 0.000000] Centaur CentaurHauls [ 0.000000] BIOS-provided physical RAM map: [ 0.000000] BIOS-e820: 0000000000000000 - 000000000009f000 (usable) [ 0.000000] BIOS-e820: 000000000009f000 - 00000000000a0000 (reserved) .............
You can make password less ssh access to the instance as follows:
ssh -i mykey.priv user@192.168.3.130
Make sure that you launch the instance with the correct VM type. If it is launched with a smaller VM type, then the following error is encountered.
error: insufficient disk capacity remaining
By default, m1.small is the VM type that is used which comes with a 2GB Hard Disk. So if you have a disk image of size 5GB, instead of
euca-run-instances ami-XXXXXXXX -k mykey
use
euca-run-instances ami-XXXXXXXX -k mykey -t c1.medium
VM type also has implications for amount of RAM and number of CPUs allocated to the instance.
Check the VM types available.
sudo nova-manage instance_type list
Openstack Dashboard
Openstack dashboard is a web interface provide by Openstack to manage the cloud. Refer to Web Interface chapter for more details.
Hi.
I am using hybridfox-1.6.000040.xpi + Firefox 4 but it does not work for connecting to an openstack cloud. The plugin works fine with eucalyptus. How can you setup the credential?. I think that hydridfox does not support openstack yet…
harold
April 29, 2011 at 9:00 pm
Its awsome guide !!!!!!!!!!!!!!!
Chetan
July 5, 2011 at 11:17 pm