Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Making your first OpenStack contribution (EuroPython)


Published on

Hands-on workshop to guide newcomers through the OpenStack contribution process. For EuroPython in Berlin, July 22rd 2014.

Published in: Software

Making your first OpenStack contribution (EuroPython)

  1. 1. Making your first contribution to OpenStack Julie Pichon, EuroPython, July 22nd 2014
  2. 2. Etherpad: Slides:
  3. 3. The Cloud
  4. 4. Compute (Nova) Object Storage (Swift) Image Service (Glance) Identity Service (Keystone) Dashboard (Horizon) Block Storage (Cinder) Networking (Neutron) Orchestration (Heat) Telemetry (Ceilometer) Database (Trove)
  5. 5. Compute (Nova) Object Storage (Swift) Image Service (Glance) Identity Service (Keystone) Dashboard (Horizon) Block Storage (Cinder) Networking (Neutron) Orchestration (Heat) Telemetry (Ceilometer) Database (Trove)
  6. 6. Compute (Nova) Object Storage (Swift) Image Service (Glance) Identity Service (Keystone) Dashboard (Horizon) Block Storage (Cinder) Networking (Neutron) Orchestration (Heat) Telemetry (Ceilometer) Database (Trove)
  7. 7. Compute (Nova) Object Storage (Swift) Image Service (Glance) Identity Service (Keystone) Dashboard (Horizon) Block Storage (Cinder) Networking (Neutron) Orchestration (Heat) Telemetry (Ceilometer) Database (Trove)
  8. 8. Compute (Nova) Object Storage (Swift) Image Service (Glance) Identity Service (Keystone) Dashboard (Horizon) Block Storage (Cinder) Networking (Neutron) (as Quantum) Orchestration (Heat) Telemetry (Ceilometer) Database (Trove)
  9. 9. Compute (Nova) Object Storage (Swift) Image Service (Glance) Identity Service (Keystone) Dashboard (Horizon) Block Storage (Cinder) Networking (Neutron) Orchestration (Heat) Telemetry (Ceilometer) Database (Trove)
  10. 10. Compute (Nova) Object Storage (Swift) Image Service (Glance) Identity Service (Keystone) Dashboard (Horizon) Block Storage (Cinder) Networking (Neutron) Orchestration (Heat) Telemetry (Ceilometer) Database (Trove)
  11. 11. Compute (Nova) Object Storage (Swift) Image Service (Glance) Identity Service (Keystone) Dashboard (Horizon) Block Storage (Cinder) Networking (Neutron) Orchestration (Heat) Telemetry (Ceilometer) Database (Trove) Meta: ● Documentation ● Quality Assurance (Tempest) ● Infrastructure (not today) Also: ● Clients
  12. 12. Nova (Compute) $ nova list Helpful trick: $ nova --debug list python-novaclient R E S T A P I s $ curl -i 'http://my_ip:5000/v2.0/tokens' -X POST -H "Accept: application/json" -H "Content-Type: application/json" -d '{"auth": {"tenantName": "demo", "passwordCredentials": {"username": "demo", "password": "123456"}}}' $ curl -i 'http://my_ip:8774/v2/project_id/servers/detail' -X GET -H "Accept: application/json"-H "X-Auth-Project-Id: demo" -H "X-Auth-Token: my_token" Keystone (Identity) R E S T A P I s
  13. 13. Session objectives ● Have all the necessary accounts and tools set up for contributing ● Know how to submit a contribution to an OpenStack component ● Understand the OpenStack contribution process ● Have a first contribution completed or underway, and know what are the next steps Also:
  14. 14. Setting up (one time only) ● Launchpad (bug tracking, single sign-on) ● The OpenStack Foundation (voting) ● Gerrit and the Contributor Licence Agreement (reviews, submitting patches) ● Keypair (so you can upload your patches to Gerrit) ● Basic check: git review -s Protip: Use the same email for all these accounts
  15. 15. contributor Launchpad sign in Gerrit sign up upload keypair OpenStack Foundation sign up compare email addresses to confirm membership Extra reading:
  16. 16. ● Launchpad – -> Register -> Create account ● The OpenStack Foundation – (Use the same email as LP) – “Affiliation:” None (unless you're here for your company!) – “Statement of interest:” e.g. “I want to contribute code”, “I want to improve the documentation”, ... ● Gerrit and the CLA – (Sign in with LP account) – Sign the Individual CLA (ICLA) ● Keypair – Upload at Bonus level Simple check (gerrit account + keypair) with git review: ● Clone a repo from or cd to /opt/stack (DevStack) ● sudo pip install git-review ● git review -s
  17. 17. DevStack tips and tricks ● What is DevStack? – Best tested on Ubuntu 12.04 and Fedora 20 – Extra reading: ● Always in a VM ● Good for testing and actually seeing ● Not a requirement for contributing though – /opt/stack/ – ● Need help troubleshooting? Ask for help on IRC. – #openstack-101, #openstack-dev (Freenode) –
  18. 18. Tip #1: Use the local.conf file
  19. 19. $ cat devstack/local.conf [[local|localrc]] OS_PASSWORD=123456 ADMIN_PASSWORD=123456 MYSQL_PASSWORD=123456 RABBIT_PASSWORD=123456 SERVICE_PASSWORD=$ADMIN_PASSWORD SERVICE_TOKEN=123456 # If you need the latest version RECLONE=yes # Can be handy to help debug failures VERBOSE=True # Neutron (naming based on Quantum) disable_service n­net enable_service q­svc q­agt q­dhcp q­l3 q­meta quantum q­lbaas (See for even more options)
  20. 20. Tip #2: On using screen ● ● screen -r, screen -ls ● Detaching the screen session: C-a, C-d ● Navigating: C-a “ ● (C-a ?)
  21. 21. Applied screen: restarting a service Example: Imagining you made a change in /opt/stack/keystone screen ­r C­a “ # Choose “key” for keystone C­c # To kill the service Press up­arrow + Enter, to restart the  last command C­a C­d # To leave
  22. 22. Tip #3: openrc files and communicating with OpenStack $ nova list $ source ~/devstack/openrc # credentials $ nova list $ nova help $ keystone user­list $ source ~/devstack/openrc admin $ openstack ­­help # New common client
  23. 23. A simple openrc example $ cat ./example_openrc export OS_USERNAME=username export OS_PASSWORD=password export OS_TENANT_NAME=projectName export OS_AUTH_URL=https://identityHost:portNumber/v2.0 See
  24. 24. Getting started Soft skills “Assume good faith.”
  25. 25. Getting started Culture ● Friendly community ● Reviewer vs. Committer team
  26. 26. Getting started Process ● +1, -1 Everyone is welcome and encouraged to participate in reviews ● +2, -2 Core reviewers team ● Continuous Integration (CI) gets a vote too ● Unit tests, integration tests, style ● To get your patch merged: ● +1 from CI ● +2 from two cores (+A)
  27. 27. the contributor guidelines Read Use the bug tracker the contributor guidelines Build the software Find the bug Fix it! Submit your patch The Open-Source contribution process
  28. 28. Sources ● Code: – /opt/stack (DevStack) – ● Docs: – – ● QA/Integration tests: – (DevStack required) –
  29. 29. How to choose a bug? ● Low hanging fruits – e.g. ● Browsing the bug tracker – e.g. ● Sometimes a project has additional docs – e.g. ● Launchpad tips and tricks: – Low priority bugs can sometimes be smaller (not always true) – Advanced search: by tag (low-hanging-fruits) – Advanced search: Assignee -> “Nobody” – Advanced search: Status New/Confirmed/Triaged – Find something that piques your interest or touches an area of knowledge Launchpad
  30. 30. ● often has a coverage flag – usually ./ ­­coverage – otherwise: ./ ­­help ● Reports should appear in a new ./reports/ directory ● Unit tests and additional non-Python requirements: have a look at the README file – e.g. for Nova: python-dev libssl-dev python-pip git-core libxml2- dev libxslt-dev pkg-config libffi-dev libpq-dev libmysqlclient-dev How to choose a bug? Adding a unit test
  31. 31. ● Find and fix a typo! ● Main docs: guides, API references, ... – – Sources: – More info on how to build the docs: ● Developer docs: within the code repositories – e.g. is generated from /doc/ at – Find a typo, fix Sphinx syntax errors... ( – Usually can build the docs with e.g. “tox -e docs” (pip install tox first) How to choose a bug? Documentation patch
  32. 32. ● Often out of date or copy-paste errors ● Projects: python-<codename>client ● Where? Usually: – python- <codename>client/<codename>client/<version>/ – Pick a resource type and read the file! ● Correct the entire file How to choose a bug? Client doc strings
  33. 33. (
  34. 34. commit ea8c9554c947b7fd30adfb1249a9317f258901ab Author: Julie Pichon <> Date:   Mon Jan 27 14:28:28 2014 +0000     Fix typos in the volumes and snapshots docstrings          Change­Id: I0e4f3813b8e263ea59e182db153c5b4c6fd2a177 diff ­­git a/cinderclient/v2/ b/cinderclient/v2/ index 524456d..7f77bb9 100644 ­­­ a/cinderclient/v2/ +++ b/cinderclient/v2/ @@ ­187,7 +187,7 @@ class VolumeManager(base.ManagerWithFind):      def get(self, volume_id):          """Get a volume.   ­        :param volume_id: The ID of the volume to delete. +        :param volume_id: The ID of the volume to get.          :rtype: :class:`Volume`          """          return self._get("/volumes/%s" % volume_id, "volume") @@ ­225,7 +225,7 @@ class VolumeManager(base.ManagerWithFind):      def update(self, volume, **kwargs):          """Update the name or description for a volume.   ­        :param volume: The :class:`Volume` to delete. +        :param volume: The :class:`Volume` to update.          """          if not kwargs:              return
  35. 35. ● ● Help with translations, break things and file bugs (DevStack), do reviews, ... ● Bug triage – This can help you find a task! – See the excellent blog post, “A path towards contributing (via commits) in OpenStack” – Bugs in “NEW” state: confirm if can reproduce (DevStack) ● Yes? Set status to CONFIRMED ● No? Ask questions, ask for clearer steps to reproduce, optionally mark “INCOMPLETE” – How to choose a bug? Other tasks
  36. 36. Now ● This should cover most non-Python dependencies: – sudo apt-get install python-dev libssl-dev libxml2-dev libxslt-dev pkg-config libffi-dev libpq-dev libmysqlclient-dev – sudo yum install python-devel openssl-devel gcc libxslt-devel mysql-devel postgresql-devel libffi-devel ● Choose a project ● Go into the repository and start ./ This will create the virtual environment in .venv and download the required dependencies ● Short Break
  37. 37. Find a task and work on it ● Browse the Launchpad bug tracker (low hanging fruit or other) – maybe better for sprints ● Increase the test coverage by adding a unit test ● Improve the docs ● Fix a client's doc strings ● Confirm bugs with DevStack ● ● ( )
  38. 38. Formatting your patch to community standards ● See “Summary of GIT commit message structure” in wiki ● Style guidelines: ● Check no pep8/hacking errors: – ./ -p ● Check the tests pass: – ./
  39. 39. Switch libvirt get_cpu_info method over to use  config APIs The get_cpu_info method in the libvirt driver  currently uses XPath queries to extract information  from the capabilities XML document. Switch this over  to use the new config class LibvirtConfigCaps. Also  provide a test case to validate the data being  returned. DocImpact Closes­Bug: #1003373 Implements: blueprint libvirt­xml­cpu­model Change­Id: I4946a16d27f712ae2adf8441ce78e6c0bb0bb657
  40. 40. Submitting a patch ● Preparing your patch – Git commit message structure, pep8, unit tests ● sudo pip install git-review ● In the repository: – git review -s ● To add a ChangeId to your existing commit: – git commit --amend – (exit editor, no need to change anything)
  41. 41. git-review ● For the cautious: – git log -n1 # check your commit has a ChangeId – git review -n # dry run, doesn't push anything out yet ● git review # sends your patch to Gerrit ● “The Gate” – Unit tests, Integration tests, style checks
  42. 42. $ git review ­n Please use the following command to send your commits to review:     git push gerrit HEAD:refs/publish/master/bug/1324982 $  git review remote: Resolving deltas: 100% (2/2) remote: Processing changes: new: 1, refs: 1, done     remote:  remote: New Changes: remote: remote:  To ssh://  * [new branch]      HEAD ­> refs/publish/master/bug/1324982
  43. 43. Gate jobs
  44. 44. git review bonus commands ● git review can help you do reviews, too – git review -l – git review -d <review_id>
  45. 45. The Next Steps ● Your patch will get reviewed, be patient ● You can help by doing reviews of other patches yourself – Learn about the project's culture and structure ● Where to ask for help? – IRC: #openstack, #openstack-dev, #openstack-101 ● – Mailing list: (filters!) ● – – Don't stay stuck! Ask for help on IRC.
  46. 46. What to do next? ● EuroPython sprints ● Re-read ● Find a slightly harder bug. After resolving one, try to leave the remaining low hanging fruits for the next newcomer. ● Review, triage, translate... Lots of ways to help! ● Respond to review feedback, if you receive any ● Join the mailing list (filters, filters), idle on IRC, become part of the community ● Summit! Conference + Design Summit. Participate in the conversation. – Next one in November in Paris – Free ticket for “ATC” –
  47. 47. What did we learn? ● What accounts are required and why ● The OpenStack development process ● Glimpse into the OpenStack developer toolbox – DevStack, Gerrit, Launchpad ● Where/How you can help ● The Life of a Contribution ● Where to ask for help ● “Next action” - plan it now – Take a couple of minutes to figure out what you want to do next and write it down
  48. 48. Questions? Feedback form: