Using OpenStack On FutureGrid

Using OpenStack On FutureGrid

Summary

OpenStack is a collection of open source technology that provides scalable open source cloud computing software. OpenStack contains two main projects: OpenStack Compute (called Nova) and OpenStack Object Storage (called Swift). This tutorial provides an overview of OpenStack Nova installation on FutureGrid and step for deploying virtual machines. We currently have 14 nodes in INDIA dedicated to Cactus release of OpenStack. The installation was built using the rpms provided by grid dynamics.

Requirements

OpenStack supports EC2 interface which is only available for GNU/Linux platforms. Therefore, the only requirement for the users is a machine with a GNU/Linux installed on it. If you are in the INDIA cluster just use the module feature:

$ module load euca2ools/2.0.2
euca2ools version 2.0.2 loaded

If you are using a local desktop, you can download it from here: http://eucalyptussoftware.com/downloads/releases/

Account and Credentials

  1. Obtain your nova credentials and configuration files for the FutureGrid systems. These should have been placed in your home directory on the INDIA system. Log in with your FutureGrid username (and SSH public key) and look for a file called 'username'-nova.zip. If you do not have a portal and HPC account please create one.
  2. The credential zip file (username-nova.zip) contains the user keys and rc file.
  3. Unzip this file in your home directory. The novarc file contains the necessary environment variables.
  4. Add nova environment variables to your .bashrc:
    $ cat novarc >> .bashrc
    $ source .bashrc

    Note: As both Eucalyptus and OpenStack use the same EC2 environmental variables (i.e. EC2_URL, EC2_ACCESS), using novarc will overwrite previous Eucalyptus credentials. If you have the eucarc file in your home directory, doing "source .eucarc" will bring back those variables and overwrite the OpenStack ones. So you can go back and forth with OpenStack and Eucalyptus this way.

Testing Your

 

Setup

Use euca-describe-availability-zones to test the setup.

$ euca-describe-availability-zones
AVAILABILITYZONE    india-openstack    available

Available

 

Images

We have three ubuntu images, one centos and one ttylinux image for testing:

IMAGE ami-00000019 image-bucket/maverick-server-uec-amd64.img.manifest.xml           available public x86_64 machine aki-00000018
IMAGE ami-0000001d image-bucket/natty-server-cloudimg-amd64.img.manifest.xml         available public x86_64 machine aki-0000001c
IMAGE ami-00000028 image-bucket/centos.5-3.x86-64.img.manifest.xml                   available public x86_64 machine aki-00000026 ari-00000027
IMAGE ami-0000002b image-bucket/ttylinux-uec-amd64-12.1_2.6.35-22_1.img.manifest.xml available public x86_64 machine aki-00000029 ari-00000
IMAGE ami-0000002d image-bucket/oneiric-server-cloudimg-amd64.img.manifest.xml	     available public x86_64 machine aki-0000002c	 

VM

 

Types

These are different types of VM available.

m1.medium: Memory: 4096MB, VCPUS: 2, Storage: 40GB, FlavorID: 3, Swap: 0GB, RXTX Quota: 0GB, RXTX Cap: 0MB
m1.large: Memory: 8192MB, VCPUS: 4, Storage: 80GB, FlavorID: 4, Swap: 0GB, RXTX Quota: 0GB, RXTX Cap: 0MB
m1.tiny: Memory: 512MB, VCPUS: 1, Storage: 0GB, FlavorID: 1, Swap: 0GB, RXTX Quota: 0GB, RXTX Cap: 0MB
m1.xlarge: Memory: 16384MB, VCPUS: 8, Storage: 160GB, FlavorID: 5, Swap: 0GB, RXTX Quota: 0GB, RXTX Cap: 0MB
m1.small: Memory: 2048MB, VCPUS: 1, Storage: 20GB, FlavorID: 2, Swap: 0GB, RXTX Quota: 0GB, RXTX Cap: 0MB

Use the custom script

Run the script (included in the zip file):

$ sh runinstance.sh <username> <ami-image-id>

Note: The cactus release of openstack does not assign public ip address to the instances automatically. Users have to run another command to assign public ip addresses to the instance. We created a simple script that will run an instance with an assigned key and add a free ip address to the instance. this script is included in the zip file.

Without using the custom script

Alternatively, if you want to run an instance run without using the above script run these commands in sequence:

$ euca-add-keypair youruserkey > youruserkey.pem
$ chmod 0600 youruserkey.pem 
$ euca-run-instances -k youruserkey -n 1 <ami-image-id>

Then assign a free public ip address:

$ euca-describe-addresses
ADDRESS 149.165.146.200 i-000001e2 (fgadmin)
ADDRESS 149.165.146.201 i-000001e4 (fgadmin)
ADDRESS 149.165.146.202 i-000001e3 (fgadmin)
ADDRESS 149.165.146.203 None (fgadmin)
ADDRESS 149.165.146.204 None (fgadmin)
ADDRESS 149.165.146.205 None (fgadmin)
ADDRESS 149.165.146.206 None (fgadmin)
ADDRESS 149.165.146.207 None (fgadmin
[...]

The first three addresses are in use. So pick an address which is not yet associated with an instance. Then associate the address to an instance:

$ euca-associate-address -i <your_instance_id> $free_public_ip_address

Check the status of your VM

 

$ euca-describe-instances
RESERVATION	r-5qjdyy33	fgadmin	default
INSTANCE	i-000004bc	ami-00000019	149.165.146.200	10.0.1.6	running	user1 (fgadmin, i33)	0		m1.tiny	2011-10-12T17:21:23Z	india-openstack		
RESERVATION	r-v198000k	fgadmin	default
INSTANCE	i-000004ba	ami-0000001d	149.165.146.205	10.0.1.2	running	user2 (fgadmin, i27)	0		m1.tiny	2011-10-12T14:15:51Z	india-openstack

If you notice any state other than 'running', (Sometime it might take upto 2 minutes for the instance to boot up) please submit a ticket.

Log in to your VM

First create rules to allow ping and access to the VM over ssh.

$ euca-authorize -P icmp -t -1:-1 default
$ euca-authorize -P tcp -p 22 default

The ssh private key that was generated earlier can now be used to login to the VM.

$ ssh -i youruserkey.pem root@$public_ip_address

Note: For ubuntu maverick, login with the user ubuntu then sudo.

 

 

Volumes

From http://docs.openstack.org/cactus/openstack-compute/admin/content/managin...

"Nova-volume is the service that allows you to give extra block level storage to your OpenStack Compute instances. You may recognize this as a similar offering that Amazon EC2 offers, Elastic Block Storage (EBS).
However, nova-volume is not the same implementation that EC2 uses today. Nova-volume is an iSCSI solution that employs the use of Logical Volume Manager (LVM) for Linux. Note that a volume may only be attached to one
instance at a time. This is not a `shared storage' solution like a SAN which multiple servers can attach to."

See the current volumes:

$ euca-describe-volumes
VOLUME    vol-00000001     10        nova    in-use       2011-09-07T14:16:33Z ATTACHMENT    vol-00000001    i-000004b6    /dev/vdb   
VOLUME    vol-00000008     15        nova    available    2011-09-07T19:17:02Z
VOLUME    vol-00000002     20        nova    available    2011-09-07T15:08:31Z
VOLUME    vol-00000003     5         nova    available    2011-09-07T18:59:16Z
VOLUME    vol-00000004     3         nova    available    2011-09-07T18:59:22Z
VOLUME    vol-00000005     5         nova    available    2011-09-07T18:59:27Z
VOLUME    vol-00000007     2         nova    available    2011-09-07T19:16:47Z
VOLUME    vol-0000000a     3         nova    available    2011-09-08T20:20:26Z
VOLUME    vol-00000009     40        nova    available    2011-09-07T19:32:34Z
VOLUME    vol-0000000b     100       nova    available    2011-09-13T21:37:34Z
VOLUME    vol-0000000d     120       nova    available    2011-09-26T18:2

If the volume is not in use, run the following command to attach a particular volume to an instance:

$euca-attach-volume <vol_ID> -i <instance_ID> -d /dev/vdb

After the volume is attached, you can log in to the VM and prepare the volume with  fdisk and then mount the volume.

$ fdisk /dev/vdb

Deploying multiple VMs:

As the public ip association is not dynamic yet, this part needs to be done manually.

$ euca-run-instances -k youruserkey -n 25 -t m1.medium ami-00000020

This will create 25 instances with private ip addresses. After this command, run the following script to associate public ip to these instances:

$ sh allip.sh youruserkey

Troubleshooting:

  1. Centos: centos images sometime fails to bootup properly. We applied this x (https://answers.launchpad.net/nova/+question/167348) but still once in a while it does not bootup. 
  2. maverick:root user does not work. use ubuntu then sudo.
  3. Sometime it takes few seconds to minute for the instance to boot up. It might respond to ping but you might not be able to ssh to it.
  4. Console ouput will provide you more details about the VM:
$ euca-get-console-output <instanceId>

For any other issue please submit a ticket.


你可能感兴趣的:(Using OpenStack On FutureGrid)