Getting Started with OpenStack (Grizzly)

Creating Images and Deploying Images

To deploy an instance, we must first create an image. There are various methods however we outline two of these here:

1) Openstack-tools: after downloading the tool created by Thomas Oulevey, we issue the command:

sudo ./create-glance-image-el6.sh -u http://linuxsoft.cern.ch/cern/slc6X/x86_64/Packages/sl-release-6.4-1.slc6.x86_64.rpm myslc64

to create the virtual machine image. We then register this to the Glance service by:

cd myslc64

KID=`glance add name=myslc64-kernel container_format=aki disk_format=aki < ./vmlinuz*`

RID=`glance add name=myslc64-ramdisk container_format=ari disk_format=ari < ./initramfs*.img`

glance add name=myslc64 container_format=ami disk_format=ami kernel_id=${KID:25:100} ramdisk_id=${RID:25:100} < ./myslc64.img

This image will then appear in the 'Images & Snapshots' section of the Project.

2) Cloud images: Various pre-configured images exist and we outline the process when a Fedora 19 virtual machine image is required. We download the image and then simply register it with the Glance service:

wget http://cloud.fedoraproject.org/fedora-19.x86_64.qcow2

glance image-create --name "Fedora 19 x86_64" --disk-format qcow2 --container-format bare --is-public true < Fedora-x86_64-19-20130627-sda.qcow2

Virtual Machine Migration (non-live)

By default, non-live virtual machine does not function when installed by packstack. Typically this is because the SSH keys between hosts are not setup for the user 'nova' and will result in either a 'host key verification failed' or 'Permission denied' error.

Exchange SSH keys between 'nova' users

Use the following commands to solve this:

usermod -s /bin/bash nova

su - nova
chcon -u system_u -r object_r -t user_home_t .
mkdir -p -m 700 --context=system_u:object_r:ssh_home_t:s0 .ssh && cd .ssh

Add the following to the SSH config file withn the 'nova' user's .ssh directory (/var/lib/nova/.ssh):

Host *

StrictHostKeyChecking no

UserKnownHostsFile=/dev/null

Now generate and enter the SSH keys to other 'nova' users authorized_keys file:

ssh-keygen -f id_rsa -b 1024 -P ""

scp /var/lib/nova/.ssh/id_rsa.pub root@otherHost:/var/lib/nova/.ssh/authorized_keys

Ensure that the /var/lib/nova/.ssh directory as well as the authorized_keys file have the correct permissions and owner:

chown -R nova:nova /var/lib/nova/

chmod 700 /var/lib/nova/.ssh

chmod 600 /var/lib/nova/.ssh/authorized_keys

You now should be able to ssh into the others hosts via the user 'nova' without using any password.

The Migration Process

To migrate a virtual machine from one host to another using the non-live approach, we obtain the ID of the instance we want to migrate, display which host the instance currently resides on and then migrate the virtual machine

nova list

nova show the_instance_id

nova migrate the_instance_id

Note that by using non-live migration, the OpenStack user cannot select the host to migrate the virtual machine to; this is performed by the OpenStack scheduler.

Check that the migration has successfully moved to another host via the nova show the_instance_id command.

After the migration, the virtual machine's state will read VERIFY_RESIZE.

If the migration was not successful, we can revert the changes made by:

nova resize-revert the_instance_id

If the migration was successful, we can inform OpenStack of this by issuing:

nova resize-confirm the_instance_id

and the instance state will return to Active. If this command is not performed, the virtual machine's state will return to Active automatically in 24 hours.

Edit | Attach | Watch | Print version | History: r6 | r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions...
Topic revision: r2 - 2013-07-28 - GaryMcGilvary
 
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    Sandbox All webs login

  • Edit
  • Attach
This site is powered by the TWiki collaboration platform Powered by PerlCopyright & 2008-2022 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
or Ideas, requests, problems regarding TWiki? use Discourse or Send feedback