0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-10-18 18:08:45 +00:00

Flock: CLI connects via telnet to hypervisor

This commit is contained in:
Maria Matejka 2024-09-27 12:53:06 +02:00
parent 53919e8d9d
commit e4981ce012

View File

@ -84,6 +84,12 @@ def cleanup(name: str):
except HypervisorStaleError: except HypervisorStaleError:
ctl.unlink() ctl.unlink()
@handler
def telnet(name: str):
for k,v in msg(name, { 1: None}).items():
assert(k == -2)
os.execlp("telnet", "telnet", "localhost", str(v))
@handler @handler
def container_start(hypervisor: str, name: str): def container_start(hypervisor: str, name: str):
print(f"start a machine {name} in {hypervisor}") print(f"start a machine {name} in {hypervisor}")
@ -102,9 +108,10 @@ def usage(name: str):
f"\t creates <name>.ctl in {DEFAULT_RUN_PATH}", f"\t creates <name>.ctl in {DEFAULT_RUN_PATH}",
f"\tstop <name> stop Flock hypervisor", f"\tstop <name> stop Flock hypervisor",
f"\tcleanup <name> cleanup the control socket left behind a stale hypervisor", f"\tcleanup <name> cleanup the control socket left behind a stale hypervisor",
f"\ttelnet <hypervisor> run telnet to hypervisor",
f"\tcontainer start <hypervisor> <name> start virtual machine", f"\tcontainer start <hypervisor> <name> start virtual machine",
f"\tcontainer stop <hypervisor> <name> stop virtual machine", f"\tcontainer stop <hypervisor> <name> stop virtual machine",
f"\ttelnet <hypervisor> <name> run telnet to this machine", f"\tcontainer telnet <hypervisor> <name> run telnet to this machine",
sep="\n") sep="\n")
cmd = [] cmd = []