kolla-ansible/doc/source/contributor/kolla-for-openstack-development.rst
Roman Krček b327527259 Refactor dev mode
Build upon changes in kolla which change strategy of installing projects
in containers when in dev mode. This fixes problems where when package
file manifest changes, the changes were not reflected in to
devmode-enabled container.

It changes the strategy of installing projects in dev mode in containers.
Instead of bind mounting the project's git repository to the venv
of the container, the repository is bind mounted to
/dev-mode/<project_name> from which the it is installed using pip
on every startup of the container using kolla_install_projects script.

Also updates docs to reflect the changes.

Depends-On: https://review.opendev.org/c/openstack/kolla/+/925712
Closes-Bug: #1814515
Singed-off-by: Roman Krček <roman.krcek@tietoevry.com>
Change-Id: If191cd0e3fcf362ee058549a1b6c244d109b6d9a
2024-09-03 09:49:37 +02:00

1.8 KiB

Using Kolla For OpenStack Development

Kolla-ansible can be used to deploy containers in a way suitable for doing development on OpenStack services.

Heat was the first service to be supported, and so the following will use submitting a patch to Heat using Kolla as an example.

Warning

Kolla dev mode is intended for OpenStack hacking or development only. Do not use this in production!

Enabling Kolla "dev mode"

To enable dev mode for all supported services, set in /etc/kolla/globals.yml:

kolla_dev_mode: true

To enable it just for heat, set:

heat_dev_mode: true

Usage

When enabled, the source repo for the service in question will be cloned under /opt/stack/ on the target node(s). This will be bind mounted to container's /dev-mode directory. From there, it will be installed at every startup of the container using kolla_install_projects script.

After making code changes, simply restart the container to pick them up:

docker restart heat_api

Debugging

remote_pdb can be used to perform debugging with Kolla containers. First, make sure it is installed in the container in question:

docker exec -it -u root heat_api pip install remote_pdb

Then, set your breakpoint as follows:

from remote_pdb import RemotePdb
RemotePdb('127.0.0.1', 4444).set_trace()

Once you run the code(restart the container), pdb can be accessed using socat:

socat readline tcp:127.0.0.1:4444

Learn more information about remote_pdb.