Remove Old or Failed Hosts from Openstack

09/06/2014 // 0 Comments

If you are testing or running production Openstack environment, you will probably face a failed host. Unfortunately, there is no “button” to remove it from Openstack. It would be a nice touch, but there are lots of important things to develop. You can remove the host by removing from database. I try to guide you about it. Before doing anything: BACKUP your database!!! Do not do anything before backing up your database, you should be aware of that. These commands tested with Openstack Havana version installed in Ubuntu 12.04 LTS servers. Mysql server is 5.5.   Firstly, backup your database!!! Login to your mysql db and select Nova database (I used default database name here);

Check your host and it’s ID;

As you can see, we have a service_id and id for our hosts. I want to remove NODE05. Clean compute_node_stats table: Now, we need to clean the stats of NODE05 from compute_node_stats table. We need to use id number of compute_nodes table. As you can see, id is 3 for NODE05;

Clean compute_nodes table: We will use service_id of NODE05 in the compute_nodes table to delete the data:

Clean services table:

Check the dashboard, it will no longer display NODE05.

Backup Your MySQL Database Daily!

21/05/2014 // 0 Comments

Here is quick guide to backup your MySQL database daily: This guide is prepared on Ubuntu 12.04LTS, MySQL 5.5. Save this script anywhere in your database server:

* Edit the red texts for your environment. This script will use /home/username/mysqlbackup folder to save the backup files. It will delete the backup files which are 7 days old. It will hold 8 backup files. Make the the script file executable:

Test the script by running manually before adding to your crontab.

Add the script to crontab to run it daily:

This job will run at 03:00 everyday.

Keystone Flushing Old Tokens

21/05/2014 // 0 Comments

If you do not flush old tokens from your database, it will be as big as Godzilla. You need to clear the tokens from the keystone database time to time. In Havana version, there is a new CLI command to flush the keystone tokens:

I suggest to put it in your crontab file for daily run. Add this line to /etc/crontab file in your Controller node which keystone server is installed:

This command is going to run everyday at 03:00 and clear your DB for old tokens.

How to extend LVM disks in vCenter

13/05/2014 // 0 Comments

LVM disk extension can be a challenging experience for who are not familiar with unix environment.  I will try to explain it as simple as possible in this guide. Heads up: You need to reboot the virtual machine twice! There is no live-extension way for LVM in vSphere environment. If you want to do it live-extension, you need to add new VMDK hard disk to the VM and extend in the LVM console. I will write about that later. This guide is based on Ubuntu 12.04 LTS.   1. Enter your VM’s “Edit Properties” menu. Choose your hard drive and give more space as you want: 2. In the same window, click “Options” tab, choose “Boot Options” and enable “Force BIOS Setup” on the right side: 3. Click “OK”. 4. Go to g-parted web site and download the ISO file from there: 5. Right click on your VM and click “Open Console”. Click the “Connect CDROM” button on top right and choose “Connect to ISO image on local disk”. 6. Choose your g-parted ISO file and click “OK”. 7. Now reboot your VM. You will see the BIOS screen. Go to “Boot” tab. Using UP-DOWN arrow select “CD-ROM drive” and bring it before Hard Drive using “+” sign on your keyboard. Go to Exit tab and select “Exit Saving Changes”. This will reboot your virtual machine. 8. You will see boot screen of g-parted. Click “Enter” for G-Parted Live. (You can hit Enter for default selections for 9-10-11 steps) 9. Choose “Don’t touch keymap” for Configuring console-data. 10. It will ask for language selection. Type your language number and hit Enter. Default is 33 (English). 11. Choose G-Parted mod, default is “0”. 12. G-parted will boot and Device manager screen will be shown in the screen. Now select LVM device which’s File System is “extended”. […]

Generate User Password in Ubuntu Cloud Image

12/05/2014 // 0 Comments

When you boot standard Ubuntu Cloud image in the Openstack, no password or user generated in the image by default. You can configure your Ubuntu Cloud image to set a static password or generate a password in the first boot of the image. You need to configure metadata service in the Openstack in order to use this. I suggest you to do this jobs in your Glance server, your images will be saved to this server anyway.   Firstly, download your Ubuntu cloud image from this link: Install guestfish in your server. This server probably will be your Glance image server. :

In order to edit the image file open it with guestfish:

Then, start your image file:

Find the image local disk:

Mount the image disk to guestfish root:

Now, you can edit /etc/cloud/cloud.cfg file by using vi editor. I wanted to set random password for ubuntu user, so I added these lines to the cloud.cfg file: for 12.04 LTS images, you can set your static password or randomize:

for 14.04 LTS images I have not tried to randomize the password yet, but static password can be set with this commands:

Be careful to comment out the “lock_passwd: True” raw in the cloud.cfg file. It will not allow you to login if you do not remove it. Save cloud.cfg file and exit from guestfish. That’s it! Import this modified image to Openstack and Ubuntu password will be randomly created or static password will be set . If you randomized the password it will be printed to Console-log of the instance:

guestfish operation referance: Here are some examples in cloud.cfg file:

vCloud Director – Enabling Uber Admin

12/05/2014 // 0 Comments

vCloud Director has a hidden window which you can enable debug mode and change thumbnail settings from. This feature is enabled on all versions of vCloud Director. Although 5.5 version is not listed in the Vmware KB (#2006922) it works in this version. Login to the vCD and click “Help” menu on upper right screen. Click “About”. Click CTRL+SHIFT+U on the keyboard:   Source:

VLAN tagging on Bonding interfaces for Ubuntu Servers

06/05/2014 // 0 Comments

Firstly, install vlan and bonding packages on the Ubuntu server:

Enter these lines on /etc/modules because we want to enable the modules at startup.

If there is no network connection, you need to install these packages from CDROM or install these packages while OS setup. This configuration can be used for bonding and VLAN tagging on server. You can define additional VLAN interfaces. This configuration if for Active-Passive interfaces. We need to define primary interface as seen in eth0. If you do not want to configure your physical switch or do not want to struggle with your network administrator, this is the best way. When eth0 is lost, your secondary interface (eth1 in this example) will be used. If you want to use active-active setup, the best way is to setup LACP bonding, but you need to configure your physical switch ports for LACP.

bond0 is your bonding interface. bond0.430 is your VLAN tagged bonding interface. 430 is your VLAN. If you want to check bonding status, you can check here: