From 105b8c180a9f76c6cb443dcb7e4f2dc8d99964e2 Mon Sep 17 00:00:00 2001 From: "Ing. Jan KRCMAR" Date: Thu, 6 Sep 2018 14:26:29 +0200 Subject: [PATCH 1/3] view instance: check_user_quota is not performed for superuser --- instances/views.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/instances/views.py b/instances/views.py index ac188ed..cb46105 100644 --- a/instances/views.py +++ b/instances/views.py @@ -274,6 +274,12 @@ def instance(request, compute_id, vname): return free_names def check_user_quota(instance, cpu, memory, disk_size): + ua = request.user.userattributes + msg = "" + + if request.user.is_superuser: + return msg + user_instances = UserInstance.objects.filter(user_id=request.user.id, instance__is_template=False) instance += user_instances.count() for usr_inst in user_instances: @@ -290,8 +296,6 @@ def instance(request, compute_id, vname): if disk['size']: disk_size += int(disk['size'])>>30 - ua = request.user.userattributes - msg = "" if ua.max_instances > 0 and instance > ua.max_instances: msg = "instance" if settings.QUOTA_DEBUG: From 01c7991d809eedce01267ef3e0acfb4d6d6a2adb Mon Sep 17 00:00:00 2001 From: "Ing. Jan KRCMAR" Date: Mon, 10 Sep 2018 11:27:05 +0200 Subject: [PATCH 2/3] update novncd runit script, make it debian compatible, update docs --- README.md | 11 +++++++++++ conf/runit/novncd.sh | 18 ++++++++++++++++-- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index fdc2975..a4713c4 100644 --- a/README.md +++ b/README.md @@ -213,6 +213,17 @@ Done!! Go to http://serverip and you should see the login screen. +### Alternative running novncd via runit +Alternative to running nonvcd via supervisor is runit. + +On Debian systems install runit and configure novncd service +``` +apt install runit runit-systemd +mkdir /etc/service/novncd/ +ln -s /srv/webvirtcloud/conf/runit/novncd.sh /etc/service/novncd/run +systemctl start runit.service +``` + ### Default credentials
 login: admin
diff --git a/conf/runit/novncd.sh b/conf/runit/novncd.sh
index 99089d7..14b775b 100755
--- a/conf/runit/novncd.sh
+++ b/conf/runit/novncd.sh
@@ -1,4 +1,18 @@
 #!/bin/sh
+
 # `/sbin/setuser www-data` runs the given command as the user `www-data`.
-cd /srv/webvirtcloud
-exec /sbin/setuser www-data /srv/webvirtcloud/venv/bin/python /srv/webvirtcloud/console/novncd >> /var/log/novncd.log 2>&1
+RUNAS=`which setuser`
+[ -z $RUNAS ] && RUNAS="`which sudo` -u"
+USER=www-data
+
+DJANGO_PROJECT=/srv/webvirtcloud
+PYTHON=$DJANGO_PROJECT/venv/bin/python
+NOVNCD=$DJANGO_PROJECT/console/novncd
+
+# make novncd debug, verbose
+#PARAMS="-d -v"
+
+LOG=/var/log/novncd.log
+
+cd $DJANGO_PROJECT
+exec $RUNAS $USER $PYTHON $NOVNCD $PARAMS >> $LOG 2>&1

From aba4ee86239fd7af2aa55dcdbb906c1b56e60417 Mon Sep 17 00:00:00 2001
From: "Ing. Jan KRCMAR" 
Date: Tue, 11 Sep 2018 15:11:13 +0200
Subject: [PATCH 3/3] instance/clone disk names revisited

---
 instances/templates/instance.html | 17 ++++-----
 instances/views.py                | 61 ++++++++++++++++---------------
 2 files changed, 39 insertions(+), 39 deletions(-)

diff --git a/instances/templates/instance.html b/instances/templates/instance.html
index 557c3dc..4aadf3e 100644
--- a/instances/templates/instance.html
+++ b/instances/templates/instance.html
@@ -914,7 +914,7 @@
                                                         {% endif %}
                                                         {% if request.user.is_superuser %}
                                                             

{% trans "Storage devices" %}

- {% for disk in clone_disks %} + {% for disk in disks %}
@@ -929,7 +929,7 @@
{% endfor %} {% else %} - {% for disk in clone_disks %} + {% for disk in disks %} {% endfor %} {% endif %} @@ -1266,17 +1266,13 @@