From 96efde814a00b9289b2b697dd29fb246b6d44209 Mon Sep 17 00:00:00 2001 From: catborise Date: Tue, 15 Jan 2019 15:55:05 +0300 Subject: [PATCH] Add boot menu/order functionality. Minor improvements. Some bug fixes --- instances/templates/add_instance_volume.html | 2 +- instances/templates/instance.html | 659 +++++++++++-------- instances/views.py | 38 +- static/css/webvirtcloud.css | 18 + vrtManager/instance.py | 120 +++- 5 files changed, 553 insertions(+), 284 deletions(-) diff --git a/instances/templates/add_instance_volume.html b/instances/templates/add_instance_volume.html index 9cea2fc..6b0fed3 100644 --- a/instances/templates/add_instance_volume.html +++ b/instances/templates/add_instance_volume.html @@ -1,6 +1,6 @@ {% load i18n %} {% if request.user.is_superuser %} - + diff --git a/instances/templates/instance.html b/instances/templates/instance.html index 4413b51..21d1531 100644 --- a/instances/templates/instance.html +++ b/instances/templates/instance.html @@ -526,8 +526,8 @@
-
- {% if request.user.is_superuser and status == 5 %} -
{% csrf_token %} -
-
- -
-
-
- {% endif %} - {% for cd in media %} + {% if request.user.is_superuser %} +
+

{% trans 'Autostart' %}

{% csrf_token %}
- - {% trans "CDROM" %} {{ forloop.counter }} - - {% if not cd.image %} -
- -
-
- {% if media_iso and allow_admin_or_not_template %} - - {% if status == 5 %} - - {% endif %} - {% else %} - - {% endif %} -
+
+

{% trans "Autostart your instance when host server is power on " %} + {% ifequal autostart 0 %} + {% else %} -

- -
-
- - {% if allow_admin_or_not_template %} - - {% else %} - - {% endif %} -
- {% endif %} + + {% endifequal %} +

+
- {% endfor %} -
-
-
-

- {% trans "Instance Volumes" %} - {% include 'add_instance_volume.html' %} -

-
+

{% trans 'Boot Order' %}

+
{% csrf_token %} +
+
+ {% ifequal status 5 %} +

{% trans "Enable Boot Menu for your instance when it starts up " %} + {% ifequal bootmenu 0 %} + + {% else %} + + {% endifequal %} + {% else %} +

{% trans "**** Please shutdown instance to modify boot menu ****" %} + {% endifequal %} +

+
+
+
+ {% ifequal bootmenu 1 %} +
+
+ {% for idx, val in boot_order.items %} + + {% endfor %} +
+
+
{% csrf_token %} + +
+
+
+ {% for disk in disks %} + + {% endfor %} + {% for cd in media %} + + {% endfor %} + {% for net in networks %} + + {% endfor %} +
+
+
+
+ +
+
+ +
+
+
+
+ +
+
+ {% endifequal %} +
+
+ +
+ {% if status == 5 %} +
{% csrf_token %} +

+ {% trans "Instance Media" %} + +

+
+ {% endif %} + {% for cd in media %} +
{% csrf_token %} +
+ + {% trans "CDROM" %} {{ forloop.counter }} + + {% if not cd.image %} +
+ +
+
+ {% if media_iso and allow_admin_or_not_template %} + + {% if status == 5 %} + + {% endif %} + {% else %} + + {% endif %} +
+ {% else %} +
+ +
+
+ + {% if allow_admin_or_not_template %} + + {% else %} + + {% endif %} +
+ {% endif %} +
+
+ {% endfor %} + +

+ {% trans "Instance Volume" %} + {% include 'add_instance_volume.html' %} +

+ +
@@ -726,21 +793,167 @@
{% trans "Device" %}
-
-
+
+
+
+

+ {% trans "Assign network device to bridge" %} + {% include 'add_instance_network_block.html' %} +

+

{% trans "Network devices" %}

+
+
{% csrf_token %} + {% for network in networks %} +
+
+ +
+
+
+ + + + +
+
+ + + + +
+
+ + + + +
+
- {% if request.user.is_superuser %} -
-

{% trans "Autostart your instance when host server is power on" %}

- {% csrf_token %} - {% ifequal autostart 0 %} - + +
+ {% endfor %} + +
+
+ +
+
+

{% trans "For migration both host servers must have equal settings and OS type" %}

+
{% csrf_token %} +
+ +
+

{{ compute.name }}

+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ {% if computes_count != 1 %} + {% else %} - + + {% endif %} +
+

+
+
+

{% trans "If you need to edit xml please Power Off the instance" %}

+
{% csrf_token %} +
+ +
+ {% ifequal status 5 %} + + + {% else %} + {% endifequal %}
+
+
+

+ {% trans "Instance owners" %} + {% include 'add_instance_owner_block.html' %} +

+
+
+ + + {% for userinstance in userinstances %} + + + + + {% endfor %} + +
{{ userinstance.user }} +
{% csrf_token %} + + +
+
+
+
+
{% endif %} {% if request.user.is_superuser or userinstance.is_vnc %}
@@ -857,65 +1070,6 @@
{% endif %} - {% if request.user.is_superuser %} -
-

- {% trans "Assign network device to bridge" %} - {% include 'add_instance_network_block.html' %} -

-

{% trans "Network devices" %}

-
-
{% csrf_token %} - {% for network in networks %} -
-
- -
-
-
- - - - -
-
- - - - -
-
- - - - -
-
- - -
- {% endfor %} -
-
-
- -
- {% endif %} {% if request.user.is_superuser or request.user.userattributes.can_clone_instances %}

{% trans "Create a clone" %}

@@ -923,25 +1077,25 @@
{% if request.user.is_superuser %} -
- -
-
- -
+
+ +
+
+ +
{% elif clone_instance_auto_name %} -
- -
+
+ +
{% else %} -
- -
+
+ +
{% endif %}
{% if request.user.is_superuser %} @@ -1006,84 +1160,6 @@
- {% endif %} - {% if request.user.is_superuser %} -
-

{% trans "For migration both host servers must have equal settings and OS type" %}

-
{% csrf_token %} -
- -
-

{{ compute.name }}

-
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
- {% if computes_count != 1 %} - - {% else %} - - {% endif %} -
-

-
-
-

{% trans "If you need to edit xml please Power Off the instance" %}

-
{% csrf_token %} -
- -
- {% ifequal status 5 %} - - - {% else %} - - {% endifequal %} -
-
-
- {% endif %} - {% if request.user.is_superuser or request.user.userattributes.can_clone_instances %}
{% csrf_token %}
@@ -1113,36 +1189,6 @@
{% endif %} - {% if request.user.is_superuser %} -
-
-

- {% trans "Instance owners" %} - {% include 'add_instance_owner_block.html' %} -

-
-
- - - {% for userinstance in userinstances %} - - - - - {% endfor %} - -
{{ userinstance.user }} - {% csrf_token %} - - - -
-
-
-
- {% endif %}
@@ -1217,7 +1263,7 @@ - None ... + {% trans 'None' %}...
@@ -1271,8 +1317,6 @@ @@ -1415,7 +1457,6 @@ }); $(document).ready(function () { // set vdi url - $.get("{% url 'vdi_url' vname %}", function(data) { $("#vdi_url_input").attr("value", data); $("#vdi_url").attr("href", data); @@ -1444,6 +1485,72 @@ $(document).ready(function(){ placement : 'top' }); }); + +