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.
VMLauncher builds and executes QEMU command lines on remote worker nodes via SSH. For each VM interface that has a VLAN assignment, it creates a TAP device, connects it to OVS with the correct VLAN tag, and passes it to QEMU as a tap netdev. All network setup and QEMU execution are performed through RemoteExecutor.
VMLauncher
__init__(remote_executor)
Used for all SSH commands to worker nodes.
launch_vm(worker_ip, vm_dict) → (bool, str | None)
Launches a QEMU/KVM VM on the specified worker node.
IP of the worker node where the VM will run.
Serialized VM dict as produced by
VM.to_dict(). The following keys are used:TAP setup (per interface with a vlan_id)
For each interface where If TAP creation fails, the interface is skipped (logged as an error) but the launch continues.
vlan_id is not None:QEMU command construction
Builds the QEMU command with
-enable-kvm, -m {ram_mb}, -smp {cores}, -vnc 0.0.0.0:{vnc_port - 5900}, one -netdev/-device pair per configured TAP, -drive file={qcow_image},format=qcow2, and -daemonize.(True, pid_str)— VM is running;pid_stris the string PID.(False, None)— QEMU failed to start or an exception occurred.
vm1 with vm_id=1001, one interface on VLAN 101, 512 MB RAM, 1 vCPU, and VNC on port 5901:
stop_vm(worker_ip, vm_dict) → bool
Stops a running QEMU VM and cleans up its TAP devices.
Worker node where the VM is running.
Serialized VM dict. Keys used:
vm_id, name, interfaces.- Kills the QEMU process:
sudo pkill -9 -f 'qemu.*{vm_name}' - For each interface in
interfaces:
True on success, False on exception.
RemoteExecutor
RemoteExecutor is the SSH transport layer used by all other API classes. It wraps subprocess.run to execute commands on remote nodes.
__init__(remote_user="ubuntu")
SSH username used for all connections.
execute_direct(remote_ip, command, timeout=30) → (bool, str)
Runs an inline command on a remote host via SSH.
Target host IP address.
Shell command to execute. May be a multi-line string — each line is run sequentially in the same shell invocation.
Subprocess timeout in seconds. Raises
subprocess.TimeoutExpired if exceeded.ssh -o StrictHostKeyChecking=no ubuntu@{remote_ip} '{command}' via subprocess.run.
Returns
(True, stdout)— command exited with code 0.(False, stderr)— non-zero exit code or exception.
execute(remote_ip, script_path, args=None, timeout=30) → (bool, str)
Streams a local script file to the remote shell via stdin. Useful for multi-line scripts stored on disk.
Target host IP address.
Path to a local script file. The file is passed to the remote shell via
< {script_path}.Optional list of positional arguments passed to the remote
bash -s invocation.Subprocess timeout in seconds.
ssh ubuntu@{remote_ip} 'bash -s [args]' < {script_path}.
Returns
(True, stdout)on exit code 0.(False, stderr)on non-zero exit code or exception.
StrictHostKeyChecking=no is set only in execute_direct. The execute() method does not disable host key checking, so the manager host’s ~/.ssh/known_hosts must contain entries for all worker and network nodes before execute() is used in production.