For many Enterprises, moving to the cloud is easier said than done. While the move to the Public cloud is the first option for some, there are many Enterprises which are wary of the issues of Security, Control and lack of flexibility with the leading cloud platforms. Private cloud was not an easy option till openstack made it easy.

For any Enterprise planning to move to the Private Cloud, openstack provides the best cloud platform with maximum flexibility and control to the users and the administrators.

Implementing OpenStack requires an in-depth knowledge of the platform as well as some methods to make the implementation easier. Here is one cheat sheet to …

 

OpenStack is a free and open-source software platform for cloud computing, mostly deployed as an infrastructure-as-a-service (IaaS). The software platform consists of interrelated components that control diverse, multi-vendor hardware pools of processing, storage, and networking resources throughout a data center.

Migrate all instances from host marked for maintenance

We can move a single instance from one host to another but not to my search I could find a easy method to move all the instances from host marked for maintenance. Didn’t succeed much in following the openstack blueprint.  Here is a custom script that can make your job easy. Save it to a file and execute.

#!/bin/bash
#live migrate all the VM for maintenance

usage=”usage \n $0 FROM_OSTACK_COMPUTE TO_OSTACK_COMPUTE”

read -p “Please enter a valid compute short name to move FROM: ” FROM_OSTACK_COMPUTE
if [ -z “$FROM_OSTACK_COMPUTE” ] ; then
echo “enter a valid short name FROM_OSTACK_COMPUTE”
echo -e $usage
exit
fi

read -p “Please enter a valid compute short name to move TO: ” TO_OSTACK_COMPUTE
if [ -z “$TO_OSTACK_COMPUTE” ] ; then
echo “enter a valid short name TO_OSTACK_COMPUTE”
echo -e $usage
exit
fi

for VMID in $(mysql -e “use nova; select uuid from instances WHERE node=’${FROM_OSTACK_COMPUTE}’ AND vm_state!=’deleted’ AND terminated_at IS NULL ;” | grep -v uuid)
do
echo -e  “\n Moving $VMID from ${FROM_OSTACK_COMPUTE}  ${TO_OSTACK_COMPUTE}”
openstack server migrate –block-migration –live ${TO_OSTACK_COMPUTE} $VMID
done

while true; do
read -p “\n Do you want to enable maintenance on ${FROM_OSTACK_COMPUTE}?” yn
case $yn in
[Yy]* ) nova service-disable ${FROM_OSTACK_COMPUTE} nova-compute –reason ‘Maintenance’; break;;
[Nn]* ) exit;;
* ) echo “Please answer yes or no.”;;
esac
done

 

Reset a openstack VM/instance

This solution seems to have worked for me consistently especially when vm/instance get stuck on error/delete/zombia, not responding to network,  unable to boot, can’t delete. Basically we are re-setting the status of the VM but not the actual content of the container. So this is pretty safe. Execute this code by providing the instance ID.

#!/bin/bash
#Script to reset the instance.
< SOURCE OPEN-STACK ADMIN PROFILE >

inst_id="$1"

for I in $inst_id
do
nova reset-state $I
nova reset-state --active $I
done

How to check the full cluster status?

Put the following code in a script and execute to get the full cluster status. Make sure to execute the openstack ( openrc ) environment file with cluster admin credentials before

#!/bin/bash
#Script to print the cluster status.
<SOURCE OPEN-STACK ADMIN PROFILE>
echo "Project list" 
openstack project list

echo "List all the users"
openstack user list --domain default

echo "Role list" 
openstack role list

echo "Network list" 
openstack network list
neutron port-list 
neutron router-list 
neutron net-list 
neutron subnet-list;

echo "Image list" 
openstack image list

echo "Catalog list" 
openstack catalog list

echo "Service list" 
openstack service list

echo "Hypervisor list"
openstack hypervisor list

echo "Full cluster capacity"
openstack hypervisor stats show

echo "Project list"
openstack project list