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:
parent
2585e64cfd
commit
4126ad2591
2 changed files with 218 additions and 210 deletions
|
@ -6,8 +6,8 @@
|
|||
<link rel="stylesheet" href="{% static "css/sortable-theme-bootstrap.css" %}" />
|
||||
{% endblock %}
|
||||
{% block content %}
|
||||
<!-- Page Heading -->
|
||||
<div class="row">
|
||||
<!-- Page Heading -->
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
{% include 'create_stg_vol_block.html' %}
|
||||
<h1 class="page-header">{% trans "Storage:" %} {{ pool }}</h1>
|
||||
|
@ -29,12 +29,13 @@
|
|||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.row -->
|
||||
</div>
|
||||
<!-- /.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">
|
||||
<p>{% trans "Pool name:" %}</p>
|
||||
<p>{% trans "Pool type:" %}</p>
|
||||
|
@ -74,8 +75,8 @@
|
|||
</form>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
{% if state %}
|
||||
<div class="row">
|
||||
|
@ -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">×</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">
|
||||
|
@ -184,11 +187,11 @@
|
|||
{% endif %}
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% block script %}
|
||||
<script src="{% static "js/sortable.min.js" %}"></script>
|
||||
<script>
|
||||
<script src="{% static "js/sortable.min.js" %}"></script>
|
||||
<script>
|
||||
$('.format-convert').hide();
|
||||
$(document).on('change', '.volume-convert', function () {
|
||||
if ($(this).prop('checked')) {
|
||||
|
@ -208,8 +211,8 @@
|
|||
$('.meta-prealloc').hide();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
</script>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
(function ($) {
|
||||
$('#filter').keyup(function () {
|
||||
|
@ -221,5 +224,5 @@
|
|||
})
|
||||
}(jQuery));
|
||||
});
|
||||
</script>
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue