Documentation Index
Fetch the complete documentation index at: https://mintlify.com/markitobonito/cloud_repositorio/llms.txt
Use this file to discover all available pages before exploring further.
DeploymentAPI orchestrates VM object creation: it assigns VNC ports, generates MAC addresses, creates network interface objects, and delegates QCOW2 image creation to QCOWManager. It does not communicate directly with worker nodes beyond what QCOWManager needs during image provisioning.
DeploymentAPI
__init__(remote_executor, base_image_path=None)
A
RemoteExecutor instance used by the internal QCOWManager to check for and copy base images on worker nodes.Optional override for the base image path. When
None, the path is taken from the flavor specification at VM creation time.vnc_port_counter = 5900. The counter is incremented before assignment, so the first VM created gets port 5901.
generate_unique_macs(vm_id, count=3) → list[str]
Generates a list of deterministic MAC addresses derived from vm_id.
The VM’s numeric identifier. Used to populate bytes 4 and 5 of the MAC address.
Number of MAC addresses to generate. Each address differs only in the last byte (the interface index).
i is the zero-based interface index.
Example for vm_id=1001 (0x3E9)
| Index | MAC address |
|---|---|
| 0 | 52:54:00:03:e9:00 |
| 1 | 52:54:00:03:e9:01 |
| 2 | 52:54:00:03:e9:02 |
create_vm_with_qcow(slice_id, vm_id, vm_name, owner, worker_ip, flavor, data_interfaces_count, internet_enabled=False) → (bool, VM | None)
Creates a VM object with all interfaces and a QCOW2 backing image on the target worker.
Slice this VM belongs to (informational; not stored on the VM object itself).
Unique VM identifier, used for MAC generation and as part of the TAP device name at launch time.
Human-readable name, used as the QCOW2 image filename prefix.
Username of the slice owner, stored on the
VM object.IP address of the worker node where the QCOW2 image is created and the VM will later run.
Flavor specification dict with keys
cores (int), ram_gb (float), disk_gb (float), and image (str — base image path). Use Flavor.get("cirros") or Flavor.get("ubuntu") to obtain a valid dict.Number of data interfaces (
eth1…ethN) to create in addition to eth0.When
True, eth0 is assigned vlan_id=400 and an ip_config dict with IP 10.60.7.{100 + vm_id % 100}. When False, eth0 has vlan_id=None and ip_config=None.| Interface | vlan_id | ip_config | link_id |
|---|---|---|---|
eth0 | 400 or None | Set if internet, else None | — |
eth1…ethN | None | None | None |
(True, VM)—VMobject withstatus="design"and the QCOW2 image path populated.(False, None)— QCOW2 image creation failed or an unexpected exception occurred.
delete_vm_dict(vm_dict) → bool
Deletes the QCOW2 image associated with a serialized VM dict.
A dict as produced by
VM.to_dict(). The keys qcow_image and worker_ip are used; if qcow_image is None or absent the call is a no-op and returns True.True on success or when there is no image to delete. False on exception.
QCOWManager
QCOWManager manages the QCOW2 image lifecycle on remote worker nodes. It is constructed automatically inside DeploymentAPI.__init__ and is not typically used directly.
__init__(remote_executor, base_dir="~/vm_images")
Used for SSH commands to the worker node.
Directory on the worker where base images and per-VM images are stored.
create_backing_image(worker_ip, vm_name, base_image_path, vlan_ids) → (bool, str | None)
Ensures the base image is present on the worker, then creates a thin-provisioned QCOW2 overlay.
Target worker node IP.
Used to name the overlay image
{vm_name}_img.qcow2.Full path to the base image on the manager host, e.g.
/tmp/vm_images/cirros-0.6.2-x86_64-disk.img. The basename is derived with os.path.basename().Currently unused by the method body. Reserved for future use.
Copy if missing
If the base image is absent, runs
scp {base_image_path} ubuntu@{worker_ip}:~/vm_images/ from the manager host. Timeout: 60 seconds.(True, "~/vm_images/{vm_name}_img.qcow2")on success.(False, None)if the SCP transfer orqemu-imgcommand fails.
delete_image(worker_ip, image_path) → bool
Removes a QCOW2 image from the worker.
Worker node IP.
Path to the image on the worker, e.g.
"~/vm_images/vm1_img.qcow2".rm -f {image_path} via SSH. Returns True on success, False on exception.