Skip to content

Openstack RDO on local machine (laptop)

September 2, 2013

I wanted to install a local version of Openstack on my machine just to experiment and familiarize myself with it. As easy as it may sound from the quickstarts and guides of vanilla openstack, I stumbled into different problems/errors/headaches while installing it on a native machine/virtual machine etc. Finally, I stalled onto the red had version of openstack named RDO and installed it on a Centos 6 machine.

The quickstart thing for RDO can be found here: http://openstack.redhat.com/Quickstart

Follow that. But remember that the packstack thing takes the IP address that is assigned to your eth0 at the point of installation and binds all the services to that IP. If your IP changes over time, then the services does not work anymore. So I suggest you start your openstack on localhost (127.0.0.1). To do that, before running packstack, create an answer file. To generate an answer file, the command is something like this:

packstack –gen-answer-file=ans.txt

You will then get an answer file names ans.txt with all kinds of parameters that packstack will use during installation. Look for IP addresses. You will find your current public IP address listed there many time (as many as 20 in my case). Search and replace all those with 127.0.0.1. You can also change the passwords with whatever you want. Then run packstack with that answer file:

packstack –answer-file=ans.txt

This will install openstack on your machine in one go and bind 127.0.0.1 as the IP address for all the services.  If everything goes OK, you will get a file containing necessary ID and password on your /root/ directory. Source that file to have the necessary token as your env variable so that you can run nova commands directly from console without authenticating.

Go to 127.0.0.1 from your web browser to get the dashboard and use user admin and password from your keystone file at /root/ directory.  Also check the status of the services from the command line (after you sourced the above mentioned file) using the command: nova-manage service list. If everything is OK then you should get outputs with smiley face like this: 🙂 Otherwise you will find XXX signs. If you get XXX signs then there is problem with the services and you have to fix it. A good place to check is the /var/log/nova/scheduler.log file and go to the end. In my case often the sqld daemon is not up (then turn it up using service mysqld start command), or there’s error “unable to connect AMQP server” (in that case restart qpid service using service qpidd restart, and then restart all the openstack services. Check scheduler.log again and see whether the services connect to the AMQP correctly).

Create an image from a qcow2 image which you can download from the Internet (use for example the cirros image: https://launchpad.net/cirros/trunk/0.3.0/+download/cirros-0.3.0-x86_64-disk.img), and import it (if you need help, use google).

Start an instance using the just cerated cirros image and use small flavor. Sometimes, the instance will go to error state. Check the scheduler.log file as above. In my case, it was showing some problem with “hvm” architecture not supported. This means your machines does not have Intel VT-d support or the KVM module is not inserted. Insert both kvm and kvm-intel kernel module using modprobe command. If the kvm-intel module throws error, that means you don’t have kvm support. Check dmesg | grep kvm to see what was the problem. Sometimes you will have to enable it from bios.

Highlight latex documents with multiple colors

September 18, 2012

Sometimes we want to highlight our latex document with multiple colors to signify different staff. A simple working example is here:


\documentclass{report}

\usepackage{soul}
\usepackage{color}
\usepackage[usenames,dvipsnames]{xcolor}

\newcommand{\hlc}[2][yellow]{ {\sethlcolor{#1} \hl{#2}} }

\begin{document}

This is a text. \hlc[yellow]{And this is highlighted with color yellow}. \hlc[green]{Then with color green}, \hlc[CarnationPink]{and then with color pink}. Or you can also use \hlc[Dandelion]{Dandelion}, or \hlc[SeaGreen]{seagreen}, or anything as described in \hlc[Peach]{http://en.wikibooks.org/wiki/LaTeX/Colors}

\end{document}

Quick snippets for simple Python scripts

August 31, 2012

I sometimes use python for quick scripts such as parsers, data extractors, converters etc. I use it because python has minimal overhead and has a great set of libraries. However the problem is that because I don’t use it often enough, I tend to forget all the library calls and syntax etc. So, just decided that I will gather the often needed snippets of code that I use again and again.

Walk through the files in a directory (non recursive):

import os

for dirname, dirnames, filenames in os.walk('.'):
    for filename in filenames:
        print 'Professing: ' + filename + '...'

Check if a substring is present:

if str.find('Hi') != -1:
    print 'found'

or

if 'Hi' in str:
    print 'found'

Checking and extracting substring using regular expression:

match2 = re.search(r'=(\d+)\.(\d+)\.(\d+)\.(\d+)', line)
if match2:
    print '    Found IP: ' + match2.group()

Extract all matches to regular expression:

for pattern in re.finditer(r'<(\d+)>', line):
    print "%s: %s" % (pattern.start(), pattern.group(1))

This uses a iterator returned by the finditer function to loop through all the instances

Key-value set or dictionary

dict = {}
dict['a'] = 'alpha'
dict['g'] = 'gamma'
dict['o'] = 'omega'
if 'g' in dict: print dict['g']

File open, close, read, write:

Open for writing:

handle = open('temp.file', 'w')

Open for reading:

handle = open('temp.file', 'r')

Writing to a file:

handle.write('whatever)

Reading from a file:

for line in fhandle:
    do something with line, which is a string object

Closing a file:

fhandle.close()

GNUPlot to draw gantt chart (to show the range used from a bigger range of data)

July 4, 2012

For my work, I wanted to plot ranges of data from a bigger range to visualize how much of the bigger range is being used. There are possibilities of gaps in the used range, that is, many parts of the total range might not have been used. At first I was thinking it might be better if there were something like a pie chart or a circle representing the 100% of the range, and then different colors to show the ranges used by different entities. However, later I settled for a gantt chart, which shows in the form of a bar chart the same thing I was planning to.

I found a simple python script to generate gnuplot commands for a gantt chart here, and then changed a little the code to fit my need. The modified py file can be found here. Please change the extension of the source file from .doc to .py, and then use it as following:

python gantt.py -o temp.gpl data.txt

This command takes as argument the name of the file that it will produce with gnuplot command (i.e. temp.gpl), and the name of the data file (i.e. data.txt).

The data file needs to be formatted as a tab delimited file with “name  start  end” rows. For example:

A   1   3
B   2   6
C   5   9
D   8   10

After running the python script, a new file will be generated (as given in the command). Then get into gnuplot:

gnuplot> load "temp.gpl"

Which will execute the commands in temp.gpl and generate the graph for you. If you are pleased with the results, do necessary things to get it into eps.

REF: http://devel.se.wtb.tue.nl/trac/shed/browser/trunk/visualization/taskresource_gnuplot_gantt

GNUPlot draw variable color and point type based on column values

July 3, 2012

Let’s say I have a three column table with first two representing x,y values and the third one is the differentiator (i.e. the one that I want to used for varying color and type of the point being drawn). Like this:
1, 3, 0
1, 5, 6
3, 5, 2
4, 5, 0

And I want my points be drawn according to the x, y values as in first two columns and the third column to be used for determining the color and the type of the point that is drawn (I wanted it to be bicolor bitype graph, not multi color). I found that the easiest way to do this is with a simple awk script (instead of using palette, which is good for only variating color, but not for also variating type).

gnuplot> plot[0:5][0:6] "< awk '{if($3==0) print}' file.temp" u 1:2 t "red" w p pt 2, \
> "< awk '{if($3!=0) print}' file.temp" u 1:2 t "green" w p pt 4

This will generate a graph with red dots for the rows with 0 in third colum, and green dots for everything else. This can easily be extended for multi color, multi dot types, if you could understand the logic behind the script.

Ref: http://stackoverflow.com/questions/9082807/gnuplot-plotting-points-with-color-based-values-in-one-column

HP Elitebook wifi LED blinking in Ubuntu

June 24, 2012

Ubuntu in HP laptops has this very annoying habit of blinking the wifi LED constantly when traffic is transferred. This is very distracting, and I wanted it to go back to normal (that is, not blinking at all). In older versions of Ubuntu (before 12.04), this works:

$ sudo nano /etc/modprobe.d/wlan.conf

Write to the wlan.conf file: options iwlagn led_mode=1

Save and quit nano with ctrl+x

Remove and reinstall wlan module of ubuntu using following commands:

$ sudo modprobe -rfv iwlagn
$ sudo modprobe iwlagn

However, from 12.04, this does not work anymore, becase the module name of wifi has changed from iwlagn to iwlwifi. For Ubuntu 12.04, follow the same instructions as before, but replace all the iwlagn with iwlwifi. So the new instruction set would be:

$ sudo nano /etc/modprobe.d/wlan.conf

Write to the wlan.conf file: options iwlwifi led_mode=1

Save and quit nano with ctrl+x

Remove and reinstall wlan module of ubuntu using following commands:

$ sudo modprobe -rfv iwlwifi
$ sudo modprobe iwlwifi

And that works like a charm…

Upcoming computer science and communication networks conferences

May 7, 2012

For my personal book-keeping (I take no responsibility for anyone else’s use of this page)

Conference Name    Submission Date       Notification       Conference Date
IEEE INFOCOM       20.07.2012            19.11.2012         14.04.2013
IEEE CCNC          01.08.2012            15.09.2012         11.01.2013
ACM SAC            21.09.2012            10.11.2012         18.03.2013
Eurosys            20.10.2012            24.12.2012         15.04.2013
ACM Mobisys        Usually in December
ACM Mobicom        Usually in March

Ubuntu 11.10 and Mobile broadband connection with Nokia

February 1, 2012

WIth Ubuntu 11.10, when you connect your nokia phone using USB cable, it is detected as a CD device (for some reason I have no idea of) if you select “connect to Internet” from the phone’s menu after connecting. As shown in the “dmesg” output:

[ 9569.002260] scsi 8:0:0:0: CD-ROM            Nokia    XXX              1.0  PQ: 0 ANSI: 2

In this case the “mobile broadband” connection is not shown by the network manager, and you won’t be able to connect using it. Instead, select “PC Suite mode” from the phone menu after connecting it to the computer. The output of “lsusb” should show something like this:

Bus 002 Device 007: ID 0421:00ab Nokia Mobile Phones XXX (PC Suite mode)

which shows that the mobile is connected using PC Suite mode. Then you should be able to see the “mobile broadband” section in the network manager dropdown applet. Just configure according to your country and operator, and enjoy!

P.S: You will see your mobile’s model number in place of the XXX in the dmesg and lsusb output.

NS3 and BRITE integration (NS-3-BRITE) for topology creation

December 18, 2011

BRITE is a tool to generate topology similar to CAIDA topologies. I needed a tool to convert BRITE topologies to NS-3 topology. Found a branch of NS-3 which does exactly that here. However, it is not yet merged to actual ns-3-dev branch, so I had to either download the special branch or somehow patch my current ns-3 download. I decided for the later, and extracted the patch from here. After patching, followed the instruction from here:

  • Downloaded BRITE and built it:
 $: hg clone http://code.nsnam.org/jpelkey3/BRITE
 $: cd BRITE
 $: make
  • Then CDed to my patched NS-3 source, and configured and build it with BRITE support:
$: ./waf configure --with-brite=/path/to/brite/source
$: ./waf
  • Then I copied the BRITE example provided with the patch to the scratch directory and ran it:
 $: ./waf --run 'scratch/brite-generic-example --verbose=1'

All of these instructions are copied from the wiki page of the BRITE integration project, in case the wiki page goes missing. If you want the patch, here it is taken using hg diff from my ./ns-allinone-3.12.1/ns-3.12.1 directory. Sorry for the pdf file instead of normal text diff file. WordPress for some weird reason doesn’t allow uploading txt file as an attachment.

Build and install NS-3-DCE in Ubuntu 11.04 (C library missing problem)

November 24, 2011

I wanted to install ns-3-dce from furbani’s branch in my Ubuntu 11.04 machine with 64bit processor. I got every instruction from the wiki page he manages: http://www-sop.inria.fr/members/Frederic.Urbani/ns3dceccnx/getting-started.html#getting-started. However, when I checked out the ns-3-dce branch and ran the script to build and install everything, I ended up getting a weired error in the waf build output. It automatically download and built the dev branch, and the other necessary things. After that, when it tries to build the dce branch itself, it says “c library not found”. Out of suspicion I went out to check my libc version because I heard the dce branch is still very libc version dependent. But unfortunately, I couldn’t find libc.so.6 file in my /lib/ directory, and if I tried to install libc6, apt-get was saying that its already installed. Then I figured that in Ubuntu 11.04 they have decided to put some of the libraries in some different path in the /lib directory to allow both 32 and 64 bit libraries to stay side by side. As the waf configuration system hard-codes the path of these libraries, so it couldn’t find the libc library in correct place. So, I had to create a symlink to the library:

$sudo ln -s /lib/x86_64-linux-gnu/libc.so.6 /lib/libc.so.6

Then I ran the script again (I removed the checking out parts, because the necessary things are already pulled out). Now it was complaining about the pthread library. I did the same thing for these libraries as well:

/lib$ sudo ln -s /lib/x86_64-linux-gnu/libpthread* .

Then the whole config and building process went well.