blob: 957de9b0e1337e7df0f6059bda0b7f1478d507b4 [file] [log] [blame]
Sean Daguebd6614a2016-08-11 09:05:16 -04001==========================
2 Developing with Devstack
3==========================
4
5Now that you have your nifty DevStack up and running, what can you do
6with it?
7
8Inspecting Services
9===================
10
Sean Dague8b8441f2017-05-02 06:14:11 -040011By default most services in DevStack are running as `systemd` units
12named `devstack@$servicename.service`. You can see running services
13with.
Sean Daguebd6614a2016-08-11 09:05:16 -040014
15.. code-block:: bash
16
Ian Y. Choic2200bc2017-05-04 21:13:29 +020017 sudo systemctl status "devstack@*"
Sean Daguebd6614a2016-08-11 09:05:16 -040018
Sean Dague8b8441f2017-05-02 06:14:11 -040019To learn more about the basics of systemd, see :doc:`/systemd`
Sean Daguebd6614a2016-08-11 09:05:16 -040020
21Patching a Service
22==================
23
24If you want to make a quick change to a running service the easiest
Sean Dague8b8441f2017-05-02 06:14:11 -040025way to do that is to change the code directly in /opt/stack/$service
26and then restart the affected daemons.
Sean Daguebd6614a2016-08-11 09:05:16 -040027
Sean Dague8b8441f2017-05-02 06:14:11 -040028.. code-block:: bash
Sean Daguebd6614a2016-08-11 09:05:16 -040029
Ian Y. Choic2200bc2017-05-04 21:13:29 +020030 sudo systemctl restart devstack@n-cpu.service
Sean Dague8b8441f2017-05-02 06:14:11 -040031
32If your change impacts more than one daemon you can restart by
33wildcard as well.
34
35.. code-block:: bash
36
Ian Y. Choic2200bc2017-05-04 21:13:29 +020037 sudo systemctl restart "devstack@n-*"
Sean Daguebd6614a2016-08-11 09:05:16 -040038
39.. warning::
40
41 All changes you are making are in checked out git trees that
42 DevStack thinks it has full control over. Uncommitted work, or
43 work committed to the master branch, may be overwritten during
44 subsequent DevStack runs.
45
46Testing a Patch Series
47======================
48
49When testing a larger set of patches, or patches that will impact more
50than one service within a project, it is often less confusing to use
51custom git locations, and make all your changes in a dedicated git
52tree.
53
54In your ``local.conf`` you can add ``**_REPO``, ``**_BRANCH`` for most projects
55to use a custom git tree instead of the default upstream ones.
56
57For instance:
58
59.. code-block:: bash
60
61 [[local|localrc]]
62 NOVA_REPO=/home/sdague/nova
63 NOVA_BRANCH=fold_disk_config
64
65Will use a custom git tree and branch when doing any devstack
66operations, such as ``stack.sh``.
67
68When testing complicated changes committing to these trees, then doing
69``./unstack.sh && ./stack.sh`` is often a valuable way to
70iterate. This does take longer per iteration than direct patching, as
71the whole devstack needs to rebuild.
72
73You can use this same approach to test patches that are up for review
74in gerrit by using the ref name that gerrit assigns to each change.
75
76.. code-block:: bash
77
78 [[local|localrc]]
79 NOVA_BRANCH=refs/changes/10/353710/1
80
81
Sean Daguebd6614a2016-08-11 09:05:16 -040082Testing Changes to Libraries
83============================
84
85When testing changes to libraries consumed by OpenStack services (such
86as oslo or any of the python-fooclient libraries) things are a little
87more complicated. By default we only test with released versions of
88these libraries that are on pypi.
89
90You must first override this with the setting ``LIBS_FROM_GIT``. This
91will enable your DevStack with the git version of that library instead
92of the released version.
93
94After that point you can also specify ``**_REPO``, ``**_BRANCH`` to use
95your changes instead of just upstream master.
96
97.. code-block:: bash
98
99 [[local|localrc]]
100 LIBS_FROM_GIT=oslo.policy
101 OSLOPOLICY_REPO=/home/sdague/oslo.policy
102 OSLOPOLICY_BRANCH=better_exception
103
Sean Dague8b8441f2017-05-02 06:14:11 -0400104As libraries are not installed `editable` by pip, after you make any
105local changes you will need to:
Sean Daguebd6614a2016-08-11 09:05:16 -0400106
Sean Dague8b8441f2017-05-02 06:14:11 -0400107* cd to top of library path
108* sudo pip install -U .
109* restart all services you want to use the new library
110
111You can do that with wildcards such as
112
113.. code-block:: bash
114
Ian Y. Choic2200bc2017-05-04 21:13:29 +0200115 sudo systemctl restart "devstack@n-*"
Sean Dague8b8441f2017-05-02 06:14:11 -0400116
117which will restart all nova services.