Five Weeks with OpenStack

October’s last week

In the month of October I read lots of docs and watched many conference videos, regarding OpenStack; then I thought of starting with a bug and solving it. Basically I was more focused on Neutron, as it is a networking project and Networking is also my subject of interest. So I assigned myself an old bug which was not solved for a long time.

For starting out I did setup a Fedora VM, I was trying out DevStack for the first time and did all the steps as provided on the official docs. But before starting DevStack with stack.sh, I created a local.conf file, which is suitable for neutron development, by referring this doc and this video.

Now that I was able to access Horizon from my host machine browser. I added few OS images to the OpenStack images list and launched an instance and also did setup a floating IP for it. But I was not able to ping that VM or ssh into it using that associated floating IP. After a little research found out that I needed to setup a new Security Group rule so as to allow all ICMP packets. So I selected “Custom ICMP” from the rules list and added -1 to ICMP code and -1 to ICMP type field to allow all ICMP but it gave an error, below each field saying “Not a valid port number” which was incorrect, rather it should have been “Not a correct ICMP code” and “Not a correct ICMP type” respectively, so I submitted a bug report for this error.

After submitting the bug report I started working all by myself. When working on it I found out that, code to validate TCP port was used to validate the ICMP type and ICMP code, from oslo.utils/netutils. Which was wrong, because TCP ports ranges from 0 to 65535 while ICMP code or ICMP type ranges from 0 to 255. For more information of ICMP read here. So started exploring netutils, but there was no functionality to validate the range of ICMP type and ICMP code. Therefore I submitted another bug report to Oslo libraries.

Now my focus was on getting the functionality of ICMP type and ICMP code validation into oslo.utils/netutils, so that the wrong implementation in Horizon can be corrected. I worked on this and submitted first patch for this Oslo bug. While testing tox wouldn’t make sense to me, so this post and this doc helped in learning tox.

November’s first week

Now that first patch for the bug was submitted but the code was not upto standards so I went on to edit it several times, to make it more generic and more readable. Also reviewers added more inputs to make code better. Also I learnt that newly added functionality must be submitted with test cases to verify that functionality, so I wrote test cases to verify those functions.

Some even thought if this is a feasible approach to add code first to Oslo and then use it? What has happened ever since is that, code that gets repeated in various places in OpenStack is brought into Oslo libraries, so as to reuse the repeated code. But then I also made a point that rather than increasing our work in future of refactoring code from somewhere and then including the code into Oslo libraries why not be proactive, think long term and include this code right now. In this week four times the code was revised.

November’s second week

Two more times the code was revised in this week and after sixth revision or sixth patch set the code was merged. Meanwhile I learnt how the code review system gerrit works; manners and etiquettes of requesting others to review my code. Some folks on IRC suggested not to bug others by asking too many times to review the code, rather make acquaintance by reviewing other’s code, giving meaningful comments and then get code reviewed from them.

November’s third week

Now that code in Oslo was ready to be used, I started working on bug in Horizon. This is a Django world. So it was quite tough at first to understand the flow of code to me, because I never had experience with Django at large.
In Django forms when the data is being input, the data is passed through validators, this is where previous Oslo libraries patch came to help, to validate the data input into forms. I learnt more about Django validators at Django official docs.

November’s fourth week

While solving this Horizon bug I found out that the text messages on the forms were also translated to various languages. So went onto translate the changed error messages in each and every language’s *.po files. But later found out that the changes to *.po files were not required because these were generated automatically.

Then I tested everything using tox ofcourse, but one test always failed viz. py27dj17, so after asking some places on IRC found out that I had older code base and in new release the support for Django 1.7 is removed. So updated to latest code base and submitted the patch. After which I learnt the importance of proper commit message, the commit message I wrote violated some of practices mentioned in this doc. But since I had made so many changes to *.po files it was hard to revert back to correct patch easily so I abandoned the patch and created another patch. There were extensive discussions on the code being submitted about allowing ‘-1’ into ICMP type and ICMP code so that ANY ICMP packet can be allowed.

November’s fifth week

After long discussions on the first patch set, I have submitted second revision and the code is under review.

Meanwhile

I learnt about using git stash. Also the Developer’s Guide explains about updating repositories before starting to work, naming branches according to a bug, writing meaningful commit messages, etc. And finally learnt about Python2 and Python3 compatibility at Six.