Glance development environment

Asked by João Pereira

Hi,

I'm starting with OpenStack and most precisely with Glance, and although I've very few experience with Python, I've a very strong Ruby background so I think I can learn Python while experimenting with Glance directly.

However, I dont know what's the recommended development environment if wanting to experiment with glance in order to contribute with code improvements...

Is it better to install it with the package manager and go experimenting by editing the code in the packages installation location (I guess this is not the best option)

or is it recommended to fetch the source code from git and patch and run the code/servers manually (./bin/glance ...)? If yes, how do we handle the .ini and .conf files?

I'm seeking for best practice advices from the programmers already integrated in the project. If anyone can point me some guidelines/tools/tutorials,etc I would be grateful. I've already read the "how to contribute" wikis but cant find any guidelines about the code development environment.

Question information

Language:
English Edit question
Status:
Solved
For:
Glance Edit question
Assignee:
No assignee Edit question
Solved by:
Jay Pipes
Solved:
Last query:
Last reply:
Revision history for this message
Jay Pipes (jaypipes) said :
#1

On 07/02/2012 05:21 PM, João Pereira wrote:
> Hi,
>
> I'm starting with OpenStack and most precisely with Glance, and although I've very few experience with Python, I've a very strong Ruby background so I think I can learn Python while experimenting with Glance directly.

Hi! We always appreciate new contributors. Welcome :)

> However, I dont know what's the recommended development environment if wanting to experiment with glance in order to contribute with code improvements...
>
> Is it better to install it with the package manager and go experimenting by editing the code in the packages installation location (I guess this is not the best option)

No, absolutely not... the best way to begin contributing is to follow
the contributor guidelines and get a local Git repository set up for
developing Glance.

Start here:

http://wiki.openstack.org/GerritWorkflow

Do the following:

* Clone the Glance repo to your local workstation

git clone git://github.com/openstack/glance
cd glance

* Install all the necessary dependencies for doing development and testing

# Depends on your workstation. For Ubuntu, do:
apt-get install -y gcc libxslt-dev libxml2-dev python-dev

* Run the test suite in a virtual environment

./run_tests.sh -V

The above will create a virtualenv
(http://www.virtualenv.org/en/latest/index.html) and install all the
development stuff for Glance into the virtual environment and then run
the Glance test suite.

* Peruse the source code and read the developer documentation at
http://glance.openstack.org

After that, hop onto Freenode.net #openstack-dev and chat with the PTL,
Brian Waldon (bcwaldon) and ask about starter bugs or tasks you might be
able to take a hack at.

All the best,
-jay

> or is it recommended to fetch the source code from git and patch and run the code/servers manually (./bin/glance ...)? If yes, how do we handle the .ini and .conf files?
>
> I'm seeking for best practice advices from the programmers already integrated in the project. If anyone can point me some guidelines/tools/tutorials,etc I would be grateful. I've already read the "how to contribute" wikis but cant find any guidelines about the code development environment.
>

Revision history for this message
Stuart McLaren (stuart-mclaren) said :
#2

A related tip: if you do

mkdir ~/.pip_download_cache
export PIP_DOWNLOAD_CACHE=~/.pip_download_cache

this will save you some time since you'll only download the pip packages once ... the next time you set up your virtual environment the packages will be taken from your local cache.

More details here:

http://stackoverflow.com/questions/4806448/how-do-i-install-from-a-local-cache-with-pip

Revision history for this message
João Pereira (joaodrp) said :
#3

Jay and Stuart, thanks for the help.

I've already configured my environment as you've said to do, and I've issued 'source .venv/bin/activate' to enable the venv for digging in Glance (I think this is the easiest way?).

I've already configured a database for it (following the OpenStack CSSCorp starter guide). Now what's the best way to deploy the servers? I want to start digging the code and make some changes and then restart servers so I know if I do it wrong or not.

I've already installed glance in a server and played with it a bit (start, stop, customize conf file, etc). However I want a development environment, not a production one.

If I try to issue 'bin/glance-registry' it obviously aborts saying that it could not found the paste config file. So, should I install glance (from 'setup.py' I think), customize the conf files in place and always reinstall it whenever I make any code changes?

Or is there a way to deploy it directly from source directory (/bin) and let it know about the conf files (if there is no best options)?

Revision history for this message
João Pereira (joaodrp) said :
#4

Can anyone help on this?

Revision history for this message
João Pereira (joaodrp) said :
#5

Can anyone help on this?

Revision history for this message
João Pereira (joaodrp) said :
#6

Can anyone help on this?

Revision history for this message
João Pereira (joaodrp) said :
#7

(Sorry for the repetition mistake...)

Revision history for this message
Launchpad Janitor (janitor) said :
#8

This question was expired because it remained in the 'Open' state without activity for the last 15 days.

Revision history for this message
João Pereira (joaodrp) said :
#9

I'm still needing an answer for the last question if anyone can help on this.

Revision history for this message
Best Jay Pipes (jaypipes) said :
#10

Joao, you can create a config file and paste INI file and put them in your ~ directory. Make bind_port something that is not used on your system already (for example, don't use 9292 or 9191 since Glance uses those ports by default. Make sure that the bind_port option in your glance-registry.conf file and the registry_port option in your glance-api.conf file match.

The start the servers using tools/with_venv.sh glance-api --config-file=~/glance-api.conf &

Do similar for the glance-registry daemon.

Alternately, you can use devstack to spin up a whole OpenStack environment, and have devstack's stackrc branch file point to your local development repo. Then just run stack.sh and you will have glance-api and glance-registry servers in screen sesssions.

-jay

Revision history for this message
João Pereira (joaodrp) said :
#11

Thanks Jay Pipes, that solved my question.