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