devstack/doc/source/development.rst
Ian Y. Choi c2200bc880 Fix systemctl option: removes --unit option in doc
--unit option is for journalctl, not systemctl.
Just executing systemctl without "--unit=" works.

Change-Id: I9752561332e62ec6327b17b12d2d868892718041
2017-05-04 21:17:40 +02:00

3.2 KiB

Developing with Devstack

Now that you have your nifty DevStack up and running, what can you do with it?

Inspecting Services

By default most services in DevStack are running as systemd units named devstack@$servicename.service. You can see running services with.

sudo systemctl status "devstack@*"

To learn more about the basics of systemd, see /systemd

Patching a Service

If you want to make a quick change to a running service the easiest way to do that is to change the code directly in /opt/stack/$service and then restart the affected daemons.

sudo systemctl restart devstack@n-cpu.service

If your change impacts more than one daemon you can restart by wildcard as well.

sudo systemctl restart "devstack@n-*"

Warning

All changes you are making are in checked out git trees that DevStack thinks it has full control over. Uncommitted work, or work committed to the master branch, may be overwritten during subsequent DevStack runs.

Testing a Patch Series

When testing a larger set of patches, or patches that will impact more than one service within a project, it is often less confusing to use custom git locations, and make all your changes in a dedicated git tree.

In your local.conf you can add **_REPO, **_BRANCH for most projects to use a custom git tree instead of the default upstream ones.

For instance:

[[local|localrc]]
NOVA_REPO=/home/sdague/nova
NOVA_BRANCH=fold_disk_config

Will use a custom git tree and branch when doing any devstack operations, such as stack.sh.

When testing complicated changes committing to these trees, then doing ./unstack.sh && ./stack.sh is often a valuable way to iterate. This does take longer per iteration than direct patching, as the whole devstack needs to rebuild.

You can use this same approach to test patches that are up for review in gerrit by using the ref name that gerrit assigns to each change.

[[local|localrc]]
NOVA_BRANCH=refs/changes/10/353710/1

Testing Changes to Libraries

When testing changes to libraries consumed by OpenStack services (such as oslo or any of the python-fooclient libraries) things are a little more complicated. By default we only test with released versions of these libraries that are on pypi.

You must first override this with the setting LIBS_FROM_GIT. This will enable your DevStack with the git version of that library instead of the released version.

After that point you can also specify **_REPO, **_BRANCH to use your changes instead of just upstream master.

[[local|localrc]]
LIBS_FROM_GIT=oslo.policy
OSLOPOLICY_REPO=/home/sdague/oslo.policy
OSLOPOLICY_BRANCH=better_exception

As libraries are not installed editable by pip, after you make any local changes you will need to:

  • cd to top of library path
  • sudo pip install -U .
  • restart all services you want to use the new library

You can do that with wildcards such as

sudo systemctl restart "devstack@n-*"

which will restart all nova services.