Getting Started with OpenStack (Grizzly)
Log in via Horizon
One can log in to the Horizon interface at:
http://os_ip_address/dashboard
The username (typically '
admin' and '
demo') and password can be found within the
keystonerc_admin file located on your controller server (e.g
/root/keystonerc_admin).
Creating Images and Deploying Images
To deploy an instance, we must first create an image. There are various methods however we only outline two of these here:
1)
Openstack-tools: after downloading the tool created by Thomas Oulevey, we issue the following command to create the virtual machine:
We then register this with 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:
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 command:
nova show the_instance_id
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.