mirror of
https://github.com/ComputerScienceHouse/proxstar.git
synced 2025-03-09 15:40:09 +00:00
teardown ssh/vnc stuff after shutdown and reset requests
This commit is contained in:
parent
3f03d9ab69
commit
03baef5be0
2 changed files with 17 additions and 11 deletions
|
@ -83,3 +83,17 @@ def start_ssh_tunnel(node, port):
|
|||
local_bind_address=('127.0.0.1', port))
|
||||
server.start()
|
||||
return server
|
||||
|
||||
|
||||
def stop_ssh_tunnel(vmid, ssh_tunnels):
|
||||
# Tear down the SSH tunnel and VNC target entry for a given VM
|
||||
port = 5900 + int(vmid)
|
||||
tunnel = next((tunnel for tunnel in ssh_tunnels
|
||||
if tunnel.local_bind_port == port), None)
|
||||
if tunnel:
|
||||
try:
|
||||
tunnel.stop()
|
||||
except:
|
||||
pass
|
||||
ssh_tunnels.remove(tunnel)
|
||||
delete_vnc_target(port)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue