OpenStack Dev Server Setup CentOS
Setting up an OpenStack development environment on CentOS Stream 9 lets you contribute to OpenStack projects, test patches, and explore the codebase. This guide walks through installing DevStack on CentOS Stream 9 for OpenStack 2024.2 Dalmatian development.
Why CentOS Stream 9?
CentOS Stream 9 is the upstream for RHEL 9 and is a first-class OpenStack development platform. Many OpenStack CI jobs run on CentOS Stream, making it ideal for testing patches that will run in RHEL-based production environments.
Prerequisites
| Requirement | Minimum |
|---|---|
| OS | CentOS Stream 9 (fresh install) |
| RAM | 8 GB (16 GB recommended) |
| Disk | 60 GB free |
| CPU | 4 cores |
| Network | Internet access |
Step 1: System Preparation
Update the system and install essential tools:
sudo dnf update -y
sudo dnf install -y git vim python3-devel gcc libffi-devel openssl-devel
Disable SELinux (required for DevStack):
sudo setenforce 0
sudo sed -i 's/^SELINUX=enforcing/SELINUX=permissive/' /etc/selinux/config
Disable firewalld (DevStack manages its own iptables rules):
sudo systemctl disable --now firewalld
Step 2: Create the Stack User
sudo useradd -s /bin/bash -d /opt/stack -m stack
sudo chmod +x /opt/stack
echo "stack ALL=(ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/stack
sudo -u stack -i
Step 3: Clone DevStack
git clone https://opendev.org/openstack/devstack -b stable/2024.2
cd devstack
Step 4: Configure local.conf
cat > local.conf <<'EOF'
[[local|localrc]]
ADMIN_PASSWORD=devstack
DATABASE_PASSWORD=devstack
RABBIT_PASSWORD=devstack
SERVICE_PASSWORD=devstack
HOST_IP=10.0.0.10
# Use OVN for networking
Q_AGENT=ovn
Q_ML2_PLUGIN_MECHANISM_DRIVERS=ovn
Q_ML2_TENANT_NETWORK_TYPE=geneve
OVN_L3_CREATE_PUBLIC_NETWORK=true
# Enable services for development
enable_service placement-api
enable_service tempest
# Development settings
RECLONE=False
LOGFILE=/opt/stack/logs/stack.sh.log
LOG_COLOR=True
VERBOSE=True
EOF
Step 5: Run DevStack
./stack.sh
This takes 30–60 minutes on CentOS Stream 9. It installs all dependencies, databases, message queues, and OpenStack services.
Step 6: Verify the Installation
source openrc admin admin
openstack service list
openstack endpoint list
openstack hypervisor list
Setting Up the Development Workflow
Clone an OpenStack Project
OpenStack uses Gerrit for code review. Set up git-review:
sudo dnf install -y python3-pip
pip3 install git-review
cd /opt/stack
git clone https://opendev.org/openstack/nova
cd nova
git review -s # configure Gerrit remote
Create a Development Branch
git checkout -b my-feature stable/2024.2
# Make changes...
git add .
git commit -m "Add my feature"
Run Unit Tests
# Install tox
pip3 install tox
# Run all unit tests
tox -e py311
# Run a specific test
tox -e py311 -- nova.tests.unit.test_my_feature
# Run style checks
tox -e pep8
Run Integration Tests with Tempest
source openrc admin admin
tempest run --smoke
tempest run --regex tempest.api.compute.servers
Apply and Test a Gerrit Patch
cd /opt/stack/nova
git review -d <change-number> # download a patch
sudo systemctl restart devstack@n-api # restart Nova API to pick up changes
Development Tools
| Tool | Purpose |
|---|---|
tox |
Run tests in isolated environments |
git-review |
Submit and download Gerrit patches |
oslo.log |
Check service logs in /opt/stack/logs/ |
python-openstackclient |
CLI for testing API changes |
tempest |
Integration test framework |
pdb / remote-pdb |
Python debugger for services |
Debugging a Service
To attach a debugger to a running service:
# Stop the service
sudo systemctl stop devstack@n-api
# Run manually in foreground with pdb
cd /opt/stack/nova
python3 -m nova.cmd.api
Or use remote-pdb for debugging inside screen sessions:
import remote_pdb; remote_pdb.set_trace('0.0.0.0', 4444)
Connect: telnet localhost 4444
Troubleshooting
| Issue | Fix |
|---|---|
stack.sh fails at pip |
Upgrade pip: pip3 install -U pip setuptools |
| SELinux blocking services | Ensure SELinux is permissive |
| OVN fails to start | Check ovs-vswitchd and ovn-controller logs |
| Tempest import errors | Install: pip install tempest in the venv |
RECLONE errors |
Set RECLONE=False and clean stale repos manually |
Summary
CentOS Stream 9 provides an enterprise-aligned development platform for OpenStack. DevStack gives you a working cloud to develop against, while tox, git-review, and Tempest form the standard OpenStack development workflow.