Terminal management impove
This commit is contained in:
parent
58a04d51b3
commit
cc44a3df4d
BIN
__pycache__/app.cpython-311.pyc
Normal file
BIN
__pycache__/app.cpython-311.pyc
Normal file
Binary file not shown.
Binary file not shown.
BIN
functions/__pycache__/fbackup.cpython-311.pyc
Normal file
BIN
functions/__pycache__/fbackup.cpython-311.pyc
Normal file
Binary file not shown.
BIN
functions/__pycache__/fdisks.cpython-311.pyc
Normal file
BIN
functions/__pycache__/fdisks.cpython-311.pyc
Normal file
Binary file not shown.
BIN
functions/__pycache__/fedit.cpython-311.pyc
Normal file
BIN
functions/__pycache__/fedit.cpython-311.pyc
Normal file
Binary file not shown.
BIN
functions/__pycache__/fhost.cpython-311.pyc
Normal file
BIN
functions/__pycache__/fhost.cpython-311.pyc
Normal file
Binary file not shown.
BIN
functions/__pycache__/fiso.cpython-311.pyc
Normal file
BIN
functions/__pycache__/fiso.cpython-311.pyc
Normal file
Binary file not shown.
BIN
functions/__pycache__/flxc.cpython-311.pyc
Normal file
BIN
functions/__pycache__/flxc.cpython-311.pyc
Normal file
Binary file not shown.
BIN
functions/__pycache__/fnet.cpython-311.pyc
Normal file
BIN
functions/__pycache__/fnet.cpython-311.pyc
Normal file
Binary file not shown.
BIN
functions/__pycache__/fpool.cpython-311.pyc
Normal file
BIN
functions/__pycache__/fpool.cpython-311.pyc
Normal file
Binary file not shown.
BIN
functions/__pycache__/fscreen.cpython-311.pyc
Normal file
BIN
functions/__pycache__/fscreen.cpython-311.pyc
Normal file
Binary file not shown.
BIN
functions/__pycache__/fvm.cpython-311.pyc
Normal file
BIN
functions/__pycache__/fvm.cpython-311.pyc
Normal file
Binary file not shown.
BIN
functions/__pycache__/fvnc.cpython-311.pyc
Normal file
BIN
functions/__pycache__/fvnc.cpython-311.pyc
Normal file
Binary file not shown.
@ -10,6 +10,13 @@ def get_version():
|
|||||||
vhype = hype_version
|
vhype = hype_version
|
||||||
return vlxc, vlibvirt, vhype
|
return vlxc, vlibvirt, vhype
|
||||||
|
|
||||||
|
def get_vm_infos(vm_name):
|
||||||
|
dom = conn.lookupByName(vm_name)
|
||||||
|
vm_info = dom.guestInfo()
|
||||||
|
vm_infos=[]
|
||||||
|
vm_infos=[vm_info['os.id'],vm_info['os.pretty-name'],vm_info['os.kernel-release']]
|
||||||
|
return vm_infos
|
||||||
|
|
||||||
|
|
||||||
def set_memory(vm_name,memory_new):
|
def set_memory(vm_name,memory_new):
|
||||||
dom = conn.lookupByName(vm_name)
|
dom = conn.lookupByName(vm_name)
|
||||||
|
@ -45,7 +45,7 @@ def get_int(net_name):
|
|||||||
def create_vswitch_int(net_int):
|
def create_vswitch_int(net_int):
|
||||||
cmd="ovs-vsctl add-br "+net_int
|
cmd="ovs-vsctl add-br "+net_int
|
||||||
out = subprocess.call(cmd, shell=True)
|
out = subprocess.call(cmd, shell=True)
|
||||||
if out2 != 0:
|
if out != 0:
|
||||||
raise Exception("Error on creating interface")
|
raise Exception("Error on creating interface")
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
from config import *
|
from config import *
|
||||||
from xml.etree import ElementTree as ET
|
from xml.etree import ElementTree as ET
|
||||||
from flask import request, Response
|
from flask import request, Response
|
||||||
|
import subprocess
|
||||||
import os
|
import os
|
||||||
|
|
||||||
def get_vnc_port(vm_name):
|
def get_vnc_port(vm_name):
|
||||||
@ -12,14 +13,15 @@ def get_vnc_port(vm_name):
|
|||||||
return vnc_port
|
return vnc_port
|
||||||
|
|
||||||
def kill_consoles():
|
def kill_consoles():
|
||||||
os.system('kill -9 $(ps -edf | grep websockify | grep -v grep | awk \'{ print $2 }\')')
|
subprocess.run("pkill -9 -f 'websockify'", shell=True)
|
||||||
os.system('for i in $(ps -edf | grep pyxterm | grep -v grep | awk \'{ print $2 }\');do kill -9 $i;done')
|
subprocess.run("for i in $(pgrep -f 'pyxterm'); do kill -9 $i; done", shell=True)
|
||||||
|
|
||||||
def socket_connect(vm_name):
|
def socket_connect(vm_name):
|
||||||
kill_consoles()
|
kill_consoles()
|
||||||
vm_port = get_vnc_port(vm_name)
|
vm_port = get_vnc_port(vm_name)
|
||||||
os.system('websockify -D --web=/usr/share/novnc/ 6080 localhost:'+vm_port)
|
subprocess.run(['websockify', '-D', '--web=/usr/share/novnc/', '6080', 'localhost:' + vm_port])
|
||||||
|
|
||||||
def pyxterm_connect(path,lxc_name):
|
def pyxterm_connect(path,lxc_name):
|
||||||
kill_consoles()
|
kill_consoles()
|
||||||
os.system('python3 '+path+'/pyxterm.py --command \'lxc-attach\' --cmd-args \''+lxc_name+'\' &')
|
cmd = ['python3', f'{path}/pyxterm.py', '--command', 'lxc-attach', '--cmd-args', lxc_name]
|
||||||
|
pyx_process = subprocess.Popen(cmd)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user