You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: Revise README to include OpenStack integration instructions and mode configuration
- Added details for switching between mock and real OpenStack modes.
- Documented OpenStack SDK usage, credential setup, and API testing steps.
- Updated examples for VM creation with mandatory network parameter.
- Clarified testing instructions for unit and integration tests.
@@ -30,7 +30,9 @@ A REST API for managing OpenStack virtual machine lifecycle operations, built wi
30
30
31
31
This project provides a comprehensive REST API for managing virtual machine lifecycle in an OpenStack environment. It implements core CRUD operations plus advanced lifecycle management (start, stop, restart, pause, resume) with proper state management and validation.
32
32
33
-
**Note:** This is a proof-of-concept implementation using mock OpenStack integration. It demonstrates API design and architecture patterns suitable for production use.
33
+
**Implementation Modes:**
34
+
-**Mock Mode** (default): In-memory storage for development and testing
35
+
-**Real OpenStack Mode**: Connect to DevStack or production OpenStack deployment
34
36
35
37
## Features
36
38
@@ -105,15 +107,122 @@ source .venv/bin/activate
105
107
pip install -r requirements.txt
106
108
```
107
109
108
-
### 4. Configure Environment (Optional)
110
+
### 4. Configure Environment
109
111
110
112
```bash
111
113
# Copy example environment file
112
114
cp .env.example .env
113
115
114
-
# Edit .env with your settings (if needed)
116
+
# Edit .env with your settings
117
+
# For mock mode (default): No changes needed
118
+
# For OpenStack mode: See "OpenStack Integration" section below
115
119
```
116
120
121
+
## OpenStack Integration
122
+
123
+
### Using Mock Mode (Default)
124
+
125
+
By default, the API uses an in-memory mock implementation. No additional configuration needed.
126
+
127
+
```bash
128
+
# .env file
129
+
USE_REAL_OPENSTACK=False
130
+
```
131
+
132
+
### Using Real OpenStack (DevStack or Production)
133
+
134
+
To connect to a real OpenStack deployment:
135
+
136
+
#### 1. Install OpenStack SDK
137
+
138
+
Already included in `requirements.txt`:
139
+
```bash
140
+
pip install openstacksdk
141
+
```
142
+
143
+
#### 2. Configure OpenStack Credentials
144
+
145
+
Edit your `.env` file with your OpenStack credentials:
146
+
147
+
```bash
148
+
# Enable real OpenStack mode
149
+
USE_REAL_OPENSTACK=True
150
+
151
+
# DevStack Configuration (typical local setup)
152
+
OPENSTACK_AUTH_URL=http://localhost/identity
153
+
OPENSTACK_USERNAME=admin
154
+
OPENSTACK_PASSWORD=devstack
155
+
OPENSTACK_PROJECT_NAME=demo
156
+
OPENSTACK_PROJECT_DOMAIN_NAME=Default
157
+
OPENSTACK_USER_DOMAIN_NAME=Default
158
+
OPENSTACK_REGION_NAME=RegionOne
159
+
```
160
+
161
+
**Note:** For DevStack, the default admin password is typically `devstack`. Check your DevStack configuration if different.
162
+
163
+
#### 3. Verify OpenStack Connection
164
+
165
+
Before starting the API, verify your OpenStack credentials work:
166
+
167
+
```bash
168
+
# Install OpenStack CLI (optional, for testing)
169
+
pip install python-openstackclient
170
+
171
+
# Find your DevStack identity endpoint (usually NOT localhost)
172
+
openstack endpoint list | grep identity
173
+
# Example output: http://192.168.2.110/identity
174
+
175
+
# Test connection (replace URL with your endpoint)
0 commit comments