Adding VM edition and screenshot
This commit is contained in:
parent
b6ece56080
commit
2f113ad01b
BIN
__pycache__/config.cpython-311.pyc
Normal file
BIN
__pycache__/config.cpython-311.pyc
Normal file
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__/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__/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.
33
functions/fedit.py
Normal file
33
functions/fedit.py
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
from config import *
|
||||||
|
import base64
|
||||||
|
|
||||||
|
#memory = Memory in Mo
|
||||||
|
def set_memory(vm_name,memory_new):
|
||||||
|
dom = conn.lookupByName(vm_name)
|
||||||
|
dom.setMemory(memory_new)
|
||||||
|
|
||||||
|
def set_vcpu(vm_name,vcpu_new):
|
||||||
|
dom = conn.lookupByName(vm_name)
|
||||||
|
dom.setVcpus(vcpu_new)
|
||||||
|
|
||||||
|
def get_info_vm(vm_name):
|
||||||
|
dom = conn.lookupByName(vm_name)
|
||||||
|
state, maxmem, mem, cpus, cput = dom.info()
|
||||||
|
return state, maxmem, mem, cpus, cput
|
||||||
|
|
||||||
|
def get_screenshot(vm_name):
|
||||||
|
dom = conn.lookupByName(vm_name)
|
||||||
|
stream = conn.newStream()
|
||||||
|
imageType = dom.screenshot(stream,0)
|
||||||
|
file = "tmp_screen_" + dom.name()
|
||||||
|
fileHandler = open(file, 'wb')
|
||||||
|
streamBytes = stream.recv(262120)
|
||||||
|
while streamBytes != b'':
|
||||||
|
fileHandler.write(streamBytes)
|
||||||
|
streamBytes = stream.recv(262120)
|
||||||
|
fileHandler.close()
|
||||||
|
stream.finish()
|
||||||
|
with open(file, "rb") as f:
|
||||||
|
data = base64.b64encode(f.read())
|
||||||
|
os.remove(file)
|
||||||
|
return data
|
@ -12,15 +12,14 @@
|
|||||||
<img src="data:image/png;base64,{{ screen_64 }}" class="img-thumbnail">
|
<img src="data:image/png;base64,{{ screen_64 }}" class="img-thumbnail">
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm">
|
<div class="col-sm">
|
||||||
Vcpu : {{ actual_vCPU }}</br>
|
Vcpu : {{ actual_vCPU }}</br><br>
|
||||||
Memory: {{ actual_ram }} MB</br>
|
Memory: {{ actual_ram }} MB</br>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm">
|
<div class="col-sm">
|
||||||
<form action="/editressources" method="post">
|
<form action="/editressources" method="post">
|
||||||
<input type="hidden" name="vm_name" value="{{ vm_name }}"></input>
|
<input type="hidden" name="vm_name" value="{{ vm_name }}"></input>
|
||||||
<input type="text" name="new_cpu" placeholder="{{ actual_vCPU }}" value="{{ actual_vCPU }}"></input> (Max : {{ max_vCPU }})<br>
|
<input type="text" name="new_cpu" class="form-control form-control-sm" placeholder="{{ actual_vCPU }}" value="{{ actual_vCPU }}"></input> (Max : {{ max_vCPU }})<br>
|
||||||
|
<input type="text" name="new_mem" class="form-control form-control-sm" placeholder="{{ actual_ram }}" value="{{ actual_ram }}" ></input> MB (Max : {{ max_Mermory }} MB)<br><br>
|
||||||
<input type="text" name="new_mem" placeholder="{{ actual_ram }}" value="{{ actual_ram }}" ></input> MB (Max : {{ max_Mermory }} MB)<br><br>
|
|
||||||
<button type="submit" class="btn btn-outline-warning btn-hype">Set New Values</button>
|
<button type="submit" class="btn btn-outline-warning btn-hype">Set New Values</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user