API for managing virtual machines on Ubuntu using FastAPI and libvirt.
Create and activate a virtual environment:
python3 -m venv venv
source venv/bin/activate
Install dependencies:
pip install -r requirements.txt
Ensure libvirt and Python bindings are installed on the system:
sudo apt install libvirt-daemon-system libvirt-dev pkg-config python3-libvirt python3-gi
Set the environment variable for the images path if needed (default is /var/lib/libvirt/images):
export LIBVIRT_IMAGES_PATH=/path/to/images
source venv/bin/activate
uvicorn app.main:app --reload --host 0.0.0.0
The API will be available at http://0.0.0.0:8000
Access the web interface at http://0.0.0.0:8000
Access the interactive documentation at http://0.0.0.0:8000/docs