diff --git a/backend/app/proxmox_actions.py b/backend/app/proxmox_actions.py new file mode 100644 index 0000000..04ed96b --- /dev/null +++ b/backend/app/proxmox_actions.py @@ -0,0 +1,14 @@ +from .proxmox_client import _client, _wait_task +from .config import settings + + +def delete_guest(guest_type: str, vmid: int) -> None: + """Удаляет VM или LXC и ожидает завершения задачи Proxmox.""" + client = _client() + node = settings.pve_node + if guest_type == "vm": + upid = client.nodes(node).qemu(vmid).delete() + else: + upid = client.nodes(node).lxc(vmid).delete() + if upid: + _wait_task(client, node, upid)