Nav apraksta

Celestino Rey 9c5b25491c Cambio orden de arranque. Parar y arrancar por nombre 11 mēneši atpakaļ
.github 23108c30f6 Primer commit 11 mēneši atpakaļ
app 9c5b25491c Cambio orden de arranque. Parar y arrancar por nombre 11 mēneši atpakaļ
static 9c5b25491c Cambio orden de arranque. Parar y arrancar por nombre 11 mēneši atpakaļ
.gitignore 23108c30f6 Primer commit 11 mēneši atpakaļ
README.md 7bac142382 Interfaz gráfico para gestión 11 mēneši atpakaļ
pyproject.toml 23108c30f6 Primer commit 11 mēneši atpakaļ
requirements.txt d77665758e Crea máquina virtual sin plantilla 11 mēneši atpakaļ

README.md

VirtManager

API for managing virtual machines on Ubuntu using FastAPI and libvirt.

Installation

  1. Create and activate a virtual environment:

    python3 -m venv venv
    source venv/bin/activate
    
  2. Install dependencies:

    pip install -r requirements.txt
    
  3. Ensure libvirt and Python bindings are installed on the system:

    sudo apt install libvirt-daemon-system libvirt-dev pkg-config python3-libvirt python3-gi
    

Running the API

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

Endpoints

  • GET / : Root message
  • GET /vms : List all VMs
  • POST /vms?name={name}&memory={memory}&disk_size={disk_size}&iso={iso} : Create a new VM with specified memory (MiB), disk size (GB), and ISO for installation
  • GET /vms/{vm_id}/start : Start a VM by ID
  • GET /vms/{vm_id}/stop : Stop a VM by ID
  • DELETE /vms/{vm_name} : Delete a VM by name
  • POST /disks?name={name}&size={size} : Create a new disk image with specified size in GB