tag:blogger.com,1999:blog-72080494670611371402024-03-15T18:09:44.542-07:00Manishanker Blog<a href="http://awe.sm/q340n"><img src="http://b585a4e4f726d6af5f87-f1a451a23bc122496ee38533646d1f72.r42.cf1.rackcdn.com/openstack-4th-anniversary.png" width="100" height="100" alt="Happy 4th Birthday, OpenStack"></a> I blog about Openstack mostly. You can reach me at <b>shanker.mani0@gmail.com</b>Manishanker Thttp://www.blogger.com/profile/09355231748303010351noreply@blogger.comBlogger4125tag:blogger.com,1999:blog-7208049467061137140.post-76793148453453569662014-07-06T10:53:00.001-07:002014-07-06T10:53:34.869-07:00My contribution to Openstack<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="text-align: center;">
<u>Contribution to Openstack</u></h2>
<h4 style="text-align: left;">
Stackalytics:</h4>
<div style="text-align: left;">
Stackalytics is one stop for looking at some one's contribution to Openstack. It has great user interface where we can find the modules user has contributed to, timeline of his contributions. Here is my Stackalytics page <a href="http://www.stackalytics.com/?release=all&metric=all&project_type=openstack&user_id=shanker-mani0" target="_blank">link</a>. I have mainly contributed for Openstack-manuals, documentation for Openstack projects about installation, user guides, admin guides and Openstack-API which hosts the documentation related to the API of several Openstack components. </div>
</div>
Manishanker Thttp://www.blogger.com/profile/09355231748303010351noreply@blogger.com0Hyderabad, Telangana, India17.385044 78.48667116.9002155 77.841224 17.8698725 79.132118tag:blogger.com,1999:blog-7208049467061137140.post-60624575701265120302014-05-26T08:42:00.001-07:002014-05-26T08:47:01.349-07:00Deploying Devstack with Ironic<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="text-align: center;">
Devstack with Ironic</h2>
<h3 style="text-align: left;">
Openstack</h3>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-u5vPpuyLPh4/U4MG7bSpoXI/AAAAAAAAANM/hWelb8rW8IQ/s1600/openstacklogo_0.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/-u5vPpuyLPh4/U4MG7bSpoXI/AAAAAAAAANM/hWelb8rW8IQ/s1600/openstacklogo_0.jpg" height="320" width="308" /></a></div>
<div style="text-align: left;">
</div>
<div style="text-align: left;">
Openstack is a cloud operating system which manages pools of resources like storage, newtorking, computing and provisions cloud solutions which is massively scalable. Openstack is an free and open source project. Openstack's mission is to provide ubiquitous cloud computing platform which serves as Infrastructure As A Service (IAAS) to meet the needs of public, private cloud and hybrid cloud.</div>
<h3 style="text-align: left;">
Devstack</h3>
<div style="text-align: left;">
Devstack is an all in one installer for Openstack. Openstack is getting bigger and bigger day by day. Many new projects have been added to it and it is getting more complicated. To make things easy, Devstack offers a way to install all components of Openstack with out much fuss. These are the key components of Openstack : </div>
<ol style="text-align: left;">
<li>Compute ( Code name 'Nova') : Nova is responsible for creation and management of virtual machines. It has support for different types of <a href="http://en.wikipedia.org/wiki/Hypervisor" target="_blank">Hypervisor</a>s like <a href="http://www.linux-kvm.org/page/Main_Page" target="_blank">KVM</a>, <a href="http://www.xenproject.org/" target="_blank">Xen</a>,<a href="http://wiki.qemu.org/Main_Page" target="_blank"> QEMU</a>, <a href="http://www.vmware.com/in/products/vsphere-hypervisor" target="_blank">Vmware-vsphere</a>, <a href="http://www.microsoft.com/en-us/server-cloud/products/windows-server-2012-r2/#fbid=kAghTPH5RzC" target="_blank">Hyper-V</a>, <a href="http://docs.openstack.org/trunk/config-reference/content/baremetal.html" target="_blank">Baremetal</a>. </li>
<li>Object Storage (Code name 'Swift) : Swift provides Object storage. Swift is used to store Objects and files and Openstack is responsible for data replication and ensuring integrity in cluster.</li>
<li> Block Storage (Code name 'Cinder') : Cinder is used to provide storage for compute instances. It manages creation, attaching, detaching of the block storage to the servers. In addition to this, it can use many storage like Ceph, IBM Storage, NetApp etc</li>
<li>Networking ( Code name ' Neutron'): Neutron is used to provide network as a service to the compute instances. It is responsible for allocating IP addresses and for managing networks inside openstack</li>
<li>Dashboard (Code name 'Horizon') : Horizon is a web interface to manage all the services in openstack. It can be used to spin up a virtual machine , assign a floating IP to it, access its console.</li>
<li>Identity(Code name 'Keystone') : Keystone is the identity service which provides authentication to all the services running inside openstack. It has capabilities to integrate with LDAP.</li>
<li>Image service(Code name 'Glance') : Glance is used to provide images for the virtual machines. It can also be used to store backups. It has the capability to use stored images as templates.</li>
<li>Telemetry(Code name 'Ceilometer') : Ceilometer provides features like Billing for customers. </li>
<li>Orchestration(Code name 'Heat') : Heat is used to orchestrate different cloud applications using templates</li>
<li>Database(Code name 'Trove'): Trove is relatively new project as of today. It is used to provide Database As A Service. It uses openstack as a black box to provide database as a service</li>
</ol>
Openstack also consists of many other projects like Ironic which is now a separate project for provisioning of Baremetal instances, Sahara which is used to provision Hadoop cluster on top of Openstack, Fuel which is an all-in-one control plane for automated hardware discovery,
network verification, operating systems provisioning and deployment of
OpenStack, Marconi which is message queue as a service, TripleO which is openstack on top of openstack, Rally which is benchmarking as a service and many more will be added in future.<br />
<br />
<h3 style="text-align: left;">
Deploying Devstack with Ironic</h3>
<div style="text-align: left;">
Devstack can be used to configure all the services that we are interested in deploying in openstack. To know more about devstack, you can refer <a href="http://devstack.org/" target="_blank">here</a>.</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
Lets begin the deployment process. I would prefer trying out this deployment in <a href="https://www.virtualbox.org/" target="_blank">virtual box</a> which gives me the flexibility to take snapshots of working devstack, create new virtual machines to try out different configurations. You can download virtual box and follow this <a href="http://www.oracle-base.com/articles/vm/virtualbox-creating-a-new-vm.php" target="_blank">guide</a> for creating a clean installation of Ubuntu 12.04 LTS 64 bit vm with atleast 2 gigs of ram. If in case you dont see 64 bit option in the second step, enable virtualization in your Bios.</div>
<div style="text-align: left;">
</div>
<div style="text-align: left;">
Now that you have your vm with Ubuntu 12.04 LTS, its time to install Devstack. Start the virtual machine. Open a terminal (ctrl + shift + t) , run an update</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<i>sudo apt-get update</i></div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
All the code of openstack is hosted on github so install git using this command,</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<i>sudo apt-get install git </i></div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
Check if git has installed successfully by checking its version,</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<i>git --version </i></div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
Once git has been installed, its time to clone the devstack from openstack github repository. You can have a look at the repo that we are going to clone <a href="https://github.com/openstack-dev/devstack" target="_blank">here</a> . Click on the branch, you will notice stable/havana and stable/icehouse . To install openstack havana clone the devstack by checking out the stable/havana branch. To install openstack icehouse (latest as of now), clone the devstack by checking out the stable/icehouse. </div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
For devstack with Icehouse use this command</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<i>git clone https://github.com/openstack-dev/devstack.git -b stable/icehouse</i></div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
For devstack with Havana use this command</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<i>git clone https://github.com/openstack-dev/devstack.git -b stable/havana</i></div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
If you are facing errors with ssl certificate verification , use http instead of https. If this doesn't work , change sslVerify to false using </div>
<div style="text-align: left;">
<br /></div>
<div class="container" title="Hint: double-click to select code">
<div class="line number1 index0 alt2">
<i><code class="bash plain">git config --global http.sslVerify </code><code class="bash functions">false</code></i></div>
</div>
<div style="text-align: left;">
<i> </i> </div>
<div style="text-align: left;">
Once the download is done , change to the directory, devstack using</div>
<div style="text-align: left;">
<i> </i></div>
<div style="text-align: left;">
<i>cd devstack</i></div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
Check the contents of that folder using </div>
<div style="text-align: left;">
<i> </i></div>
<div style="text-align: left;">
<i>ls -la</i></div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
You can notice few shell scripts like stack.sh, clean.sh, unstack.sh, rejoin-stack.sh, run_tests.sh, exercise.sh. stack.sh is a shell script which downloads all the components from the respective openstack repositories and clients in /opt/stack. Besure to run this command as a normal user not <i><u>root </u></i>. unstack.sh is used to stop the openstack services. rejoin-stack.sh is used to join the already running openstack , it will start all the stopped services and screen logs will be appended. clean.sh does its best to remove mysql, rabbitmq and other openstack configuration files.</div>
<div style="text-align: left;">
</div>
<h4 style="text-align: left;">
<b>Important step</b></h4>
<div style="text-align: left;">
<i> </i>create a new file while you are in devstack's directory named localrc using your favorite editor. I am using vi editor so I would do something like this</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<i>vi localrc</i></div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
Paste this contents to enable all the services and <b>Ironic</b>.<br />
<br /></div>
<div style="text-align: left;">
######## From here #######</div>
<div style="text-align: left;">
<i> RECLONE=yes<br />LOGFILE=/opt/stack/logs/stack.sh.log<br />SCREEN_LOGDIR=/opt/stack/logs/screen<br /># Enable Ironic API and Ironic Conductor<br />enable_service ironic<br />enable_service ir-api<br />enable_service ir-cond<br /><br /># Enable Neutron which is required by Ironic and disable nova-network.<br /><br />disable_service n-net<br />enable_service q-svc<br />enable_service q-agt<br />enable_service q-dhcp<br />enable_service q-l3<br />enable_service q-meta<br />enable_service neutron</i><br />
<i><br /></i>
<i># You can replace "password" with your own one</i><br />
<i>DATABASE_PASSWORD=password</i><br />
<i>RABBIT_PASSWORD=password</i><br />
<i>SERVICE_PASSWORD=password</i><br />
<i>ADMIN_PASSWORD=password</i><br />
<i>SERVICE_TOKEN=password</i><br />
<div>
<br /></div>
<i># Create 3 virtual machines with 512M memory and 10G disk to</i><br />
<i># pose as Ironic's baremetal nodes.</i><br />
<i>IRONIC_BAREMETAL_BASIC_OPS=True</i><br />
<i>IRONIC_VM_COUNT=3</i><br />
<i>IRONIC_VM_SPECS_RAM=512</i><br />
<i>IRONIC_VM_SPECS_DISK=10</i><br />
<i>IRONIC_VM_SSH_PORT=22</i><br />
<i><br /></i>
<i># Size of the ephemeral partition in GB. Use 0 for no ephemeral partition.</i><br />
<i>IRONIC_VM_EPHEMERAL_DISK=0</i><br />
<i><br /></i>
<i>VIRT_DRIVER=ironic</i><br />
<i><br /></i>
<i># By default, DevStack creates a 10.0.0.0/24 network for instances.</i><br />
<i># If this overlaps with the hosts network, you may adjust with the</i><br />
<i># following.</i><br />
<i>NETWORK_GATEWAY=10.1.0.1</i><br />
<i>FIXED_RANGE=10.1.0.0/24</i><br />
<i>FIXED_NETWORK_SIZE=256</i><br />
<i><br /></i>
<i># Log all devstack output to a log file</i><br />
<i></i><br />
<i>LOGFILE=$HOME/devstack.log</i><br />
<i>######### Till here########</i><br />
<br />
<div style="text-align: left;">
Save the file. </div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
Now run </div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<i>./stack.sh</i></div>
<div style="text-align: left;">
<i><br /></i></div>
<div style="text-align: left;">
This will take around 20 minutes. I will clone all the required repositories of all the components that are enabled in the localrc file. As it takes place, let understand what this file means.</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
Reclone = yes makes stack.sh to clone the repo at each run. If this is set to no, stack.sh is going to clone only if its not in the $dest directory. Second line signifies to make a log of the stack.sh. Since it will run for several minutes, it would be handy to check whats going on and in case of failures to track which component has failed.Once stack.sh completes, we can see screen with terminals of all the services. Its better to log the screens for the same purpose as stated above. enable_service ironic tells stack.sh to enable ironic and download the necessary files related to it. Similarly other enable_service commands do the same. Ironic requires neutron so we have to disable the nova network. </div>
</div>
<div style="text-align: left;">
<br />
Subsequent lines deal with the password for the database, rabbitmq server, admin password, service token password.<br />
<br />
Lines starting with Ironic are used to create 3 vm's with ram 512 mb and with 10 gb space. These three vm's will act as fake baremetal nodes for Ironic.<br />
<br />
In case of normal openstack installation, the harware is virtualized using different hypervisors which create virtual machines. Ironic on the other side picks the bare metal servers and PXE (Pre Execution Environment) boots them and deploys the image. Hardware is not virtualized in this case. With Ironic we get the flexibility of cloud with bare metal. Imagine you have 5 servers and you want them to spin up just like you can do spin up a vm in openstack. Ironic does that. </div>
<div style="text-align: left;">
</div>
<div style="text-align: left;">
<i> </i></div>
<div style="text-align: left;">
<br />
Rest of the file deals with the network configuration for vm's. What class of IP address will be allocated, what would be their gateway.<br />
<br />
Once the stack.sh completes succesfully (I know it wont happen the first time, if it does, you are very lucky<br />
:-D ), its time to login to Horizon.<br />
<br />
check your network interface using <i>ifconfig </i>and note down the Ip address in eth0 interface. Open your browser and go to http://IP. My Ip adress of eth0 interface was x.x.x.x so my horizon would be http://x.x.x.x Login credentials would be admin/password . If you have changed the password for ADMIN_PASSWORD, use that password to login.<br />
<br />
Once you login, you can see collapsible tiles on the left hand side if you have installed Icehouse. Familiarize yourself with it. We haven't created any instances yet.<br />
<br />
Time to check the screens. use "screen -x stack" to see the screens which are consists of different parts of openstack interacting with each other with the help of API. To jump to the next screen use "ctrl +a +n" and to jump to previous screen use "ctrl + a + p". To detach from the screens use "ctrl + a +d".<br />
To list the screens use ctrl + "<br />
<br />
Change your working directory to devstack and source the openrc file using this command<br />
<br />
<i>source openrc admin admin</i><br />
<i><br /></i>
This helps us to use the clients python-novaclient. You can also do this using the API's. Get a token from keystone, use curl to get instances using Nova API. Lets stick to the first method.<br />
<br />
Query the image id of the default cirros-0.3.1-x86_64-uec image using this command.<br />
<br />
<i>nova image-list</i><br />
<i><br /></i>
Cirros is the OS that we are going to boot in our baremetal instance. You should get something like this<br />
<br />
+--------------------------------------+---------------------------------+--------+--------+<br />
| ID | Name | Status | Server |<br />
+--------------------------------------+---------------------------------+--------+--------+<br />
| a5627443-6d18-4719-866e-62dcde0dd2b9 | bm-deploy.initramfs | ACTIVE | |<br />
| 38d47e4a-13cc-40d8-b16c-b52933a8558b | bm-deploy.kernel | ACTIVE | |<br />
| 2224b2f2-8a71-4755-a90a-f2c7945a5357 | cirros-0.3.1-x86_64-uec | ACTIVE | |<br />
| 919d95f7-8517-4759-b901-cba302d038ba | cirros-0.3.1-x86_64-uec | ACTIVE | |<br />
| 14760c82-d960-448d-80d6-d83302f0234c | cirros-0.3.1-x86_64-uec-kernel | ACTIVE | |<br />
| ce8b75e6-94e5-42bf-8a08-140a54468ec4 | cirros-0.3.1-x86_64-uec-kernel | ACTIVE | |<br />
| 8df7830c-f979-4ee3-b065-f8126f69fdc1 | cirros-0.3.1-x86_64-uec-ramdisk| ACTIVE | |<br />
| b46e49c3-7a31-4c2e-b870-7570e0dd4ba5 | cirros-0.3.1-x86_64-uec-ramdisk | ACTIVE | |<br />
+--------------------------------------+---------------------------------+--------+--------+<br />
<br />
Copy the ID of cirros-0.3.1-x86_64-uec . Create a keypair using ssh. Use ssh-keygen -t rsa to create ssh keys. Follow the onscreen instructions. The keys will be stored in a hidden directory starting with .ssh. It would contain the public and private keys, know hosts .<br />
<br />
Add the keypair to nova so that we can boot the baremetal instance.<br />
<br />
<div style="text-align: left;">
<span style="background-color: white; color: #555555; font-size: 1.1em; line-height: 1.2em;"><span style="font-family: inherit;">nova keypair-add default --pub-key ~/.ssh/id_rsa.pub</span></span></div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
Lets boot the instance</div>
<div style="text-align: left;">
<br /></div>
nova boot --flavor baremetal --image "paste the Id of cirros here" --key-name default testing<br />
<br />
The vm we are booting is of flavour baremetal with the image corresponding to the image id of cirros and the keypair corresponding to the default. You would get something like this:<br />
<br />
+--------------------------------------+-------------+---------+------------+-------------+-------------+<br />
| ID | Name | Status | Task State | Power State | Networks |<br />
+--------------------------------------+-------------+---------+------------+-------------+-------------+<br />
| 2aabb512-796b-4178-a67f-cfbdce058190 | testing | Build | Spawing | No State | |<br />
+--------------------------------------+-------------+---------+------------+-------------+-------------+<br />
<div>
<br /></div>
<div>
Since we have created three vm which were acting as three fake baremetals, we have powered on one baremetal out of them. Now check the state of baremetal instances using </div>
<div>
<br /></div>
<div>
ironic node-list</div>
<br />
+--------------------------------------+--------------------------------------+-------------+------------+<br />
| UUID | Instance UUID | Power State | Provisioning State |<br />
+--------------------------------------+--------------------------------------+-------------+------------+<br />
| a89a107d-63b4-4412-b3f1-0241fb3b0edb | None | power off | None |<br />
| f51ca8a4-c262-40b2-ad6c-288ec2a0b71a | None | power off | None |<br />
| add9a19c-6991-4bc5-8744-fd43e9f0720a | 2aabb512-796b-4178-a67f-cfbdce058190 | power on |wait call-back |<br />
+--------------------------------------+--------------------------------------+-------------+------------+<br />
<div>
<br /></div>
Note that one of the baremetal instance is powered on and its in wait call-back state.<br />
<div>
<br /></div>
<div>
Check your baremetal instance status by </div>
<div>
<br /></div>
<div>
<i>ironic node-list</i></div>
<div>
<i><br /></i></div>
<div>
<i><br /></i></div>
<div>
+--------------------------------------+-------------+---------+------------+-------------+-------------+<br />
| ID | Name | Status | Task State | Power State | Networks |<br />
+--------------------------------------+-------------+---------+------------+-------------+-------------+<br />
| 2aabb512-796b-4178-a67f-cfbdce058190 | testing | Active | - | No State | Running | private = 10.1.0.4<br />
+--------------------------------------+-------------+---------+------------+-------------+-------------+</div>
<div>
<i><br /></i>
Problem with SSH<br />
If you are facing any problem with ssh, edit the /etc/sshd_config file and uncomment the ListenAddress. Save the file and restart the service ssh.<br />
<br />
You have succesfully deployed Ironic with devstack :) </div>
<div>
<i><br /></i></div>
<div>
<i><br /></i></div>
</div>
<div style="text-align: left;">
</div>
</div>
Manishanker Thttp://www.blogger.com/profile/09355231748303010351noreply@blogger.com27Pune, Maharashtra, India18.5204303 73.85674369999992518.2795358 73.534020199999929 18.7613248 74.17946719999992tag:blogger.com,1999:blog-7208049467061137140.post-52906694980445002742014-05-24T13:14:00.001-07:002014-05-25T04:08:37.652-07:00Google Summer Of Code Intern in Openstack<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="text-align: center;">
<span style="color: lime;">Yay!! Google Summer Of Code Intern In Openstack</span></h2>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-8I7QYGQVEOw/U4D5IG5a6HI/AAAAAAAAAMk/j6EmIej6LUk/s1600/gsoc2014presentationtechexuominauguration-131214075527-phpapp02-thumbnail-4.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/-8I7QYGQVEOw/U4D5IG5a6HI/AAAAAAAAAMk/j6EmIej6LUk/s1600/gsoc2014presentationtechexuominauguration-131214075527-phpapp02-thumbnail-4.jpg" height="240" width="320" /></a></div>
<br />
<br />
The <b>Google Summer of Code</b> (<b>GSoC</b>) is an annual program, first held from May to August 2005,<sup class="reference" id="cite_ref-LinSOC_1-0"><a href="http://en.wikipedia.org/wiki/Google_Summer_of_Code#cite_note-LinSOC-1"></a></sup> in which <a href="http://en.wikipedia.org/wiki/Google" title="Google">Google</a> awards <a href="http://en.wikipedia.org/wiki/Stipend" title="Stipend">stipends</a> (of US$5,500, as of 2014)<sup class="reference" id="cite_ref-2"><a href="http://en.wikipedia.org/wiki/Google_Summer_of_Code#cite_note-2"></a></sup> to all students who successfully complete a requested <a href="http://en.wikipedia.org/wiki/Free_and_open-source_software" title="Free and open-source software">free and open-source software</a> coding project during the summer. The event draws its name from the 1967 <a href="http://en.wikipedia.org/wiki/Summer_of_Love" title="Summer of Love">Summer of Love</a> (of the 1960s <a href="http://en.wikipedia.org/wiki/Counterculture" title="Counterculture">counterculture</a>), and the idea for the SoC came directly from Google's founders, <a href="http://en.wikipedia.org/wiki/Sergey_Brin" title="Sergey Brin">Sergey Brin</a> and <a href="http://en.wikipedia.org/wiki/Larry_Page" title="Larry Page">Larry Page</a>.<br />
<br />
For the first time Openstack was selected as mentoring organization in GSOC. <a href="https://www.google-melange.com/gsoc/org2/google/gsoc2014/openstack" target="_blank">Here's</a> the list of students whose proposal got accepted for Openstack.<br />
<br />
<div style="text-align: left;">
<span style="color: lime;"><span style="color: black;">Here's my proposal link (<a href="https://wiki.openstack.org/wiki/GSoC2014/Student/Manishanker" target="_blank">link)</a></span> </span>and link to the proposed idea (<a href="https://www.google-melange.com/gsoc/project/details/google/gsoc2014/manishanker/5649050225344512" target="_blank">idea)</a> that I would be working on. I am so thankful to my mentor (<a href="http://www.linkedin.com/in/sriramhere" target="_blank">Sriram</a>) who has helped me a lot.</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
I am really excited to be a part of such awesome community. </div>
</div>
Manishanker Thttp://www.blogger.com/profile/09355231748303010351noreply@blogger.com0Pune, Maharashtra, India18.5204303 73.85674369999992518.2795358 73.534020199999929 18.7613248 74.17946719999992tag:blogger.com,1999:blog-7208049467061137140.post-35351911082061127602014-05-24T11:47:00.001-07:002014-07-16T08:21:10.822-07:00How to contribute to Openstack<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="text-align: center;">
<span style="color: #e06666;">How to contribute to Openstack</span></h2>
<div style="text-align: left;">
<span style="font-family: inherit;"><span style="color: blue;"><span style="color: black;">My contribution : <a href="http://stackalytics.com/?release=all&metric=all&project_type=openstack&user_id=shanker-mani0" target="_blank">link</a></span></span></span><br />
<br />
<span style="font-family: inherit;"><span style="color: blue;"><span style="color: black;">First of all lets answer the question who can contribute to Openstack. <b>Anyone</b></span> </span>. Yes, anyone can contribute to Openstack. Whether you are interested in developing new feature in Openstack or in Documentation or in fixing Bugs , you are welcome. That's how Open source projects work.</span></div>
<div style="text-align: left;">
<span style="font-family: inherit;"><br /></span></div>
<div style="text-align: left;">
<span style="font-family: inherit;">Lets answer another question . Why should anyone contribute to Openstack. The answer would be : To learn more about the project. By contributing you learn a lot of things. You are making the system better and helping others all over the world who use Openstack.</span></div>
<div style="text-align: left;">
<span style="font-family: inherit;"><br /></span></div>
<h4 style="text-align: left;">
<span style="font-family: inherit;">Let's begin </span></h4>
<div style="text-align: left;">
<span style="font-family: inherit;"><a href="https://wiki.openstack.org/wiki/How_To_Contribute" target="_blank">This</a> is where you should start. The link has all the information on How to contribute. All the commands used here are from that link. In case if you want more info please use the link provided in the beginning. My mentor suggested me to fix a Bug in Openstack. Bug can be a very small one like fixing a typo in the code message or it can be a <a href="https://bugs.launchpad.net/openstack" target="_blank">critical</a> one. Both are considered as contribution to Openstack. You are not fixing a typo error but you are fixing a bug in Openstack and making it better. I went with a very small bug in <a href="https://wiki.openstack.org/wiki/Sahara" target="_blank">Sahara</a> (obviously I don't have adequate knowledge to fix a critical Bug but I made my contribution with what I can do) .I had to change all the instances in the code with the word "components" with "component(s)". Seems simple ? yes it is! </span></div>
<div style="text-align: left;">
<span style="font-family: inherit;"><br /></span></div>
<div style="text-align: left;">
<span style="font-family: inherit;"><br /></span></div>
<h4 style="text-align: left;">
<span style="font-family: inherit;">Where to begin?</span></h4>
<div style="text-align: left;">
<span style="font-family: inherit;"><b>Launchpad Account</b></span></div>
<div style="text-align: left;">
<span style="font-family: inherit;"><br /></span></div>
<div style="text-align: left;">
<span style="font-family: inherit;">Launchpad has all the information about bugs, overview etc. Get a launchpad account by registering <a href="https://login.launchpad.net/" target="_blank">here</a>. Click on Openstack and you will be redirected to its main launchpad
page. All the projects in Openstack, links to documentation, irc,
mailing list etc can be found there. </span></div>
<div style="text-align: left;">
<span style="font-family: inherit;"><br /></span></div>
<div style="text-align: left;">
<span style="font-family: inherit;"><b>Join Openstack Foundation</b></span> </div>
<div style="text-align: left;">
<span style="font-family: inherit;"><br /></span></div>
<div style="text-align: left;">
<span style="font-family: inherit;">Fill out the details and join the foundation <a href="https://www.openstack.org/join/" target="_blank">link</a></span></div>
<div style="text-align: left;">
<span style="font-family: inherit;"><br /></span></div>
<div style="text-align: left;">
<span style="font-family: inherit;"><b>Log Into Gerrit Review System</b></span></div>
<div style="text-align: left;">
<span style="font-family: inherit;"><br /></span></div>
<div style="text-align: left;">
<span style="font-family: inherit;"><a href="https://review.openstack.org/" target="_blank">Login</a> here with your Launchpad account. This is where all the code reviews happen. Sign the Openstack individuals contributor License Agreement. And upload SSH keys .</span><br />
<span style="font-family: inherit;"><br /></span>
<span style="font-family: inherit;"><b>Uploading SSH keys</b></span><br />
<span style="font-family: inherit;"><br /></span>
<span style="font-family: inherit;">Once you are logged into <a href="http://review.openstack.org/">review.openstack.org</a>, click <a href="https://review.openstack.org/#/settings/" target="_blank">here</a> to upload your SSH keys. Follow this <a href="https://help.github.com/articles/generating-ssh-keys" target="_blank">link</a> to generate SSH keys. Once you have generated SSH keys, copy the <u><b>Public key </b></u>and upload it in <a href="http://review.openstack.org/">review.openstack.org</a>. Change to the directory where you have created your SSH keys, then list the contents of the folder and look for something ending in .pub which would be your public key. </span><br />
<span style="font-family: inherit;"><br /></span>
<span style="font-family: inherit;"><b>Install git </b></span><br />
<span style="font-family: inherit;"><br /></span>
<span style="font-family: inherit;">I am using Ubuntu 12.04 LTS so you can begin with opening terminal ;)</span><br />
<br />
<div style="text-align: left;">
<span style="font-family: inherit;">Open Terminal (ctrl + alt +t ) and type "sudo apt-get install git" . After installing git, use this command to check for successful installation "git --version". If you can see the version of git, then it's installed. Next set your username and email id . Type these commands in terminal.</span></div>
<div style="text-align: left;">
<br /></div>
<pre>git config --global user.name "Firstname Lastname"
git config --global user.email "your_email@youremail.com"</pre>
<pre> </pre>
<div style="text-align: left;">
To check if you have configured properly check your configuration by using this command</div>
<div style="text-align: left;">
<br /></div>
<pre>git config --list</pre>
<pre> </pre>
<div style="text-align: left;">
You would get information about your email id ,username and other details. Learn more about git <a href="http://git-scm.com/" target="_blank">here</a> </div>
<div style="text-align: left;">
<br /></div>
<h4 style="text-align: left;">
Install git-review</h4>
<div style="text-align: left;">
Install git review. Follow <a href="https://wiki.openstack.org/wiki/GerritWorkflow" target="_blank">this</a> link for different linux distros. In ubuntu it would be "sudo apt-get install git-review"</div>
<div style="text-align: left;">
<br /></div>
<h3 style="text-align: left;">
Lets track some Bugs</h3>
<div style="text-align: left;">
Login to your launchpad account and click on bugs. Out of all those bugs, low-hanging-fruit would be easy bugs to fix for beginners. Click on the low-hanging-fruit tag and select a bug which is easy to fix. Click on it, you can see its description, who reported it, which part of Openstack it is affecting and other details. Look for the Bugs which are Triaged and Confirmed and which are not assigned to any one. Triaged bugs will contain information on how to fix them in most of the cases. If you need any help understanding the bug or trying to find a fix for the bug, you can comment in the bug page or you can directly reach out to the reporter in IRC.</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
Once you have selected a bug and if you feel you could fix it assign it to yourself. <a href="https://bugs.launchpad.net/sahara/+bug/1312908" target="_blank">This</a> is the bug I assigned to myself. Next thing would be to clone the part of Openstack which has this bug.</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
I have cloned <a href="https://github.com/openstack/sahara" target="_blank">Sahara</a> since the bug was in it. To clone a project to your local machine, open terminal and then use "git clone https://github.com/openstack/urproject.git" .You would get a message cloning into <whateverproject>, receiving objects, receiving deltas then done. In my case, I would clone sahara project from github using this command : "git clone https://github.com/openstack/sahara.git". Change the directory to project " cd sahara". Next type the command "git review -s". This basically checks if you can login to Gerrit with your SSH keys. If your git username is different from your gerrit (review.openstack.org) username , use this command:</div>
<div style="text-align: left;">
<br /></div>
<pre>git config --global gitreview.username yourgerritusername</pre>
<pre> </pre>
<div style="text-align: left;">
Your gerrit username would be the one in your profile tab in review.openstack.org. To verify your configuration use git config --list. </div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
Once again verify your SSH keys , gerritusername in git config. I you get an error "We don't know where your gerrit is.", you will need to add a new git
remote. The url should be in the error message. Copy that and create the
new remote. </div>
<div style="text-align: left;">
<br /></div>
<pre>git remote add gerrit ssh://<username>@review.openstack.org:29418/openstack/urproject.git</pre>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
Next list the contents of the folder by using "ls -la" which would also list the hidden folders and files. You should see a .git hidden folder and .gitreview hidden file . Now try again "git review -s"</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
Everyone continuously make changes to the master branch in Github. To get the most updated code with all the changes use the following commands. </div>
<div style="text-align: left;">
<br /></div>
<pre>git remote update
git checkout master
git pull --ff-only origin master</pre>
<pre> </pre>
<div style="text-align: left;">
To learn more about what origin, remote, master mean use this <a href="http://gitimmersion.com/" target="_blank">link</a> . It has nice way of teaching about all the useful commands.</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
***<u>Important Steps</u>***</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
Create a <a href="http://git-scm.com/book/en/Git-Branching-Branching-Workflows#Topic-Branches" target="_blank">Topic Branch</a> . Since I am trying to fix a bug I would do git checkout -b "bug/1312908" where 1312908 is the bug id. Each bug is associated with a bug id which can be found in its page. You would see a message "switched to a new branch 'bug/<bugid>' ". Now use "git status" to check your branch. </div>
<h4 style="text-align: left;">
Fixing the Bug</h4>
<div style="text-align: left;">
Now that we have everything in place and properly configured, lets fix the bug. To fix the bug in sahara all I had to do was follow the link Sergey gave in comments of the bug page which had all the occurrences of the word components. I opened those files and changed all the occurrences. Now if you remember we are currently in branch "bug/<bugId>". <a href="https://wiki.openstack.org/wiki/GerritWorkflow#Normal_Workflow" target="_blank">Follow</a> this link to know how to run test cases. You have to run unit tests to check if everything is working.</div>
<div style="text-align: left;">
<br /></div>
<h4 style="text-align: left;">
Fixed the bug, what to do next?</h4>
<div style="text-align: left;">
Next thing would be to commit the changes that you have made to fix the bug. This is where I made a mistake and had to commit twice. Please follow <b>strictly</b> the pattern that is given in the <a href="https://wiki.openstack.org/wiki/GitCommitMessages" target="_blank">Commit messages</a> so as to same your time.<br />
<br />
Note that in most cases the Change-Id line should be automatically added
by a Gerrit commit hook that you will want to install. See <a href="https://wiki.openstack.org/wiki/Gerrit_Workflow#Project_Setup" title="Gerrit Workflow">Project Setup</a>
for details on configuring your project for Gerrit. If you already
made the commit and the Change-Id was not added, do the Gerrit setup
step and run:<br />
<br />
<pre>git commit --amend</pre>
<pre> </pre>
The commit hook will automatically add the Change-Id when you finish
amending the commit message, even if you don't actually make any
changes.
<br />
Make your changes, commit them, and submit them for review:<br />
<br />
<pre>git commit -a
git review</pre>
<pre> </pre>
<div style="text-align: left;">
<b>Caution: Do not check in changes on your master branch. Doing so
will cause merge commits when you pull new upstream changes, and merge
commits will not be accepted by Gerrit.</b> </div>
</div>
<div style="text-align: left;">
<br />
<h4 style="text-align: left;">
Submitted for review, Whats next</h4>
<div style="text-align: left;">
Once you have submitted it appears on https://review.openstack.org and wait for the code reviewers to review. More info about the review process can be found <a href="https://wiki.openstack.org/wiki/Gerrit_Workflow#Review" target="_blank">here</a> .Follow the comments and make necessary changes according to their comments. Once everything is correct it will be reviewed by core developers team and Jenkins will test all the components. You can check the status of gate jobs of your review at http://status.openstack.org/zuul/. After that it will be merged to the master branch. </div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
This was my experience of first bug fix. I have learned a lot of new things by doing this. Hope this helps :-)</div>
</div>
<span style="font-family: Georgia, "Times New Roman", serif;"><br /></span></div>
</div>
Manishanker Thttp://www.blogger.com/profile/09355231748303010351noreply@blogger.com112Pune, Maharashtra, India18.5204303 73.85674369999992518.2795358 73.534020199999929 18.7613248 74.17946719999992