+ {% if state %}
+
+
+
-
+
- {% include 'errors_block.html' %}
-
-
-
-
{% trans "Pool name:" %}
-
{% trans "Pool type:" %}
-
{% trans "Pool path:" %}
-
{% trans "Pool status:" %}
-
{% trans "Size:" %} ({{ size|filesizeformat }} / {{ used|filesizeformat }})
-
{% trans "State:" %}
-
{% trans "Autostart:" %}
-
-
-
{{ pool }}
-
{% if not type %}{% trans "None" %}{% else %}{{ type }}{% endif %}
-
{% if not path %}{% trans "None" %}{% else %}{{ path }}{% endif %}
-
{% if not status %}{% trans "None" %}{% else %}{{ status }}{% endif %}
-
{% trans "Usage:" %} {{ percent }}%
-
-
+ {% if volumes %}
+
+
+
+
+ # |
+ {% trans "Name" %} |
+ {% trans "Allocated" %} |
+ {% trans "Size" %} |
+ {% trans "Format" %} |
+ {% trans "Action" %} |
+
+
+
+ {% for volume in volumes %}
+
+ {{ forloop.counter }} |
+ {{ volume.name }} |
+ {{ volume.allocation|filesizeformat }} |
+ {{ volume.size|filesizeformat }} |
+ {{ volume.type }} |
+
+
+
+ {% ifnotequal volume.type "iso" %}
+
+ {% else %}
+
+ {% endifnotequal %}
+ |
+
+
-
-
-
-
-
-
-
-
- {% if state %}
-
- {% if volumes %}
-
-
-
-
- # |
- {% trans "Name" %} |
- {% trans "Size" %} |
- {% trans "Format" %} |
- {% trans "Action" %} |
-
-
-
- {% for volume in volumes %}
-
- {{ forloop.counter }} |
- {{ volume.name }} |
- {{ volume.size|filesizeformat }} |
- {{ volume.type }} |
-
-
-
- {% ifnotequal volume.type "iso" %}
-
- {% else %}
-
- {% endifnotequal %}
- |
-
-
- |
-
- {% endfor %}
-
-
-
- {% else %}
-
-
-
- {% trans "Warning:" %} {% trans "Hypervisor doesn't have any Volumes" %}
-
-
- {% endif %}
- {% endif %}
-
+ |
+
+ {% endfor %}
+
+
+
+ {% else %}
+
+
+
+ {% trans "Warning:" %} {% trans "Hypervisor doesn't have any Volumes" %}
+
+ {% endif %}
+ {% endif %}
+
+
{% endblock %}
{% block script %}
-
-
+
-
+ });
+ $(document).on('change', '.image-format', function () {
+ if ($(this).val() == "qcow2") {
+ $('.meta-prealloc').show();
+ } else {
+ $('.meta-prealloc').hide();
+ }
+ });
+
+
{% endblock %}
diff --git a/storages/views.py b/storages/views.py
index d3f1965..f18cad6 100644
--- a/storages/views.py
+++ b/storages/views.py
@@ -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)