OpenStack Dev Server Setup CentOS Stream 9
This guide installs DevStack on CentOS Stream 9 for the OpenStack 2024.2 (Dalmatian) release.
Step 1: System Preparation
Update the system and install build dependencies:
sudo dnf update -y
sudo dnf install -y git vim python3-devel gcc libffi-devel openssl-devel \
python3-pip python3-virtualenv screen net-tools
Disable SELinux and firewalld:
sudo setenforce 0
sudo sed -i 's/^SELINUX=enforcing/SELINUX=permissive/' /etc/selinux/config
sudo systemctl disable --now firewalld
Step 2: Create the Stack User
Create the stack user with passwordless sudo access:
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
Clone the repository and checkout the stable branch:
git clone https://opendev.org/openstack/devstack -b stable/2024.2
cd devstack
Step 4: Configure local.conf
Create local.conf with OVN networking (replace 10.0.0.10 with your host IP):
cat > local.conf <<'EOF'
[[local|localrc]]
ADMIN_PASSWORD=devstack
DATABASE_PASSWORD=devstack
RABBIT_PASSWORD=devstack
SERVICE_PASSWORD=devstack
HOST_IP=10.0.0.10
Q_AGENT=ovn
Q_ML2_PLUGIN_MECHANISM_DRIVERS=ovn
Q_ML2_TENANT_NETWORK_TYPE=geneve
OVN_L3_CREATE_PUBLIC_NETWORK=true
enable_service placement-api
enable_service tempest
RECLONE=False
LOGFILE=/opt/stack/logs/stack.sh.log
LOG_COLOR=True
VERBOSE=True
EOF
Step 5: Run DevStack
Execute the installation script:
./stack.sh
Step 6: Verify the Installation
Source credentials and verify services:
source openrc admin admin
openstack service list
openstack endpoint list
openstack hypervisor list
Development Workflow
Clone and setup project:
pip3 install git-review
cd /opt/stack
git clone https://opendev.org/openstack/nova
cd nova
git review -s
Create branch and commit:
git checkout -b my-feature stable/2024.2
git add .
git commit -m "Add my feature"
Run tests:
pip3 install tox
tox -e py311
tox -e py311 -- nova.tests.unit.test_my_feature
tox -e pep8
Run integration tests:
source openrc admin admin
tempest run --smoke
tempest run --regex tempest.api.compute.servers
Apply Gerrit patch:
cd /opt/stack/nova
git review -d <change-number>
sudo systemctl restart devstack@n-api
Debugging
Run a service manually with pdb:
sudo systemctl stop devstack@n-api
cd /opt/stack/nova
python3 -m nova.cmd.api
Add remote debugging to code:
import remote_pdb
remote_pdb.set_trace('0.0.0.0', 4444)
Connect via telnet localhost 4444.
Troubleshooting
- Pip failures:
pip3 install -U pip setuptools - SELinux blocking: Verify
getenforcereturnsPermissive - OVN failures: Check
journalctl -u ovs-vswitchdandjournalctl -u ovn-controller - Tempest errors: Ensure
tempestis installed in the virtual environment - RECLONE errors: Set
RECLONE=Falseinlocal.conf