mirror of
https://github.com/retspen/webvirtcloud
synced 2024-12-24 23:25:24 +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:
parent
2585e64cfd
commit
4126ad2591
2 changed files with 218 additions and 210 deletions
|
@ -33,6 +33,7 @@
|
||||||
<!-- /.row -->
|
<!-- /.row -->
|
||||||
|
|
||||||
{% include 'errors_block.html' %}
|
{% include 'errors_block.html' %}
|
||||||
|
{% include 'messages_block.html' %}
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-xs-6 col-sm-6">
|
<div class="col-xs-6 col-sm-6">
|
||||||
|
@ -92,6 +93,7 @@
|
||||||
<tr>
|
<tr>
|
||||||
<th style="width: 45px;">#</th>
|
<th style="width: 45px;">#</th>
|
||||||
<th>{% trans "Name" %}</th>
|
<th>{% trans "Name" %}</th>
|
||||||
|
<th>{% trans "Allocated" %}</th>
|
||||||
<th>{% trans "Size" %}</th>
|
<th>{% trans "Size" %}</th>
|
||||||
<th>{% trans "Format" %}</th>
|
<th>{% trans "Format" %}</th>
|
||||||
<th data-sortable="false" colspan="2">{% trans "Action" %}</th>
|
<th data-sortable="false" colspan="2">{% trans "Action" %}</th>
|
||||||
|
@ -102,6 +104,7 @@
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ forloop.counter }}</td>
|
<td>{{ forloop.counter }}</td>
|
||||||
<td>{{ volume.name }}</td>
|
<td>{{ volume.name }}</td>
|
||||||
|
<td>{{ volume.allocation|filesizeformat }}</td>
|
||||||
<td>{{ volume.size|filesizeformat }}</td>
|
<td>{{ volume.size|filesizeformat }}</td>
|
||||||
<td>{{ volume.type }}</td>
|
<td>{{ volume.type }}</td>
|
||||||
<td style="width:30px;">
|
<td style="width:30px;">
|
||||||
|
@ -114,8 +117,8 @@
|
||||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||||
<h4 class="modal-title">{% trans "Clone image" %} <span class="text-danger">{{ volume.name }}</span></h4>
|
<h4 class="modal-title">{% trans "Clone image" %} <span class="text-danger">{{ volume.name }}</span></h4>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
|
||||||
<form class="form-horizontal" method="post" role="form">{% csrf_token %}
|
<form class="form-horizontal" method="post" role="form">{% csrf_token %}
|
||||||
|
<div class="modal-body">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-sm-3 control-label">{% trans "Name" %}</label>
|
<label class="col-sm-3 control-label">{% trans "Name" %}</label>
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
|
|
|
@ -7,7 +7,7 @@ from computes.models import Compute
|
||||||
from storages.forms import AddStgPool, AddImage, CloneImage
|
from storages.forms import AddStgPool, AddImage, CloneImage
|
||||||
from vrtManager.storage import wvmStorage, wvmStorages
|
from vrtManager.storage import wvmStorage, wvmStorages
|
||||||
from libvirt import libvirtError
|
from libvirt import libvirtError
|
||||||
|
from django.contrib import messages
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def storages(request, compute_id):
|
def storages(request, compute_id):
|
||||||
|
@ -155,6 +155,7 @@ def storage(request, compute_id, pool):
|
||||||
meta_prealloc = True
|
meta_prealloc = True
|
||||||
try:
|
try:
|
||||||
conn.create_volume(data['name'], data['size'], data['format'], meta_prealloc)
|
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())
|
return HttpResponseRedirect(request.get_full_path())
|
||||||
except libvirtError as lib_err:
|
except libvirtError as lib_err:
|
||||||
error_messages.append(lib_err)
|
error_messages.append(lib_err)
|
||||||
|
@ -166,6 +167,7 @@ def storage(request, compute_id, pool):
|
||||||
try:
|
try:
|
||||||
vol = conn.get_volume(volname)
|
vol = conn.get_volume(volname)
|
||||||
vol.delete(0)
|
vol.delete(0)
|
||||||
|
messages.success(request,_('Volume: {} is deleted.'.format(volname)))
|
||||||
return HttpResponseRedirect(request.get_full_path())
|
return HttpResponseRedirect(request.get_full_path())
|
||||||
except libvirtError as lib_err:
|
except libvirtError as lib_err:
|
||||||
error_messages.append(lib_err.message)
|
error_messages.append(lib_err.message)
|
||||||
|
@ -175,6 +177,7 @@ def storage(request, compute_id, pool):
|
||||||
error_messages.append(error_msg)
|
error_messages.append(error_msg)
|
||||||
else:
|
else:
|
||||||
handle_uploaded_file(path, request.FILES['file'])
|
handle_uploaded_file(path, request.FILES['file'])
|
||||||
|
messages.success(request, _('ISO: {} is uploaded.'.format(request.FILES['file'])))
|
||||||
return HttpResponseRedirect(request.get_full_path())
|
return HttpResponseRedirect(request.get_full_path())
|
||||||
if 'cln_volume' in request.POST:
|
if 'cln_volume' in request.POST:
|
||||||
form = CloneImage(request.POST)
|
form = CloneImage(request.POST)
|
||||||
|
@ -194,6 +197,8 @@ def storage(request, compute_id, pool):
|
||||||
format = None
|
format = None
|
||||||
try:
|
try:
|
||||||
conn.clone_volume(data['image'], data['name'], format, meta_prealloc)
|
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())
|
return HttpResponseRedirect(request.get_full_path())
|
||||||
except libvirtError as lib_err:
|
except libvirtError as lib_err:
|
||||||
error_messages.append(lib_err)
|
error_messages.append(lib_err)
|
||||||
|
|
Loading…
Reference in a new issue