Submit code to the OpenStack community _iaas

Source: Internet
Author: User
Tags configuration settings ssh ssh account virtual environment git clone hadoop mapreduce

Turn from: http://www.ibm.com/developerworks/cn/cloud/library/cl-contributecode-openstack/


Contribute your code to the OpenStack

Sheng Bo Hou, software engineer, IBM

Introduction: As OpenStack (open source cloud software) is supported, more and more individuals and businesses want to contribute to the OpenStack community. Bug reports, blueprint agreements (blueprint>

Release date: July 18, 2013
Level: Primary
Original language: English
Access Status: 1154 views
Comments: 0 (View | Add Comment-login) average score (2 ratings)
Score for this article

OpenStack is an infrastructure, service (IaaS) cloud computing project that is free open source software released under the terms of the Apache license. The project, administered by OpenStack Foundation, was established in September 2012 as an entity non-profit organization designed to promote, protect and empower OpenStack software and its communities.

Resources are managed through a dashboard that provides control to administrators and provides users with the right to configure resources through a WEB interface. This article describes how to set up accounts, set up your development environment, and how to start contributing to OpenStack.

Step 1th: Set up your Launchpad account by setting up account settings via online registration and key configuration. Launchpad is where OpenStack is used to host all of its projects. Please visit the Launchpad login page, register with your e-mail address, and choose a memorable Launchpad ID for yourself. Then visit > Figure 1. Set OpenPGP key


Set up your SSH account for Gerrit. OpenStack has applied a code review process to ensure code quality. Please visit the OpenStack Code review page and log in using your Launchpad account. Then visit the Https://review.openstack.org/#/settings/ssh-keys and upload your SSH public key.

Figure 2. Upload SSH Public key


Back to the top of the page

2nd step: Sign the CLA Agreement please join OpenStack Foundation (if you have not already joined). Use the e-mail address that you plan to contribute to the code. The primary e-mail address in the foundation profile needs to match the preferred e-mail message you set up later in the Gerrit contact. Please visit the Code Review page. Click the Sign in link located in the upper-right corner of the page. Log in Launchpad using your Launchpad ID. Unless you are a U.S. government employee (see below), please agree to individual contributor License Agreement and provide contact information. All of your names and e-mail addresses are public. If you want, you can update this contact later, but make sure that the primary e-mail address always matches the e-mail address set up for your OpenStack Foundation membership. Join OpenStack Contributors Group. You need to submit code changes as a member.

If you work as an individual contributor, then it is sufficient to perform the above steps. If you work on behalf of the company or the U.S. government, you may want to focus on some other internal approval processes that vary from company to organization. For more information, see Contributor License agreement.

Back to the top of the page

Step 3rd: Set up your local development environment to set up the ECLIPSE environment: Install the Ubuntu 11.10 or 11.10+ that comes with Python. Install Git:sudo apt-get install git. Install Eclipse. Install Eclipse's PyDev plug-in. On the Eclipse window, click Help > Install New Software. Configure Eclipse's Python interpreter. In the Work with field, enter Http://pydev.org/updates and click Add. Select PyDev. Click Next until you find the Review licences window. Accept the license Terms and click Finish. Install Eclipse's Egit plug-in. On the Eclipse window, click Help > Install New Software. In the Work with field, enter Http://download.eclipse.org/egit/updates and click Add. Select the Eclipse egit located below the Eclipse Git team Provider. Click Next until you find the Review licences window. Accept the license Terms and click Finish. Set up the code base. Use Devstack: Open a terminal, go to the destination directory, and run the following command to get the Devstack code:

git clone git://github.com/openstack-dev/devstack.git

Create a file named LOCALRC under the Devstack directory you just created. You can find information about how to configure LOCALRC on the Devstack Web site. Run./stack.sh. The default working directory is/opt/stack, and you can change it manually. After the first run Devstack is successful, you can find all the code under/opt/stack. Another method is to download a specific item instead of cloning all the items. Take the Keystone project as an example: open a terminal, go to the destination directory (for example,/opt/stack) and run the following command to obtain the Keystone code:
git clone https://github.com/openstack/keystone.git

Import a project into eclipse: Run Eclipse and set the workspace to a directory that holds all items (/opt/stack). To create a PyDev project: Click File > New > PyDev Project. Make the name the same as the item, such as Keystone, and then click Finish. Synchronize the project with Egit: In Eclipse, right-click the project (Keystone), click Team > Share Project, and then click Next and Finish. After you complete the steps above, you should see [Keystone Master] in Eclipse after the name of your project.

Run unit tests to run all unit tests on an item: Open a terminal and go to the project directory, such as Keystone. Run  ./run_tests.sh  command. When asked if you want to create a virtual environment, select Y or N. Test An example: open a terminal and go to the project directory, such as Keystone. Run the  ./run_tests.sh <file path>  command, such as  ./run_tests.sh/opt/stack/keystone/tests/test_backend.py. Test An example: open a terminal and go to the project directory, such as Keystone. Run the  ./run_tests.sh <file path>:<class name>  command, such as  ./run_tests.sh/opt/stack/keystone/ Tests/test_backend.py:commonhelpertests. Test a method: Open a terminal and go to the project directory, such as Keystone. Run the  ./run_tests.sh <file path>:<class name>.<method name>  command, such as  ./run_tests.sh/opt /stack/keystone/tests/test_backend.py:commonhelpertests.test_format_helper_raises_malformed_on_incomplete_ Format

Run all services running the OpenStack service devstack: Open a terminal and go to the Devstack directory. Run the./stack.sh command. In LOCALRC, specify the services to run, such as Enabled_services=key,c-api,c-vol,c-sch,mysql,rabbit. Run./unstack.sh closes all services. Run for the first time. After/stack.sh is successful, you can also run./rejoin-stack.sh to run all the specified services. Run the service in Eclipse. Take Keystone as an example: Set the Debug configuration for Keystone in Eclipse. Right-click All the content under the script Keystone-bin, and then click Debug> Figure 3. Debug Configuration


Set up debug configurations. Click the Arguments tab, select Other as the working directory, and enter ${workspace_loc:keystone}, as shown in Figure 4 and Figure 5.

Figure 4. Main tab Configuration




Figure 5. Arguments tab Configuration


Start Keystone: Click the Debug button on the Debug Configuration window, or run it from the Debug/run drop-down toolbar button, as shown in Figure 6.

Figure 6. Start the Keystone service


Back to the top of the page

Step 4th: Set the local Computer configuration settings git global configuration: Open a terminal. Run git config--global user.name "Firstname Lastname" command. Run git config--global user.email "your_email@youremail.com" command. Install the Git-review tool: for Ubuntu 12.04 or later, run the sudo apt-get install Git-review command in one terminal. For versions prior to Ubunu 12.04, run the sudo pip install Git-review command. Configure your project to understand Gerrit: open a terminal and go to the project directory, such as Keystone. Run the git review-s command. You will be asked to enter your Gerrit username. Please type your Launchpad ID and press the Enter key.

Back to the top of the page

5th step: OpenStack Work Flow Demo

If you find a OpenStack problem, register it as a bug. If you want to add a new feature, please register it as a blueprint. The modifications that you will add should be in the spoke version, not the major version. Also, do not mix multiple bug fixes or blueprint development in one branch version. The following workflow shows an example of a bug fix in Keystone. Submit Keystone BUG: Access to Https://launchpad.net/keystone. Click the reporting a bug, and then enter the profile and the information that you want. Click submit>https://bugs.launchpad.net/keystone/+bug/1087674 and a bug number: 1087674. Assign this bug to yourself in the assigned to column.

Figure 7. Submit a Keystone Bug


In Keystone, create a branch (branch name Bug1087674) for this bug: Open a terminal and go to the Keystone directory. Make sure that Keystone is in the main version through Git checkout master. Run the git checkout-b Bug1087674 command. Modify the Keystone code in the branch Bug1087674. Submit the code to Gerrit: Open a terminal and go to the Keystone directory. Run the git commit-a command. Enter some comments. The first paragraph should be an introduction to a sentence; The second paragraph can be a detailed description (optional); If the branch fixes a bug or a blueprint, add fixes Bug1087674 or Blueprint XXXX as the last paragraph. Run the Ctrl+o command, press the Enter key, and then run Ctrl+x. Run git review. Check for committed patches: go to https://review.openstack.org and log on using your Launchpad account. From the top horizontal navigator, click My > Changes, and then you can find the patches that you have submitted. In this demo, the link is https://review.openstack.org/#/c/17673/. This hotfix can be viewed by any user. Any developer can give a comment.

Figure 8. Review page for a submitted hotfix


Typically, this is the process of submitting a hotfix. But what if some of the developers added comments and you decided to change the branch? Here's an option: Open a terminal and go to the Keystone directory. Go to branch Bug1087674 via git checkout Bug1087674. Make further modifications to this branch. Go to the Keystone directory. Run the git commit-a–amend command. (Do not run git commit-a, otherwise there will be multiple comments submitted to Gerrit, not recommended.) If possible, please modify the annotation. Run the Ctrl+o command, and then press the Enter key and run ctrl+x. Run git review.

After this hotfix is submitted the second time, there are two patch assemblies in the link https://review.openstack.org/#/c/17673/, as shown in Figure 9.
Figure 9. History of Patch Assemblies

Also, what happens if the main branch changes when you use branch Bug1087674. Here's what you can do: open a terminal and go to the main branch via git checkout master. Update the code with GIT pull Origin master. Switch back to this branch through Git checkout Bug1087674. Refactor the code through git rebase-i master. If there is no conflict, run the git commit-a–amend command and run git review. If a conflict occurs, the terminal displays conflicting files. You can also find conflicts in Eclipse because conflicting files are marked with a red flag. Manually fix these conflicts. Continue refactoring, git rebase-continue. After the refactoring succeeds, run git commit-a–amend command and git review.

Resources

Learning how to contribute provides detailed information and steps about the contribution code.

The Gerrit workflow is a quick reference to some commands, and you need to run these commands to start working in a new repository.

OpenStack provides open source software for building private cloud and public cloud.

The OpenStack Foundation facilitates the development, distribution and adoption of OpenStack cloud operating systems.

Read more DeveloperWorks articles about OpenStack: "Enable DB2 in OpenStack" "OpenStack version Introduction to Folsom" "Deploy OpenStack Private cloud to Hadoop MapReduce In the Environment "
On the official blog of IBM OpenStack, you can find advanced information on different OpenStack projects.

In DeveloperWorks Cloud developer resources, discover and share knowledge and experience of application and service developers building projects for cloud deployment.

Focus on DeveloperWorks on Twitter.

DeveloperWorks Demo Center: Watch demos, install from products for beginners, and advanced features for seasoned developers.

Get products and technologies to evaluate IBM products in the way that works best for you: Download product trials, try products online, use products in a cloud environment, or spend hours in an SOA sandbox to learn how to efficiently implement a service-oriented architecture.

About the author

Sheng Bo Hou is a software engineer for the IBM open standards and open Source teams. Since joining IBM in 2010, he has been working on cloud computing standards. To align with IBM's support for standards and integrate open source software and development, he is currently OpenStack community involvement in creative development such as bug reporting and remediation, blueprint agreements (Blueprint engagements).

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.