VM snapshot add/delete
parent
1be2e77d8a
commit
617a6481e9
38
app.py
38
app.py
|
@ -376,6 +376,43 @@ def restsnap_lxc():
|
||||||
flash('Error restoring '+item+':'+str(e), category='danger')
|
flash('Error restoring '+item+':'+str(e), category='danger')
|
||||||
return redirect(url_for('backup'))
|
return redirect(url_for('backup'))
|
||||||
|
|
||||||
|
###LAPIN
|
||||||
|
@app.route('/snapvm', methods = ['POST'])
|
||||||
|
@login_required
|
||||||
|
def snapvm():
|
||||||
|
vm_name=request.form['snap']
|
||||||
|
try:
|
||||||
|
create_snap_vm(vm_name)
|
||||||
|
flash('Snapshot '+vm_name+' done', category='success')
|
||||||
|
except Exception as e:
|
||||||
|
flash('Error on snapshoting '+vm_name+':'+str(e), category='danger')
|
||||||
|
return redirect(url_for('backup'))
|
||||||
|
|
||||||
|
@app.route('/del_snap_vm', methods = ['POST'])
|
||||||
|
@login_required
|
||||||
|
def delsnapvm():
|
||||||
|
vm_name=request.form['vm_name']
|
||||||
|
item=request.form['item']
|
||||||
|
try:
|
||||||
|
del_snap_vm(vm_name,item)
|
||||||
|
flash(item+' deleted', category='success')
|
||||||
|
except Exception as e:
|
||||||
|
flash('Error on deleting '+item+':'+str(e), category='danger')
|
||||||
|
return redirect(url_for('backup'))
|
||||||
|
"""
|
||||||
|
@app.route('/rest_snap_vm', methods = ['POST'])
|
||||||
|
@login_required
|
||||||
|
def restsnap_lxc():
|
||||||
|
vm_name=request.form['lxc_name']
|
||||||
|
item=request.form['item']
|
||||||
|
try:
|
||||||
|
rest_snap_lxc(lxc_name,item)
|
||||||
|
flash('Restore '+item+' done', category='success')
|
||||||
|
except Exception as e:
|
||||||
|
flash('Error restoring '+item+':'+str(e), category='danger')
|
||||||
|
return redirect(url_for('backup'))
|
||||||
|
"""
|
||||||
|
##PINE LA
|
||||||
|
|
||||||
############################
|
############################
|
||||||
## BUILD ##
|
## BUILD ##
|
||||||
|
@ -417,7 +454,6 @@ def create_VM():
|
||||||
####################################
|
####################################
|
||||||
## WINDOWS ##
|
## WINDOWS ##
|
||||||
####################################
|
####################################
|
||||||
|
|
||||||
if ose.startswith('win'):
|
if ose.startswith('win'):
|
||||||
try:
|
try:
|
||||||
cmd = "qemu-img create -f qcow2 "+str(virtuo_path)+str(nom)+".qcow2 "+str(disk)+"G"
|
cmd = "qemu-img create -f qcow2 "+str(virtuo_path)+str(nom)+".qcow2 "+str(disk)+"G"
|
||||||
|
|
|
@ -50,3 +50,8 @@ def get_snap_list_vm(vm_name):
|
||||||
for snap in list_snap_vm:
|
for snap in list_snap_vm:
|
||||||
out.append(snap)
|
out.append(snap)
|
||||||
return out
|
return out
|
||||||
|
|
||||||
|
def del_snap_vm(vm_name,item):
|
||||||
|
dom=conn.lookupByName(vm_name)
|
||||||
|
snap_del=dom.snapshotLookupByName(item)
|
||||||
|
snap_del.delete()
|
||||||
|
|
|
@ -26,7 +26,9 @@
|
||||||
{{ snap_vm }}</th><th>
|
{{ snap_vm }}</th><th>
|
||||||
<button type="submit" class="btn btn-outline-secondary btn-hype" value="{{ snap }}" name="start" onclick="loading();"><i class="fa-solid fa-rotate-left"></i></button>
|
<button type="submit" class="btn btn-outline-secondary btn-hype" value="{{ snap }}" name="start" onclick="loading();"><i class="fa-solid fa-rotate-left"></i></button>
|
||||||
</th><th>
|
</th><th>
|
||||||
<button type="submit" class="btn btn-outline-danger btn-hype" value="{{ snap }}" name="start" onclick="loading();"><i class="fa-solid fa-trash"></i></button>
|
<form action="/del_snap_vm" method="post"><input type="hidden" name="vm_name" value="{{ vm[0] }}">
|
||||||
|
<button type="submit" class="btn btn-outline-danger btn-hype" value="{{ snap_vm }}" name="item" onclick="loading();"><i class="fa-solid fa-trash"></i></button>
|
||||||
|
</form>
|
||||||
</th></tr></table>
|
</th></tr></table>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</td></tr>
|
</td></tr>
|
||||||
|
|
Loading…
Reference in New Issue