1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2024-12-24 15:15:22 +00:00

Volumes list allocation info added. While creating image files it is recommended username and group name info. Storage.html does not show messages. messages section added

This commit is contained in:
catborise 2018-07-25 09:35:35 +03:00
parent 2585e64cfd
commit 4126ad2591
2 changed files with 218 additions and 210 deletions

View file

@ -33,6 +33,7 @@
<!-- /.row -->
{% include 'errors_block.html' %}
{% include 'messages_block.html' %}
<div class="row">
<div class="col-xs-6 col-sm-6">
@ -92,6 +93,7 @@
<tr>
<th style="width: 45px;">#</th>
<th>{% trans "Name" %}</th>
<th>{% trans "Allocated" %}</th>
<th>{% trans "Size" %}</th>
<th>{% trans "Format" %}</th>
<th data-sortable="false" colspan="2">{% trans "Action" %}</th>
@ -102,6 +104,7 @@
<tr>
<td>{{ forloop.counter }}</td>
<td>{{ volume.name }}</td>
<td>{{ volume.allocation|filesizeformat }}</td>
<td>{{ volume.size|filesizeformat }}</td>
<td>{{ volume.type }}</td>
<td style="width:30px;">
@ -114,8 +117,8 @@
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title">{% trans "Clone image" %} <span class="text-danger">{{ volume.name }}</span></h4>
</div>
<div class="modal-body">
<form class="form-horizontal" method="post" role="form">{% csrf_token %}
<div class="modal-body">
<div class="form-group">
<label class="col-sm-3 control-label">{% trans "Name" %}</label>
<div class="col-sm-6">

View file

@ -7,7 +7,7 @@ from computes.models import Compute
from storages.forms import AddStgPool, AddImage, CloneImage
from vrtManager.storage import wvmStorage, wvmStorages
from libvirt import libvirtError
from django.contrib import messages
@login_required
def storages(request, compute_id):
@ -155,6 +155,7 @@ def storage(request, compute_id, pool):
meta_prealloc = True
try:
conn.create_volume(data['name'], data['size'], data['format'], meta_prealloc)
messages.success("Image file {} is created successfully".format(data['name']+".img"))
return HttpResponseRedirect(request.get_full_path())
except libvirtError as lib_err:
error_messages.append(lib_err)
@ -166,6 +167,7 @@ def storage(request, compute_id, pool):
try:
vol = conn.get_volume(volname)
vol.delete(0)
messages.success(request,_('Volume: {} is deleted.'.format(volname)))
return HttpResponseRedirect(request.get_full_path())
except libvirtError as lib_err:
error_messages.append(lib_err.message)
@ -175,6 +177,7 @@ def storage(request, compute_id, pool):
error_messages.append(error_msg)
else:
handle_uploaded_file(path, request.FILES['file'])
messages.success(request, _('ISO: {} is uploaded.'.format(request.FILES['file'])))
return HttpResponseRedirect(request.get_full_path())
if 'cln_volume' in request.POST:
form = CloneImage(request.POST)
@ -194,6 +197,8 @@ def storage(request, compute_id, pool):
format = None
try:
conn.clone_volume(data['image'], data['name'], format, meta_prealloc)
messages.success(request, _("{} image cloned as {} successfully".format(data['image'],
data['name'] + ".img")))
return HttpResponseRedirect(request.get_full_path())
except libvirtError as lib_err:
error_messages.append(lib_err)