17 lines
526 B
Python
17 lines
526 B
Python
import subprocess
|
|
|
|
|
|
def run_host(command, cwd, env):
|
|
return subprocess.run(command, shell=True, cwd=cwd, env=env).returncode
|
|
|
|
|
|
def run_lxc(container, command):
|
|
cmd = f"lxc exec {container} -- bash -lc '{command}'"
|
|
return subprocess.run(cmd, shell=True).returncode
|
|
|
|
|
|
def run_libvirt(vm_name, command):
|
|
cmd = f"virsh domfsfreeze {vm_name} && virsh send-process-signal {vm_name} 15"
|
|
# simplified placeholder — real execution would use ssh/agent channel
|
|
return subprocess.run(cmd, shell=True).returncode
|