From 97e39fa6b80e69dbe1ff156d11c99d5f177235df Mon Sep 17 00:00:00 2001 From: catborise Date: Fri, 25 Oct 2019 16:03:27 +0300 Subject: [PATCH 1/9] storage.html: show usage and size seperately. --- storages/templates/storage.html | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/storages/templates/storage.html b/storages/templates/storage.html index e7ddfe1..cf70f11 100644 --- a/storages/templates/storage.html +++ b/storages/templates/storage.html @@ -44,11 +44,12 @@
-

{% trans "Pool name" %}:

-

{% trans "Pool type" %}:

-

{% trans "Pool path" %}:

-

{% trans "Pool status" %}:

-

{% trans "Size" %}: ({{ size|filesizeformat }} / {{ used|filesizeformat }})

+

{% trans "Pool Name" %}:

+

{% trans "Pool Type" %}:

+

{% trans "Pool Path" %}:

+

{% trans "Pool Status" %}:

+

{% trans "Size" %}:

+

{% trans "Usage" %}({{ percent }}%):

{% trans "State" %}:

{% trans "Autostart" %}:

@@ -57,7 +58,8 @@

{% 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 }}%

+

{{ size|filesizeformat }}

+

{{ used|filesizeformat }}

{% csrf_token %} {% ifequal state 0 %} From d46306bc8acb428507a8bd78c3eeb4dae92d5782 Mon Sep 17 00:00:00 2001 From: catborise Date: Mon, 28 Oct 2019 08:55:25 +0300 Subject: [PATCH 2/9] travis.yml: update dependency and add missing modules --- .travis.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 49a0b13..131aa6d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,14 +2,14 @@ language: python python: - "2.7" env: - - DJANGO=1.11.21 + - DJANGO=1.11.23 install: - pip install -r dev/requirements.txt script: - pep8 --exclude=IPy.py --ignore=E501 vrtManager accounts computes \ - console create instances interfaces \ - networks secrets storages - - pyflakes vrtManager accounts computes console create instances interfaces \ - networks secrets storages + console create datasource instances interfaces \ + logs networks nwfilters secrets storages + - pyflakes vrtManager accounts computes console create datasource instances interfaces \ + nwfilters networks secrets storages logs - python manage.py migrate - python manage.py test --settings=webvirtcloud.settings-dev From f72d969c2525de54861107bd15f535f636ccf62e Mon Sep 17 00:00:00 2001 From: catborise Date: Mon, 28 Oct 2019 08:56:55 +0300 Subject: [PATCH 3/9] messages_block: add i18n translate --- templates/messages_block.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/templates/messages_block.html b/templates/messages_block.html index cb2aef6..3961ac3 100644 --- a/templates/messages_block.html +++ b/templates/messages_block.html @@ -1,3 +1,4 @@ +{% load i18n %} {% if messages %} {% for message in messages %} @@ -5,7 +6,7 @@
- Success: {{ message }} + {% trans 'Success' %}: {{ message }}
From a59dcde688e030b06235ebb0fe6ee1c6ba0ff127 Mon Sep 17 00:00:00 2001 From: catborise Date: Mon, 28 Oct 2019 08:58:24 +0300 Subject: [PATCH 4/9] errors_block: add i18n translate --- templates/errors_block.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/templates/errors_block.html b/templates/errors_block.html index 5c9c5fd..ed2f6da 100644 --- a/templates/errors_block.html +++ b/templates/errors_block.html @@ -1,3 +1,4 @@ +{% load i18n %} {% if error_messages %} {% for error in error_messages %} @@ -5,7 +6,7 @@
- Error: {{ error }} + {% trans 'Error' %}: {{ error }}
From 54a6408107e67bc82e0d347ad9cf22684128fa7b Mon Sep 17 00:00:00 2001 From: catborise Date: Mon, 28 Oct 2019 09:00:47 +0300 Subject: [PATCH 5/9] add i18n translate and correct typo --- templates/404.html | 4 ++-- templates/500.html | 4 ++-- templates/base.html | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/templates/404.html b/templates/404.html index fa98e50..56f4f3d 100644 --- a/templates/404.html +++ b/templates/404.html @@ -4,12 +4,12 @@ {% block content %}
-

Oops!

+

{% trans 'Oops!'%}

{% trans "404 Not Found" %}

{% trans "The requested page was not found on this server." %}

- ← Back + ← {% trans 'Back'%}
{% endblock %} diff --git a/templates/500.html b/templates/500.html index b8dcfa4..3908922 100644 --- a/templates/500.html +++ b/templates/500.html @@ -4,12 +4,12 @@ {% block content %}
-

Oops!

+

{% trans 'Oops!' %}

{% trans "500 Internal Server Error" %}

{% trans "The server encountered an internal error or misconfiguration and was unable to complete you request." %}

- ← Back + ← {% trans 'Back'%}
{% endblock %} diff --git a/templates/base.html b/templates/base.html index 4959bb5..f0d67c5 100644 --- a/templates/base.html +++ b/templates/base.html @@ -5,7 +5,7 @@ - + {% block title %}{% endblock %} From 360f212583631c7e5d2881faa0d59d4e3ae2f9c0 Mon Sep 17 00:00:00 2001 From: catborise Date: Mon, 28 Oct 2019 09:40:01 +0300 Subject: [PATCH 6/9] update requirements, websockify: 0.8.0->0.9.0, django: 1.11.23->1.11.25 --- conf/requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/conf/requirements.txt b/conf/requirements.txt index fd3071b..28ca300 100644 --- a/conf/requirements.txt +++ b/conf/requirements.txt @@ -1,5 +1,5 @@ -Django==1.11.23 -websockify==0.8.0 +Django==1.11.25 +websockify==0.9.0 gunicorn==19.9.0 lxml==4.2.5 libvirt-python==5.3.0 From f1dbc6a1997bccc776bb392c45466f84d87f0edb Mon Sep 17 00:00:00 2001 From: catborise Date: Mon, 28 Oct 2019 10:40:33 +0300 Subject: [PATCH 7/9] fix key checking in dict which could be causes KeyError --- vrtManager/instance.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vrtManager/instance.py b/vrtManager/instance.py index 6c1cfec..eb4147f 100644 --- a/vrtManager/instance.py +++ b/vrtManager/instance.py @@ -528,8 +528,8 @@ class wvmInstance(wvmConnect): mem_usage = {} if self.get_status() == 1: mem_stats = self.instance.memoryStats() - rss = mem_stats['rss'] if mem_stats['rss'] else 0 - total = mem_stats['actual'] if mem_stats['actual'] else 0 + rss = mem_stats['rss'] if 'rss' in mem_stats else 0 + total = mem_stats['actual'] if 'actual' in mem_stats else 0 available = total - rss if available < 0: available = 0 From 537cefe90aee882b38df01dd1ffb69747daa6b59 Mon Sep 17 00:00:00 2001 From: catborise Date: Mon, 28 Oct 2019 10:45:27 +0300 Subject: [PATCH 8/9] Fix host bus and storages variables to get list of them --- instances/templates/add_instance_volume.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/instances/templates/add_instance_volume.html b/instances/templates/add_instance_volume.html index 779ba20..b242bcc 100644 --- a/instances/templates/add_instance_volume.html +++ b/instances/templates/add_instance_volume.html @@ -99,7 +99,7 @@ @@ -120,7 +120,7 @@
From c212a60bbab5f5978956ee79d93cc292bf6c6751 Mon Sep 17 00:00:00 2001 From: catborise Date: Mon, 28 Oct 2019 11:20:39 +0300 Subject: [PATCH 9/9] Delete instance disk: detach and delete. Notification added if detach completed but not deleted --- instances/views.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/instances/views.py b/instances/views.py index 0ef489f..1a1c5c0 100644 --- a/instances/views.py +++ b/instances/views.py @@ -576,10 +576,14 @@ def instance(request, compute_id, vname): path = request.POST.get('path', '') name = request.POST.get('name', '') - conn.detach_disk(dev) - conn_delete.del_volume(name) - msg = _('Delete disk: ' + dev) + conn.detach_disk(dev) + try: + conn_delete.del_volume(name) + except libvirtError as err: + msg = _('The disk: ' + dev + ' is detached but not deleted. ' + err.message) + messages.warning(request, msg) + addlogmsg(request.user.username, instance.name, msg) return HttpResponseRedirect(request.get_full_path() + '#disks')