Openstack WorkShop Day II

OpenStack Development

 Creating OpenStack dev environment using DevStack

Devstack is a shell script used to deploy a complete OpenStack development environment.
  • Clone the devstack repo which contains a script that will install OpenStack.
      $    git clone https://github.com/openstack-dev/devstack.git
  • Now you will find a devstack directory where you cloned the repo
      $ cd devstack
  • Run the script to install OpenStack
       $ ./stack.sh
    
    


What the scripts do?

  • stack.sh: We have run this script initially to install Openstack.
  • unstack.sh: Stops all the services started by stack.sh (mostly) mysql and rabbit are left running as OpenStack code refreshes do not require them to be restarted.
  • rejoin-stack.sh: This script rejoins an existing screen, or re-creates a screen session from a previous run of stack.sh.
  • run_test.sh: Runs style checking tools in devstack.
  • clean.sh: Does its best to eradicate traces of a Grenade run.
  • exercise.sh: This script runs all the examples present in the devstack/exercises directory and reports on the results.

Default services provided by Devstack

  • Nova (API, Certificate, Object Store, Compute, Network, Scheduler, VNC proxies, Certificate Authentication)
  • Cinder (Scheduler, API, Volume)
  • Glance (API and Registry)
  • Horizon
  • Keystone
  • MYSQL
  • RabbitMQ
  • Tempest

Adding additional OpenStack services to Devstack


  • Additional services that are not enabled by default can be enabled in the local.config.
  • Examples:
    • Swift - Object Storage
        ENABLED_SERVICES+=,s-proxy,s-object,s-container,s-account
    • Ceilometer - Metering Service
        ENABLED_SERVICES+=,ceilometer-acompute,ceilometer-acentral,
        ceilometer-collector,ceilometer-api
        ENABLED_SERVICES+=,ceilometer-alarm-notify,ceilometer-alarm-eval
    • Neutron - Networking Service
        ENABLED_SERVICES+=,q-svc,q-agt,q-dhcp,q-l3,q-meta,neutron

Where is the code?

  • All the code related to OpenStack will be found here in
      /opt/stack/project_name

Openstack workflow management tools

  • Gerrit- Web-based code review tool built on top of the git version control system intended to provide a light weight framework for reviewing every commit before it is accepted into the code base
  • Launchpad - The web interface for the Gerrit Code Review system will identify you using launchpad https://launchpad.net/
  • Code Review - Web interface for Gerrit https://review.openstack.org
  • "git-review"- Tool which is a git subcommand that handles all the details of working with Gerrit

Workflow







Setting up required accounts for contributing to OpenStack


Setting your local environment to contribute upstream

  • Create an ssh-key on your machine
      ssh-kegen
  • Upload an ssh-key to Gerrit at review.openstack.org as well as in launchpad.net
      cat ~/.ssh/id_rsa.pub
  • Run these steps to let git know about your email address:
      git config --global user.name "Firstname Lastname"
      git config --global user.email "your_email@youremail.com"
  • Install git-review
      pip install git-review


Sending a patch Upstream!! (This is for testing in sandbox)


  • Clone the project repository you want to work on:
     git clone git://git.openstack.org/openstack-dev/sandbox
    • Sandbox: This is a sandbox so that lovely developers can test the tools and processes used for OpenStack development.
  • $ git status

    Go to the project directory:
      cd sandbox
  • Make change in any file and save
    vi test.py
    add print "This is Ohelig Pojke"
    $git status

    Make git-review configure your project to know about your Gerrit
      git review -s
    If you want to move the configuration to next branch instead of master branch.
    Make the branch.
     
    $git chechout -b test_branch 

Sending a patch Upstream!!

 Now make the changes you want to the project

Add the files to which you have made changes

To move the file or entire which are made changed. 
If you want to add all the change file then
$ git add
If you want to add any file then type
$git add test.py
If you want to send a commit message along with patch
Commit your changes
$git commit -a 
You will get a new file where you have to give an appropriate bug and fix what you have done.
Note: If you face problem while executing 
$ git review -s
Make sure you have uploaded your ssh key in https://review.openstack.org/
If you want to
$git commit -a amend
Change-Id: I5f5c3c35321da0ee572021a956a6c5e1aa48441b
ctrl+o <enter> ctrl+x
Push your changes upstream
$git review



Reference: blog.sayalilunkad.com/

No comments:

Post a Comment