UCS SAN Builder
Background
I started this project to automate UCS SAN access end-to-end in our lab. A UCS server profile’s vHBA WWPNs (read from Intersight) become the single source of truth for everything downstream: device-aliases and zoning on the MDS switches per fabric, then granting those WWPNs access to the target LUNs on the storage array. One guided workflow, instead of three UIs and a lot of manual WWPN copy-pasting.
It was also a good excuse to experiment with vibe coding — letting an AI assistant take the lead on the parts where I’m less fluent. The Python/Django backend is my comfort zone; the frontend (HTML/CSS/JS templates) is mostly vibe-coded, so apologies in advance to HTML/CSS purists if a few <div>s make you wince.
Overview

UCS SAN Builder is a Django web app that orchestrates SAN provisioning across Intersight, a pair of MDS switches, and a storage array in a single run. Once your devices are registered, the “build” workflow does the following:
-
Intersight — lists the Organizations and Server Profiles, then for the chosen profile reads its vHBAs and pulls each one’s WWPN, fabric assignment (A / B), and VSAN.
-
MDS Fabric A and Fabric B — for each host WWPN it creates a device-alias, commits the device-alias database, builds or updates a zone containing the host WWPN(s) plus the storage target WWPN(s) for that fabric, adds the zone to the active zoneset, and activates the zoneset.
-
Storage array — groups the host WWPNs together and gives them access to the target LUNs:
- NetApp ONTAP — creates an initiator group populated with the host’s WWPNs on the chosen SVM, then maps the target LUN(s) to that igroup. Optionally creates the boot LUN inside a chosen volume first.
- Hitachi VSP — creates a host group on the selected target port(s), adds the host’s WWPNs to it, then maps the target volume(s) to that host group.
-
Deployment record — every run is persisted with a timestamp, the source server profile, the target storage, per-step status, structured logs, and the payloads pushed to each device — browsable from the deployment history page.
Tech Stack
- Backend: Python 3.13, Django 6
- Device SDKs/APIs:
intersight (Cisco Intersight SDK), NX-API (Cisco MDS), ONTAP REST (NetApp), Hitachi VSP REST
- Frontend: Django templates + vanilla HTML/CSS/JS (vibe-coded, see above)
- Packaging: uv (
pyproject.toml + uv.lock)
- Runtime: Docker / Docker Compose, SQLite
Quick Start (local, without Docker)
Requires Python 3.13 and uv.
# copy the env template and edit values (see Configuration below)
cp .env.example .env
# install dependencies into a local .venv
uv sync
# apply migrations
uv run python manage.py migrate
# create an admin user (optional, for the Django admin)
uv run python manage.py createsuperuser
# run the dev server
uv run python manage.py runserver
App is then available at http://localhost:8000.
Configuration
All runtime settings are read from environment variables. Copy .env.example to .env and edit it before starting the app (locally or via Docker):
cp .env.example .env
| Variable |
Purpose |
DJANGO_DEBUG |
True for development, False for production. |
DJANGO_SECRET_KEY |
Django secret key. Must be changed in production. |
DJANGO_ALLOWED_HOSTS |
Comma-separated list of allowed hostnames / IPs. |
Generate a fresh secret key with:
python -c 'from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())'
Device credentials (Intersight API keys, MDS / storage usernames and passwords) are entered through the web UI and stored in the database.
Usage
- Open the app and go to Devices to add your MDS switches (one per fabric). Mark one as default per fabric.
- Go to Intersight to add your Intersight account (SaaS or Appliance) and test connectivity. Mark one as default.
- Go to Storage to add your NetApp or Hitachi arrays. Mark one as default.
- Go to Build to launch the wizard: pick an Intersight org → server profile → vHBAs → target storage / LUNs → deploy.
- Follow the live progress on the Deploy progress page; review past runs under deployment history.
Docker
Make sure you have a .env file at the project root first (see Configuration).
Run
docker-compose up -d --build
App is available at http://localhost:8000. SQLite data persists in ./data (mounted as a volume).
Logs / stop:
docker-compose logs -f web
docker-compose down
Production hardening
Before exposing the app outside the lab, make sure your .env has:
DJANGO_DEBUG=False
- a strong, freshly generated
DJANGO_SECRET_KEY
DJANGO_ALLOWED_HOSTS set to your real hostname(s) / IP(s)
Then put a reverse proxy (Nginx / Traefik) in front for HTTPS.
Disclaimer
This is a lab / internal tool. It is not an official Cisco, NetApp, or Hitachi product and is not affiliated with or endorsed by any of them.
评论