From f3b8b251b55b8e5e57f6f3553f303dc1de40e121 Mon Sep 17 00:00:00 2001 From: catborise Date: Wed, 31 Jul 2019 09:59:44 +0300 Subject: [PATCH 01/12] Instance actions rearranged to reflect disable vm actions on instances list --- .../templates/allinstances_index_grouped.html | 22 ++-- .../allinstances_index_nongrouped.html | 117 +++++++++--------- instances/templates/instances.html | 22 ++-- instances/views.py | 6 + 4 files changed, 87 insertions(+), 80 deletions(-) diff --git a/instances/templates/allinstances_index_grouped.html b/instances/templates/allinstances_index_grouped.html index 0035e43..209610f 100644 --- a/instances/templates/allinstances_index_grouped.html +++ b/instances/templates/allinstances_index_grouped.html @@ -71,16 +71,16 @@ {% endif %} - - - - {% endifequal %} @@ -88,21 +88,21 @@ - - - - {% endifequal %} {% ifequal info.status 1 %} - - + {% endifequal %} diff --git a/instances/templates/allinstances_index_nongrouped.html b/instances/templates/allinstances_index_nongrouped.html index 6d04286..dc98ed5 100644 --- a/instances/templates/allinstances_index_nongrouped.html +++ b/instances/templates/allinstances_index_nongrouped.html @@ -23,67 +23,68 @@ {{ info.vcpu }} {{ info.memory|filesizeformat }} -
{% csrf_token %} - - - {% ifequal info.status 5 %} - {% if info.is_template %} - + {% else %} + + {% endif %} + - {% else %} - + + + {% endifequal %} + {% ifequal info.status 3 %} + - {% endif %} - - - - - {% endifequal %} - {% ifequal info.status 3 %} - - - - - - {% endifequal %} - {% ifequal info.status 1 %} - - - - - - - - {% endifequal %} -
+ + + + + {% endifequal %} + {% ifequal info.status 1 %} + + + + + + {% endifequal %} + {% endfor %} diff --git a/instances/templates/instances.html b/instances/templates/instances.html index 2383178..33e0b72 100644 --- a/instances/templates/instances.html +++ b/instances/templates/instances.html @@ -100,16 +100,16 @@ {% endif %} - - - - {% endifequal %} @@ -117,21 +117,21 @@ - - - - {% endifequal %} {% ifequal info.status 1 %} - - + {% endifequal %} diff --git a/instances/views.py b/instances/views.py index c1ae1a4..b0ecaba 100644 --- a/instances/views.py +++ b/instances/views.py @@ -988,6 +988,12 @@ def instances_actions(request): conn.shutdown(name) return HttpResponseRedirect(request.get_full_path()) + if 'powerforce' in request.POST: + conn.force_shutdown() + msg = _("Force Off") + addlogmsg(request.user.username, instance.name, msg) + return HttpResponseRedirect(request.get_full_path()) + if 'powercycle' in request.POST: msg = _("Power Cycle") conn.force_shutdown(name) From b18290794efc1330d2dd780b50b1e232a44f93aa Mon Sep 17 00:00:00 2001 From: catborise Date: Wed, 31 Jul 2019 11:03:48 +0300 Subject: [PATCH 02/12] Translate, indentation and typo fixes --- accounts/templates/account.html | 250 +- accounts/templates/accounts-list.html | 10 +- computes/templates/computes.html | 481 ++- computes/templates/overview.html | 188 +- create/templates/create_flav_block.html | 4 - create/templates/create_instance.html | 8 +- instances/templates/add_instance_volume.html | 222 +- instances/templates/allinstances.html | 264 +- .../templates/allinstances_index_grouped.html | 2 +- .../allinstances_index_nongrouped.html | 10 +- instances/templates/instance.html | 2575 ++++++++--------- instances/templates/instances.html | 289 +- interfaces/templates/interface.html | 130 +- interfaces/templates/interfaces.html | 120 +- logs/templates/paging.html | 2 +- logs/templates/showlogs.html | 90 +- networks/templates/modify_fixed_address.html | 1 - networks/templates/network.html | 402 +-- networks/templates/networks.html | 118 +- nwfilters/templates/add_nwf_rule.html | 6 +- nwfilters/templates/nwfilters.html | 280 +- secrets/templates/secrets.html | 222 +- storages/templates/storage.html | 370 +-- 23 files changed, 3013 insertions(+), 3031 deletions(-) diff --git a/accounts/templates/account.html b/accounts/templates/account.html index 0c5068d..56f91b8 100644 --- a/accounts/templates/account.html +++ b/accounts/templates/account.html @@ -2,139 +2,139 @@ {% load i18n %} {% block title %}{% trans "User" %} - {{ user }}{% endblock %} {% block content %} - -
-
- {% include 'create_user_inst_block.html' %} -

{{ user }}

-
+ +
+
+ {% include 'create_user_inst_block.html' %} +

{{ user }}

+
+
+ + + {% include 'errors_block.html' %} + + {% if request.user.is_superuser and publickeys %} +
+
+
+ + + + + + + + + {% for publickey in publickeys %} + + + + + {% endfor %} + +
{% trans "Key name" %}{% trans "Public key" %}
{{ publickey.keyname }}{{ publickey.keypublic|truncatechars:64 }}
- +
+
+ {% endif %} - {% include 'errors_block.html' %} - - {% if request.user.is_superuser and publickeys %} -
+
+
+ {% if not user_insts %}
-
- - - - - - - - - {% for publickey in publickeys %} - - - - - {% endfor %} - -
{% trans "Key name" %}{% trans "Public key" %}
{{ publickey.keyname }}{{ publickey.keypublic|truncatechars:64 }}
+
+ + {% trans "Warning:" %} {% trans "User doesn't have any Instace" %}
-
- {% endif %} - -
-
- {% if not user_insts %} -
-
- - {% trans "Warning:" %} {% trans "User doesn't have any Instace" %} -
-
- {% else %} -
- - - - - - - - - - - - - {% for inst in user_insts %} - - - - - - - + + + {% endfor %} + +
#{% trans "Instance" %}{% trans "VNC" %}{% trans "Resize" %}{% trans "Delete" %}{% trans "Action" %}
{{ forloop.counter }}{{ inst.instance.name }}{{ inst.is_vnc }}{{ inst.is_change }}{{ inst.is_delete }} - - - + {% else %} +
+ + + + + + + + + + + + + {% for inst in user_insts %} + + + + + + + - - - {% endfor %} - -
#{% trans "Instance" %}{% trans "VNC" %}{% trans "Resize" %}{% trans "Delete" %}{% trans "Action" %}
{{ forloop.counter }}{{ inst.instance.name }}{{ inst.is_vnc }}{{ inst.is_change }}{{ inst.is_delete }} + + + - - -
{% csrf_token %} - - -
-
-
- {% endif %} + + + + + + +
+
{% csrf_token %} + + +
+
-
+ {% endif %} +
+
{% endblock %} diff --git a/accounts/templates/accounts-list.html b/accounts/templates/accounts-list.html index f5a6013..d6630cc 100644 --- a/accounts/templates/accounts-list.html +++ b/accounts/templates/accounts-list.html @@ -30,11 +30,11 @@ - - - - - + + + + + diff --git a/computes/templates/computes.html b/computes/templates/computes.html index 6233122..a03b937 100644 --- a/computes/templates/computes.html +++ b/computes/templates/computes.html @@ -2,251 +2,250 @@ {% load i18n %} {% block title %}{% trans "Computes" %}{% endblock %} {% block content %} - -
-
- {% include 'create_comp_block.html' %} -

{% trans "Computes" %}

-
-
- + +
+
+ {% include 'create_comp_block.html' %} +

{% trans "Computes" %}

+
+
+ - {% include 'errors_block.html' %} + {% include 'errors_block.html' %} -
- {% if computes_info %} - {% for compute in computes_info %} -
-
-
- {% ifequal compute.status 1 %} -

- {{ compute.name }} - - - -

- {% else %} -

{{ compute.name }} - - - -

- {% endifequal %} +
+ {% if computes_info %} + {% for compute in computes_info %} +
+
+
+ {% ifequal compute.status 1 %} +

+ {{ compute.name }} + + + +

+ {% else %} +

{{ compute.name }} + + + +

+ {% endifequal %} +
+
+
+
+

{% trans "Status" %}:

-
-
-
-

{% trans "Status:" %}

-
-
- {% if compute.status %} -

{% trans "Connected" %}

- {% else %} -

{% trans "Not Connected" %}

- {% endif %} - {% if compute.details %} -

{% trans compute.details %}

- {% else %} -

{% trans "No details available" %}

- {% endif %} -
-
- - - - +
+ {% if compute.status %} +

{% trans "Connected" %}

+ {% else %} +

{% trans "Not Connected" %}

+ {% endif %} + {% if compute.details %} +

{% trans compute.details %}

+ {% else %} +

{% trans "No details available" %}

+ {% endif %}
+ + +
- {% endfor %} - {% else %} -
-
- - {% trans "Warning:" %} {% trans "Hypervisor doesn't have any Computes" %} -
-
- {% endif %} -
+
+
+ {% endfor %} + {% else %} +
+
+ + {% trans "Warning" %}: {% trans "Hypervisor doesn't have any Computes" %} +
+
+ {% endif %} +
{% endblock %} diff --git a/computes/templates/overview.html b/computes/templates/overview.html index 9418b20..81398b9 100644 --- a/computes/templates/overview.html +++ b/computes/templates/overview.html @@ -3,107 +3,107 @@ {% load staticfiles %} {% block title %}{% trans "Overview" %} - {{ compute.name }}{% endblock %} {% block content %} - -
-
-

{{ compute.name }}

- -
-
- + +
+
+

{{ compute.name }}

+ +
+
+ - {% include 'errors_block.html' %} + {% include 'errors_block.html' %} -
- -
-

{% trans "Hostname" %}

-

{% trans "Hypervisors" %}

-

{% trans "Emulator" %}

-

{% trans "Version" %}

-

{% trans "Memory" %}

-

{% trans "Architecture" %}

-

{% trans "Logical CPUs" %}

-

{% trans "Processor" %}

-

{% trans "Connection" %}

-

{% trans "Details" %}

+
+ +
+

{% trans "Hostname" %}

+

{% trans "Hypervisors" %}

+

{% trans "Emulator" %}

+

{% trans "Version" %}

+

{% trans "Memory" %}

+

{% trans "Architecture" %}

+

{% trans "Logical CPUs" %}

+

{% trans "Processor" %}

+

{% trans "Connection" %}

+

{% trans "Details" %}

+
+
+

{{ hostname }}

+

{% for arch, hpv in hypervisor.items %} + + {{ arch }} + {% for h in hpv %} + {{ h }} + {% endfor %} + {% endfor %} +

+

{{ emulator }}

+

+ Qemu + {{ version }}   + Libvirt + {{ lib_version }}   +

+

{{ host_memory|filesizeformat }}

+

{{ host_arch }}

+

{{ logical_cpu }}

+

{{ model_cpu }}

+

{{ uri_conn }}

+

{{ compute.details }}

+
+
+
+
+ +
+
+

{% trans "CPU Utilization" %}

-
-

{{ hostname }}

-

{% for arch, hpv in hypervisor.items %} - - {{ arch }} - {% for h in hpv %} - {{ h }} - {% endfor %} - {% endfor %} -

-

{{ emulator }}

-

- {% trans 'Qemu' %} - {{ version }}   - {% trans 'Libvirt' %} - {{ lib_version }}   -

-

{{ host_memory|filesizeformat }}

-

{{ host_arch }}

-

{{ logical_cpu }}

-

{{ model_cpu }}

-

{{ uri_conn }}

-

{{ compute.details }}

-
-
-
-
- -
-
-

{% trans "CPU Utilization" %}

-
-
-
-
- -
-
-
-
-
-
-

{% trans "RAM Utilization" %}

-
-
-
-
- -
-
+
+
+
+
+
+
+

{% trans "RAM Utilization" %}

+
+
+
+
+ +
+
+
+
+
+
{% endblock %} {% block script %} diff --git a/create/templates/create_flav_block.html b/create/templates/create_flav_block.html index 979599f..26df5ca 100644 --- a/create/templates/create_flav_block.html +++ b/create/templates/create_flav_block.html @@ -17,7 +17,6 @@
{% csrf_token %}
-
@@ -25,7 +24,6 @@
-
@@ -33,7 +31,6 @@
-
@@ -42,7 +39,6 @@
-
diff --git a/create/templates/create_instance.html b/create/templates/create_instance.html index fb0a6f1..6580cd5 100644 --- a/create/templates/create_instance.html +++ b/create/templates/create_instance.html @@ -224,7 +224,7 @@ {% endif %}
- +
@@ -436,7 +436,6 @@
-
@@ -582,8 +581,7 @@
-
- +
{% endblock %} @@ -607,7 +605,6 @@ } $(document).ready(function () { - $('#image-control').multiselect({ disableIfEmpty: true, enableCaseInsensitiveFiltering: true, @@ -716,7 +713,6 @@ function get_disk_bus_choices(compute_id, dev_idx, disk_type){ get_diskBus_url = "/computes/" + compute_id + "/disk/" + disk_type + "/buses"; - $.getJSON(get_diskBus_url, function (data) { $("#bus" + dev_idx).find('option').remove(); $.each(data['bus'], function(i, item) { diff --git a/instances/templates/add_instance_volume.html b/instances/templates/add_instance_volume.html index 9ae808a..ba2f978 100644 --- a/instances/templates/add_instance_volume.html +++ b/instances/templates/add_instance_volume.html @@ -1,121 +1,62 @@ {% load i18n %} {% if request.user.is_superuser %} - - - + + + - -
UsernameStatusStaffSuperuserClone{% trans "Username" %}{% trans "Status" %}{% trans "Staff" %}{% trans "Superuser" %}{% trans "Clone" %}
- - - - - - - - - - - {% for inst, vm in all_user_vms.items %} - - - - - - - - {% endfor %} - -
{% trans 'Name' %}{% trans 'Status' %}{% trans 'VCPU' %}{% trans 'Memory' %}{% trans 'Actions' %}
{{ vm.name }}
{{ vm.title }}
{% ifequal vm.status 1 %} - {% trans "Active" %} - {% endifequal %} - {% ifequal vm.status 5 %} - {% trans "Off" %} - {% endifequal %} - {% ifequal vm.status 3 %} - {% trans "Suspend" %} - {% endifequal %} - {{ vm.vcpu }}{{ vm.memory }} {% trans "MB" %}
{% csrf_token %} - - - {% ifequal vm.status 5 %} - {% if inst.instance.is_template %} - - {% else %} - - {% endif %} - - - - {% endifequal %} - {% ifequal vm.status 3 %} - - - - - {% endifequal %} - {% ifequal vm.status 1 %} - - - - - - - {% endifequal %} -
-
- {% endif %} - {% endif %}
-
-
+ {% else %} + {% ifequal view_style "nongrouped" %} + {% include 'allinstances_index_nongrouped.html' %} + {% endifequal %} + {% ifequal view_style "grouped" %} + {% include 'allinstances_index_grouped.html' %} + {% endifequal %} + {% endif %} + {% else %} + {% if not all_user_vms %} +
+
+ + {% trans "Warning" %}: {% trans "You don't have any Instance" %} +
+
+ {% else %} + + + + + + + + + + + + {% for inst, vm in all_user_vms.items %} + + + + + + + + {% endfor %} + +
{% trans 'Name' %}{% trans 'Status' %}{% trans 'VCPU' %}{% trans 'Memory' %}{% trans 'Actions' %}
{{ vm.name }}
{{ vm.title }}
{% ifequal vm.status 1 %} + {% trans "Active" %} + {% endifequal %} + {% ifequal vm.status 5 %} + {% trans "Off" %} + {% endifequal %} + {% ifequal vm.status 3 %} + {% trans "Suspend" %} + {% endifequal %} + {{ vm.vcpu }}{{ vm.memory }} {% trans "MB" %}
{% csrf_token %} + + + {% ifequal vm.status 5 %} + {% if inst.instance.is_template %} + + {% else %} + + {% endif %} + + + + {% endifequal %} + {% ifequal vm.status 3 %} + + + + + {% endifequal %} + {% ifequal vm.status 1 %} + + + + + + + {% endifequal %} +
+
+ {% endif %} + {% endif %} + + + {% endblock %} {% block script %} diff --git a/instances/templates/allinstances_index_grouped.html b/instances/templates/allinstances_index_grouped.html index 209610f..645ccf4 100644 --- a/instances/templates/allinstances_index_grouped.html +++ b/instances/templates/allinstances_index_grouped.html @@ -3,7 +3,7 @@ # - {% trans "Name" %}
{% trans "Description" %} + {% trans "Name" %}
{% trans "Description" %} {% trans "User"%} {% trans "Status" %} {% trans "VCPU" %} diff --git a/instances/templates/allinstances_index_nongrouped.html b/instances/templates/allinstances_index_nongrouped.html index dc98ed5..33d6c5c 100644 --- a/instances/templates/allinstances_index_nongrouped.html +++ b/instances/templates/allinstances_index_nongrouped.html @@ -2,11 +2,11 @@ - - - - - + + + + + diff --git a/instances/templates/instance.html b/instances/templates/instance.html index f0464b6..3391569 100644 --- a/instances/templates/instance.html +++ b/instances/templates/instance.html @@ -3,1335 +3,1334 @@ {% load i18n %} {% block title %}{% trans "Instance" %} - {{ vname }}{% endblock %} {% block content %} - {% include 'pleasewaitdialog.html' %} - -
-
-

- {{ vname }}{% if title %} ({{ title }}){% endif %} -

-
-
-
- {% ifequal status 5 %} - {% trans "Off" %} - {% endifequal %} - {% ifequal status 1 %} - {% trans "Active" %} - {% endifequal %} - {% ifequal status 3 %} - {% trans "Suspend" %} - {% endifequal %} - | - {% if cur_vcpu %} - {{ cur_vcpu }} {% trans "Vcpu" %} - {% else %} - {{ vcpu }} {% trans "Vcpu" %} - {% endif %} - | - {{ cur_memory }} {% trans "MB" %} {% trans "Ram" %} - | - {% for disk in disks %} - {{ disk.size|filesizeformat }} {% trans "Disk" %} | - {% endfor %} - - on - {{ compute.name }}{% if compute.name != compute.hostname %} - {{ compute.hostname }}{% endif %} -
-
- {% if user_quota_msg %} - {{ user_quota_msg|capfirst }} {% trans "quota reached" %}. + {% include 'pleasewaitdialog.html' %} + +
+
+

+ {{ vname }}{% if title %} ({{ title }}){% endif %} +

+
+
+
+ {% ifequal status 5 %} + {% trans "Off" %} + {% endifequal %} + {% ifequal status 1 %} + {% trans "Active" %} + {% endifequal %} + {% ifequal status 3 %} + {% trans "Suspend" %} + {% endifequal %} + | + {% if cur_vcpu %} + {{ cur_vcpu }} {% trans "Vcpu" %} + {% else %} + {{ vcpu }} {% trans "Vcpu" %} + {% endif %} + | + {{ cur_memory }} {% trans "MB" %} {% trans "Ram" %} + | + {% for disk in disks %} + {{ disk.size|filesizeformat }} {% trans "Disk" %} | + {% endfor %} + + on + {{ compute.name }}{% if compute.name != compute.hostname %} - {{ compute.hostname }}{% endif %} +
+
+ {% if user_quota_msg %} + {{ user_quota_msg|capfirst }} {% trans "quota reached" %}. + {% endif %} +
+
+ + {% include 'errors_block.html' %} + {% include 'messages_block.html' %} + +
+
+
+ +
- - {% include 'errors_block.html' %} - {% include 'messages_block.html' %} - - -
-
+
  • + + + {% trans "Settings" %} + +
  • +
  • + + + {% trans "Stats" %} + +
  • +
  • + + + {% trans "Destroy" %} + +
  • + + +
    +
    -
    +
    +
    +
    + + + +
    +
    +

    {% trans "This action opens a new window with a VNC connection to the console of the instance." %}

    + {% ifequal status 1 %} + +
    + + + +
    + {% else %} + + {% endifequal %} +
    +
    + {% if show_access_root_password %} +
    +

    {% trans "You need shut down your instance and enter a new root password." %}

    +
    {% csrf_token %} +
    +
    + +
    +
    + {% ifequal status 5 %} + + {% else %} + + {% endifequal %} + +
    +
    + {% endif %} + {% if show_access_ssh_keys %} +
    +

    {% trans "You need shut down your instance and choose your public key." %}

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

    {% trans "This action opens a remote viewer with a connection to the console of the instance." %}

    +
    + + + {% trans "VDI" %} + +
    +
    +
    + {% endifequal %} +
    +
    +
    +
    +
    + + + +
    +
    + {% if request.user.is_superuser or request.user.is_staff or userinstance.is_change %} +
    {% csrf_token %} +

    {% trans "Logical host CPUs" %} : {{ vcpu_host }}

    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +

    {% trans "Total host memory:" %} {{ memory_host|filesizeformat }}

    +
    + +
    + + + {% trans "Custom value" %} +
    +
    +
    + +
    + + + {% trans "Custom value" %} +
    +
    +

    {% trans "Disk allocation (B):" %}

    + {% for disk in disks %} +
    + +
    + +
    +
    + {% endfor %} + {% ifequal status 5 %} + + {% else %} + + {% endifequal %} + + {% else %} + {% trans "You don't have permission for resizing instance" %} + + {% endif %} +
    +
    +
    +
    +
    +
    +
    + +
    -
    -
    - - - -
    - {% ifequal status 1 %} -
    -

    {% trans "This action sends an ACPI shutdown signal to the instance." %}

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

    {% trans "This may take more than an hour, depending on how much content is on your droplet and how large the disk is." %}

    +
    {% csrf_token %} +
    +
    +
    -
    -

    {% trans "This action forcibly powers off and start the instance and may cause data corruption." %}

    - {% csrf_token %} - -
    - -
    -
    -

    {% trans "This action forcibly powers off the instance and may cause data corruption." %}

    -
    {% csrf_token %} - -
    - -
    - {% if request.user.is_superuser %} -
    -

    {% trans "This action suspends the instance." %}

    -
    {% csrf_token %} - -
    - -
    - {% endif %} - {% endifequal %} - {% ifequal status 3 %} - {% if request.user.is_superuser %} -
    -

    {% trans "This action restore the instance after suspend." %}

    -
    {% csrf_token %} - -
    - -
    -
    -

    {% trans "This action forcibly powers off the instance and may cause data corruption." %}

    -
    {% csrf_token %} - -
    - -
    - {% else %} -
    -

    {% trans "Administrator blocked your instance." %}

    -
    {% csrf_token %} - -
    - -
    - {% endif %} - {% endifequal %} - {% ifequal status 5 %} -
    -

    {% trans "Click on Boot button to start this instance." %}

    -
    {% csrf_token %} - {% if instance.is_template %} -

    {% trans "Template instance cannot be started." %}

    - - {% else %} - - {% endif %} -
    - -
    - {% endifequal %} -
    -
    -
    -
    -
    - - - -
    -
    -

    {% trans "This action opens a new window with a VNC connection to the console of the instance." %}

    - {% ifequal status 1 %} - -
    - - - -
    - {% else %} - - {% endifequal %} -
    - {% if show_access_root_password %} -
    -

    {% trans "You need shut down your instance and enter a new root password." %}

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

    {% trans "To take a snapshot please Power Off the instance." %}

    + {% endifequal %} +
    +
    + {% ifequal status 5 %} + {% if snapshots %} +

    {% trans "Choose a snapshot for restore/delete" %}

    +
    +
    Name
    Description
    Host
    User
    StatusVCPUMemory{% trans "Name" %}
    {% trans "Description" %}
    {% trans "Host" %}
    {% trans "User"%}
    {% trans "Status" %}{% trans "VCPU" %}{% trans "Memory" %} {% trans "Actions" %}
    + + + + + + + {% for snap in snapshots %} + + + + + + + {% endfor %} + +
    {% trans "Name" %}{% trans "Date" %}{% trans "Action" %}
    {{ snap.name }}{{ snap.date|date:"M d H:i:s" }} +
    {% csrf_token %} + + {% ifequal status 5 %} + + {% else %} + + {% endifequal %} +
    +
    +
    {% csrf_token %} + + +
    +
    + + {% else %} +

    {% trans "You do not have any snapshots" %}

    + {% endif %} + {% else %} +

    {% trans "To restore snapshots you need Power Off the instance." %}

    + {% endifequal %} + + + + +
    +
    + + + +
    + {% if request.user.is_superuser %} +
    +

    {% trans 'Autostart' %}

    +
    {% csrf_token %} +
    +
    +

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

    +
    +
    +
    +

    {% 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 %} + {% ifequal bootmenu 0 %} +

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

    + {% endifequal %} + {% 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 %}
    - {% ifequal status 5 %} - - {% else %} - - {% endifequal %} - -
    -
    - {% endif %} - {% if show_access_ssh_keys %} -
    -

    {% trans "You need shut down your instance and choose your public key." %}

    -
    {% csrf_token %} -
    -
    - +
    + + {% endifequal %} +
    +
    +
    +
    {% csrf_token %} +

    + {% trans "Instance Media" %} + {% if status == 5 %} + + {% else %} + + {% endif %} +

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

    {% trans "This action opens a remote viewer with a connection to the console of the instance." %}

    -
    - - - {% trans "VDI" %} - +
    + +
    +
    + + {% if allow_admin_or_not_template %} + + {% else %} + + {% endif %} +
    + {% endif %}
    -
    + + {% empty %} +
    +
    {% trans 'There is not any CD-ROM device.' %}
    + {% endfor %} +
    +

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

    + +
    + + + + + + + + + + + {% for disk in disks %} + + + + + + + + + {% endfor %} + +
    {% trans "Device" %}{% trans "Used" %}{% trans "Capacity" %}{% trans "Storage" %}{% trans "Source" %}{% trans "Action" %}
    + + {{ disk.dev }} +
    + {{ disk.target }} +
    {{ disk.used | filesizeformat}}{{ disk.size | filesizeformat }}{{ disk.storage }}{{ disk.path }} +
    {% csrf_token %} + + + + + {% ifequal status 5 %} + + + {% else %} + + + {% endifequal %} +
    +
    +
    +
    +
    +
    +

    + {% trans "Add a network device" %} + {% include 'add_instance_network_block.html' %} +

    + +
    +
    {% csrf_token %} + {% for network in networks %} + {% if forloop.first %} +

    {% trans "Network Devices" %}

    + {% endif %} +
    +
    + + +
    +
    +
    + + + + +
    +
    + + + + +
    +
    + + + + +
    + +
    +
    + {% 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 request.user.is_staff or userinstance.is_vnc %} +
    +

    {% trans "To set console's type, shutdown the instance." %}

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

    {% trans "To set console listen address, shutdown the instance." %}

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

    {% trans "To create console password, shutdown the instance." %}

    +
    {% csrf_token %} +
    +
    +
    + +
    +
    + +
    +
    +
    +
    + +
    + +
    +
    + {% if console_passwd %} + {% trans "Show" %} + {% endif %} + {% ifequal status 5 %} + + {% else %} + + {% endifequal %} +
    +
    +
    +

    {% trans "To set console's keymap, shutdown the instance." %}

    +
    {% csrf_token %} +
    +
    +
    + +
    +
    +
    +
    + +
    + +
    +
    + {% ifequal status 5 %} + + {% else %} + + {% endifequal %} +
    +
    +
    +
    +
    + {% endif %} + {% if request.user.is_superuser or request.user.userattributes.can_clone_instances %} +
    +

    {% trans "Create a clone" %}

    +
    {% csrf_token %} +
    + + {% if request.user.is_superuser %} +
    + +
    +
    + +
    + {% elif clone_instance_auto_name %} +
    + +
    + {% else %} +
    + +
    + {% endif %} +
    + {% if request.user.is_superuser %} +

    {% trans "Network devices" %}

    + {% for network in networks %} +
    + +
    + +
    +
    + + +
    +
    + {% endfor %} + {% else %} + {% for network in networks %} + + {% endfor %} + {% endif %} + {% if request.user.is_superuser %} +

    {% trans "Storage devices" %}

    + {% for disk in disks %} +
    + +
    + +
    + {% ifequal disk.format 'qcow2' %} + +
    + +
    {% endifequal %}
    + {% endfor %} + {% else %} + {% for disk in disks %} + + {% endfor %} + {% endif %} +
    + +
    +
    -
    -
    - - - -
    -
    - {% if request.user.is_superuser or request.user.is_staff or userinstance.is_change %} - {% csrf_token %} -

    {% trans "Logical host CPUs" %} : {{ vcpu_host }}

    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -

    {% trans "Total host memory:" %} {{ memory_host|filesizeformat }}

    -
    - -
    - - - {% trans "Custom value" %} -
    -
    -
    - -
    - - - {% trans "Custom value" %} -
    -
    -

    {% trans "Disk allocation (B):" %}

    - {% for disk in disks %} -
    - -
    - -
    -
    - {% endfor %} - {% ifequal status 5 %} - - {% else %} - - {% endifequal %} - - {% else %} - {% trans "You don't have permission for resizing instance" %} - - {% endif %} -
    +
    + +
    + +
    +
    + {% ifequal status 5 %} + + {% else %} + + {% endifequal %} + +
    +
    +
    +
    {% csrf_token %} +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    + {% ifequal status 5 %} + + {% else %} + + {% endifequal %} +
    +
    +
    + {% endif %} +
    +
    +
    +
    +
    + + + +
    +
    +
    +
    +

    {% trans "CPU Usage" %}

    +
    +
    +
    +
    + +
    -
    -
    -
    - - - -
    -
    - {% ifequal status 5 %} -

    {% trans "This may take more than an hour, depending on how much content is on your droplet and how large the disk is." %}

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

    {% trans "To take a snapshot please Power Off the instance." %}

    - {% endifequal %} -
    -
    - {% ifequal status 5 %} - {% if snapshots %} -

    {% trans "Choose a snapshot for restore/delete" %}

    -
    - - - - - - - - {% for snap in snapshots %} - - - - - - - {% endfor %} - -
    {% trans "Name" %}{% trans "Date" %}{% trans "Action" %}
    {{ snap.name }}{{ snap.date|date:"M d H:i:s" }} -
    {% csrf_token %} - - {% ifequal status 5 %} - - {% else %} - - {% endifequal %} -
    -
    -
    {% csrf_token %} - - -
    -
    -
    - {% else %} -

    {% trans "You do not have any snapshots" %}

    - {% endif %} - {% else %} -

    {% trans "To restore snapshots you need Power Off the instance." %}

    - {% endifequal %} +
    +
    +

    {% trans "Memory Usage" %}

    +
    +
    +
    +
    + +
    -
    -
    -
    - - - -
    - {% if request.user.is_superuser %} -
    -

    {% trans 'Autostart' %}

    -
    {% csrf_token %} -
    -
    -

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

    -
    -
    -
    -

    {% 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 %} - {% ifequal bootmenu 0 %} -

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

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

    - {% trans "Instance Media" %} - {% if status == 5 %} - - {% else %} - - {% endif %} -

    -
    - {% for cd in media %} -
    {% csrf_token %} -
    - - {% trans "CDROM" %} {{ forloop.counter }} - - {% if not cd.image %} -
    - -
    -
    - {% if media_iso and allow_admin_or_not_template %} - - {% else %} - - {% endif %} - {% if status == 5 and allow_admin_or_not_template %} - - {% endif %} -
    - {% else %} -
    - -
    -
    - - {% if allow_admin_or_not_template %} - - {% else %} - - {% endif %} -
    - {% endif %} -
    -
    - {% empty %} -
    -
    {% trans 'There is not any CD-ROM device.' %}
    -
    - {% endfor %} -
    -

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

    - -
    - - - - - - - - - - - {% for disk in disks %} - - - - - - - - - {% endfor %} - -
    {% trans "Device" %}{% trans "Used" %}{% trans "Capacity" %}{% trans "Storage" %}{% trans "Source" %}{% trans "Action" %}
    - - {{ disk.dev }} -
    - {{ disk.target }} -
    {{ disk.used | filesizeformat}}{{ disk.size | filesizeformat }}{{ disk.storage }}{{ disk.path }} -
    {% csrf_token %} - - - - - {% ifequal status 5 %} - - - {% else %} - - - {% endifequal %} -
    -
    -
    -
    -
    -
    -

    - {% trans "Add a network device" %} - {% include 'add_instance_network_block.html' %} -

    - -
    -
    {% csrf_token %} - {% for network in networks %} - {% if forloop.first %} -

    {% trans "Network Devices" %}

    - {% endif %} -
    -
    - - -
    -
    -
    - - - - -
    -
    - - - - -
    -
    - - - - -
    - -
    -
    - {% 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 request.user.is_staff or userinstance.is_vnc %} -
    -

    {% trans "To set console's type, shutdown the instance." %}

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

    {% trans "To set console listen address, shutdown the instance." %}

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

    {% trans "To create console password, shutdown the instance." %}

    -
    {% csrf_token %} -
    -
    -
    - -
    -
    - -
    -
    -
    -
    - -
    - -
    -
    - {% if console_passwd %} - {% trans "Show" %} - {% endif %} - {% ifequal status 5 %} - - {% else %} - - {% endifequal %} -
    -
    -
    -

    {% trans "To set console's keymap, shutdown the instance." %}

    -
    {% csrf_token %} -
    -
    -
    - -
    -
    -
    -
    - -
    - -
    -
    - {% ifequal status 5 %} - - {% else %} - - {% endifequal %} -
    -
    -
    -
    -
    - {% endif %} - {% if request.user.is_superuser or request.user.userattributes.can_clone_instances %} -
    -

    {% trans "Create a clone" %}

    -
    {% csrf_token %} -
    - - {% if request.user.is_superuser %} -
    - -
    -
    - -
    - {% elif clone_instance_auto_name %} -
    - -
    - {% else %} -
    - -
    - {% endif %} -
    - {% if request.user.is_superuser %} -

    {% trans "Network devices" %}

    - {% for network in networks %} -
    - -
    - -
    -
    - - -
    -
    - {% endfor %} - {% else %} - {% for network in networks %} - - {% endfor %} - {% endif %} - {% if request.user.is_superuser %} -

    {% trans "Storage devices" %}

    - {% for disk in disks %} -
    - -
    - -
    - {% ifequal disk.format 'qcow2' %} - -
    - -
    - {% endifequal %} -
    - {% endfor %} - {% else %} - {% for disk in disks %} - - {% endfor %} - {% endif %} -
    - -
    - -
    -
    -
    - -
    - -
    -
    - {% ifequal status 5 %} - - {% else %} - - {% endifequal %} -
    -
    -
    -
    -
    {% csrf_token %} -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    - {% ifequal status 5 %} - - {% else %} - - {% endifequal %} -
    -
    -
    - {% endif %} -
    -
    -
    -
    -
    - - - -
    -
    -
    -
    -

    {% trans "CPU Usage" %}

    -
    -
    -
    -
    - -
    -
    -
    -
    -
    -
    -

    {% trans "Memory Usage" %}

    -
    -
    -
    -
    - -
    -
    -
    -
    - {% for net in networks %} -
    -
    -

    {% trans "Bandwidth Device" %}: eth{{ forloop.counter0 }}

    -
    -
    -
    -
    - -
    -
    -
    -
    - {% endfor %} - {% for disk in disks %} -
    -
    -

    {% trans "Disk I/O device" %}: {{ disk.dev }}

    -
    -
    -
    -
    - -
    -
    -
    -
    - {% endfor %} -
    + {% for net in networks %} +
    +
    +

    {% trans "Bandwidth Device" %}: eth{{ forloop.counter0 }}

    -
    -
    - - - - - - - - - - - -
    {% trans "Date" %}{% trans "User" %}{% trans "Message" %}
    {% trans 'None' %}...
    +
    +
    +
    + +
    -
    -
    -
    -
    -
    - - - -
    -
    -

    {% trans "Delete storage for instance?" %}

    - {% if request.user.is_superuser or userinstance.is_delete %} - {% ifequal status 3 %} - - {% else %} -
    {% csrf_token %} -
    - -
    - -
    - {% endifequal %} - {% else %} - - {% endif %} -
    + {% endfor %} + {% for disk in disks %} +
    +
    +

    {% trans "Disk I/O device" %}: {{ disk.dev }}

    +
    +
    +
    +
    + +
    +
    + {% endfor %} +
    +
    +
    +
    + + + + + + + + + + + +
    {% trans "Date" %}{% trans "User" %}{% trans "Message" %}
    {% trans 'None' %}...
    +
    +
    +
    +
    +
    +
    +
    + + + +
    +
    +

    {% trans "Delete storage for instance?" %}

    + {% if request.user.is_superuser or userinstance.is_delete %} + {% ifequal status 3 %} + + {% else %} +
    {% csrf_token %} +
    + +
    + +
    + {% endifequal %} + {% else %} + + {% endif %} +
    +
    +
    +
    {% endblock %} {% block script %} @@ -1501,11 +1500,11 @@ {% endif %} diff --git a/interfaces/templates/interface.html b/interfaces/templates/interface.html index 5c5c2b5..1693d81 100644 --- a/interfaces/templates/interface.html +++ b/interfaces/templates/interface.html @@ -2,72 +2,72 @@ {% load i18n %} {% block title %}{% trans "Interface" %} - {{ iface }}{% endblock %} {% block content %} - - - + + + - {% include 'errors_block.html' %} + {% include 'errors_block.html' %} -
    -
    -

    {% trans "Interface:" %}

    -

    {% trans "IPv4:" %} ({% ifequal ipv4 None %}None{% else %}{{ ipv4_type }}{% endifequal %})

    -

    {% trans "IPv6:" %} ({% ifequal ipv6 None %}None{% else %}{{ ipv6_type }}{% endifequal %})

    -

    {% trans "MAC Adress:" %}

    -

    {% trans "Interface Type:" %}

    - {% ifequal itype 'bridge' %} -

    {% trans "Bridge device" %}

    +
    +
    +

    {% trans "Interface" %}:

    +

    {% trans "IPv4" %}: ({% ifequal ipv4 None %}{% trans 'None' %}{% else %}{{ ipv4_type }}{% endifequal %})

    +

    {% trans "IPv6" %}: ({% ifequal ipv6 None %}{% trans 'None' %}{% else %}{{ ipv6_type }}{% endifequal %})

    +

    {% trans "MAC Adress" %}:

    +

    {% trans "Interface Type" %}:

    + {% ifequal itype 'bridge' %} +

    {% trans "Bridge device" %}

    + {% endifequal %} +

    {% trans "Boot Mode" %}:

    +

    {% trans "State" %}:

    +
    +
    +

    {{ iface }}

    +

    {{ ipv4 }}

    +

    {{ ipv6 }}

    +

    {{ mac }}

    +

    {{ itype }}

    + {% ifequal itype 'bridge' %} +

    {{ bridge }}

    + {% endifequal %} +

    {{ start_mode }}

    +

    +

    {% csrf_token %} + {% ifequal state 0 %} + + + {% else %} + {% endifequal %} -

    {% trans "Boot Mode:" %}

    -

    {% trans "State:" %}

    -
    -
    -

    {{ iface }}

    -

    {{ ipv4 }}

    -

    {{ ipv6 }}

    -

    {{ mac }}

    -

    {{ itype }}

    - {% ifequal itype 'bridge' %} -

    {{ bridge }}

    - {% endifequal %} -

    {{ start_mode }}

    -

    - {% csrf_token %} - {% ifequal state 0 %} - - - {% else %} - - {% endifequal %} - -

    -
    -
    + +

    +
    +
    {% endblock %} \ No newline at end of file diff --git a/interfaces/templates/interfaces.html b/interfaces/templates/interfaces.html index 8305b88..5b8ef13 100644 --- a/interfaces/templates/interfaces.html +++ b/interfaces/templates/interfaces.html @@ -3,73 +3,73 @@ {% load staticfiles %} {% block title %}{% trans "Interfaces" %} - {{ compute.name }}{% endblock %} {% block content %} - -
    -
    - {% include 'create_iface_block.html' %} -

    {{ compute.name }}

    - + +
    +
    + {% include 'create_iface_block.html' %} +

    {{ compute.name }}

    + +
    +
    + + + {% include 'errors_block.html' %} + +
    + {% if not ifaces_all %} +
    +
    + + {% trans "Warning:" %} {% trans "Hypervisor doesn't have any Interfaces" %}
    - - - {% include 'errors_block.html' %} - -
    - {% if not ifaces_all %} -
    -
    - - {% trans "Warning:" %} {% trans "Hypervisor doesn't have any Interfaces" %} + {% else %} + {% for iface in ifaces_all %} +
    + - {% else %} - {% for iface in ifaces_all %} -
    -
    -
    -

    {{ iface.name }} -

    +
    +
    +
    +

    {% trans "Type:" %}

    +

    {% trans "MAC:" %}

    -
    -
    -
    -

    {% trans "Type:" %}

    -

    {% trans "MAC:" %}

    -
    -
    -

    {{ iface.type }}

    -

    {{ iface.mac }}

    -
    -
    +
    +

    {{ iface.type }}

    +

    {{ iface.mac }}

    - {% endfor %} - {% endif %} -
    +
    +
    + {% endfor %} + {% endif %} +
    {% endblock %} {% block script %} - + + diff --git a/storages/templates/storage.html b/storages/templates/storage.html index e806cf3..e7ddfe1 100644 --- a/storages/templates/storage.html +++ b/storages/templates/storage.html @@ -7,194 +7,194 @@ {% endblock %} {% block content %} - -
    -
    - {% include 'create_stg_vol_block.html' %} -

    {% trans "Storage:" %} {{ pool }}

    - -
    -
    - - -{% include 'errors_block.html' %} -{% include 'messages_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 }}%

    -

    -

    {% csrf_token %} - {% ifequal state 0 %} - - - {% else %} - - {% endifequal %} -
    -

    -

    -

    {% csrf_token %} - {% ifequal autostart 0 %} - - {% else %} - - {% endifequal %} -
    -

    -
    -
    -
    -
    - {% if state %} -
    -
    - -
    - - -
    - {% if volumes %} -
    - - - - - - - - - - - - - {% for volume in volumes %} - - - - - - - - - - {% endfor %} - -
    #{% trans "Name" %}{% trans "Allocated" %}{% trans "Size" %}{% trans "Format" %}{% trans "Action" %}
    {{ forloop.counter }}{{ volume.name }}{{ volume.allocation|filesizeformat }}{{ volume.size|filesizeformat }}{{ volume.type }} - - - {% ifnotequal volume.type "iso" %} - - {% else %} - - {% endifnotequal %} - -
    {% csrf_token %} - - -
    -
    -
    - {% else %} + +
    -
    - - {% trans "Warning:" %} {% trans "Hypervisor doesn't have any Volumes" %} -
    + {% include 'create_stg_vol_block.html' %} +

    {% trans "Storage:" %} {{ pool }}

    +
    - {% endif %} - {% endif %}
    -
    -{% include 'pleasewaitdialog.html' %} + + + {% include 'errors_block.html' %} + {% include 'messages_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 }}%

    +

    +

    {% csrf_token %} + {% ifequal state 0 %} + + + {% else %} + + {% endifequal %} +
    +

    +

    +

    {% csrf_token %} + {% ifequal autostart 0 %} + + {% else %} + + {% endifequal %} +
    +

    +
    +
    +
    +
    + {% if state %} +
    +
    + +
    + + +
    + {% if volumes %} +
    + + + + + + + + + + + + + {% for volume in volumes %} + + + + + + + + + + {% endfor %} + +
    #{% trans "Name" %}{% trans "Allocated" %}{% trans "Size" %}{% trans "Format" %}{% trans "Action" %}
    {{ forloop.counter }}{{ volume.name }}{{ volume.allocation|filesizeformat }}{{ volume.size|filesizeformat }}{{ volume.type }} + + + {% ifnotequal volume.type "iso" %} + + {% else %} + + {% endifnotequal %} + +
    {% csrf_token %} + + +
    +
    +
    + {% else %} +
    +
    + + {% trans "Warning" %}: {% trans "Hypervisor doesn't have any Volumes" %} +
    +
    + {% endif %} + {% endif %} +
    +
    + {% include 'pleasewaitdialog.html' %} {% endblock %} {% block script %} From e47f97facf81b7bbae4314a0fe8da9d2fe079a47 Mon Sep 17 00:00:00 2001 From: catborise Date: Tue, 27 Aug 2019 17:18:33 +0300 Subject: [PATCH 03/12] instance: seperate resize operations as cpu, mem and disk --- instances/templates/instance.html | 67 +++++++++++++++++++++++++------ instances/views.py | 63 +++++++++++++++++++++++++++++ vrtManager/instance.py | 53 +++++++++++++++++++++++- 3 files changed, 169 insertions(+), 14 deletions(-) diff --git a/instances/templates/instance.html b/instances/templates/instance.html index 3391569..ece29d4 100644 --- a/instances/templates/instance.html +++ b/instances/templates/instance.html @@ -341,17 +341,27 @@
    - - - + + +
    -
    +
    {% if request.user.is_superuser or request.user.is_staff or userinstance.is_change %}
    {% csrf_token %}

    {% trans "Logical host CPUs" %} : {{ vcpu_host }}

    @@ -379,6 +389,22 @@
    + + {% ifequal status 5 %} + + {% else %} + + {% endifequal %} + + {% else %} + {% trans "You don't have permission for resizing instance" %} + + {% endif %} +
    +
    +
    + {% if request.user.is_superuser or request.user.is_staff or userinstance.is_change %} +
    {% csrf_token %}

    {% trans "Total host memory:" %} {{ memory_host|filesizeformat }}

    @@ -406,6 +432,21 @@ {% trans "Custom value" %}
    + {% ifequal status 5 %} + + {% else %} + + {% endifequal %} + + {% else %} + {% trans "You don't have permission for resizing instance" %} + + {% endif %} +
    +
    +
    + {% if request.user.is_superuser or request.user.is_staff or userinstance.is_change %} +
    {% csrf_token %}

    {% trans "Disk allocation (B):" %}

    {% for disk in disks %}
    @@ -416,9 +457,9 @@
    {% endfor %} {% ifequal status 5 %} - + {% else %} - + {% endifequal %}
    {% else %} @@ -1867,7 +1908,7 @@ } }); } - if (~$.inArray(hash, ['#resize'])) { + if (~$.inArray(hash, ['#resize', "resizevm_cpu", "resizevm_mem", "resizevm_disk"])) { var btnsect = $('#navbtn>li>a'); $(btnsect).each(function () { if ($(this).attr('href') === '#resize') { diff --git a/instances/views.py b/instances/views.py index b0ecaba..5f8c55a 100644 --- a/instances/views.py +++ b/instances/views.py @@ -460,6 +460,69 @@ def instance(request, compute_id, vname): addlogmsg(request.user.username, instance.name, msg) return HttpResponseRedirect(request.get_full_path() + '#resize') + if 'resizevm_cpu' in request.POST and ( + request.user.is_superuser or request.user.is_staff or userinstance.is_change): + new_vcpu = request.POST.get('vcpu', '') + new_cur_vcpu = request.POST.get('cur_vcpu', '') + + quota_msg = check_user_quota(0, int(new_vcpu) - vcpu, 0, 0) + if not request.user.is_superuser and quota_msg: + msg = _("User %s quota reached, cannot resize CPU of '%s'!" % (quota_msg, instance.name)) + error_messages.append(msg) + else: + cur_vcpu = new_cur_vcpu + vcpu = new_vcpu + conn.resize_cpu(cur_vcpu, vcpu) + msg = _("Resize CPU") + addlogmsg(request.user.username, instance.name, msg) + return HttpResponseRedirect(request.get_full_path() + '#resize') + + if 'resizevm_mem' in request.POST and ( + request.user.is_superuser or request.user.is_staff or userinstance.is_change): + new_memory = request.POST.get('memory', '') + new_memory_custom = request.POST.get('memory_custom', '') + if new_memory_custom: + new_memory = new_memory_custom + new_cur_memory = request.POST.get('cur_memory', '') + new_cur_memory_custom = request.POST.get('cur_memory_custom', '') + if new_cur_memory_custom: + new_cur_memory = new_cur_memory_custom + quota_msg = check_user_quota(0, 0, int(new_memory) - memory, 0) + if not request.user.is_superuser and quota_msg: + msg = _("User %s quota reached, cannot resize memory of '%s'!" % (quota_msg, instance.name)) + error_messages.append(msg) + else: + cur_memory = new_cur_memory + memory = new_memory + conn.resize_mem(cur_memory, memory) + msg = _("Resize Memory") + addlogmsg(request.user.username, instance.name, msg) + return HttpResponseRedirect(request.get_full_path() + '#resize') + + if 'resizevm_disk' in request.POST and ( + request.user.is_superuser or request.user.is_staff or userinstance.is_change): + disks_new = [] + for disk in disks: + input_disk_size = filesizefstr(request.POST.get('disk_size_' + disk['dev'], '')) + if input_disk_size > disk['size'] + (64 << 20): + disk['size_new'] = input_disk_size + disks_new.append(disk) + disk_sum = sum([disk['size'] >> 30 for disk in disks_new]) + disk_new_sum = sum([disk['size_new'] >> 30 for disk in disks_new]) + quota_msg = check_user_quota(0, 0, 0, disk_new_sum - disk_sum) + if not request.user.is_superuser and quota_msg: + msg = _("User %s quota reached, cannot resize disks of '%s'!" % (quota_msg, instance.name)) + error_messages.append(msg) + else: + cur_memory = new_cur_memory + memory = new_memory + cur_vcpu = new_cur_vcpu + vcpu = new_vcpu + conn.resize(cur_memory, memory, cur_vcpu, vcpu, disks_new) + msg = _("Resize") + addlogmsg(request.user.username, instance.name, msg) + return HttpResponseRedirect(request.get_full_path() + '#resize') + if 'add_new_vol' in request.POST and allow_admin_or_not_template: connCreate = wvmCreate(compute.hostname, compute.login, diff --git a/vrtManager/instance.py b/vrtManager/instance.py index b8f29f8..3286f9d 100644 --- a/vrtManager/instance.py +++ b/vrtManager/instance.py @@ -741,7 +741,6 @@ class wvmInstance(wvmConnect): """ Function change ram and cpu on vds. """ - memory = int(memory) * 1024 cur_memory = int(cur_memory) * 1024 # if dom is running change only ram @@ -769,6 +768,58 @@ class wvmInstance(wvmConnect): new_xml = ElementTree.tostring(tree) self._defineXML(new_xml) + def resize_cpu(self, cur_vcpu, vcpu): + """ + Function change ram and cpu on vds. + """ + xml = self._XMLDesc(VIR_DOMAIN_XML_SECURE) + tree = ElementTree.fromstring(xml) + + set_vcpu = tree.find('vcpu') + set_vcpu.text = vcpu + set_vcpu.set('current', cur_vcpu) + + new_xml = ElementTree.tostring(tree) + self._defineXML(new_xml) + + def resize_mem(self, cur_memory, memory): + """ + Function change ram and cpu on vds. + """ + memory = int(memory) * 1024 + cur_memory = int(cur_memory) * 1024 + # if dom is running change only ram + if self.get_status() == VIR_DOMAIN_RUNNING: + self.set_memory(cur_memory, VIR_DOMAIN_AFFECT_LIVE) + self.set_memory(cur_memory, VIR_DOMAIN_AFFECT_CONFIG) + return + + xml = self._XMLDesc(VIR_DOMAIN_XML_SECURE) + tree = ElementTree.fromstring(xml) + + set_mem = tree.find('memory') + set_mem.text = str(memory) + set_cur_mem = tree.find('currentMemory') + set_cur_mem.text = str(cur_memory) + + new_xml = ElementTree.tostring(tree) + self._defineXML(new_xml) + + def resize_disk(self, disks=[]): + """ + Function change disks on vds. + """ + xml = self._XMLDesc(VIR_DOMAIN_XML_SECURE) + tree = ElementTree.fromstring(xml) + + for disk in disks: + source_dev = disk['path'] + vol = self.get_volume_by_path(source_dev) + vol.resize(disk['size_new']) + + new_xml = ElementTree.tostring(tree) + self._defineXML(new_xml) + def get_iso_media(self): iso = [] storages = self.get_storages(only_actives=True) From 1e22547b1aee6679fe07a167eaed16f20f37ad18 Mon Sep 17 00:00:00 2001 From: catborise Date: Mon, 9 Sep 2019 16:53:52 +0300 Subject: [PATCH 04/12] IPy.py update to 1.0 --- vrtManager/IPy.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/vrtManager/IPy.py b/vrtManager/IPy.py index 1dba7b2..6dbdf6b 100644 --- a/vrtManager/IPy.py +++ b/vrtManager/IPy.py @@ -6,7 +6,7 @@ Further Information might be available at: https://github.com/haypo/python-ipy """ -__version__ = '0.83' +__version__ = '1.00' import bisect import collections @@ -21,7 +21,7 @@ IPv4ranges = { '00000000': 'PRIVATE', # 0/8 '00001010': 'PRIVATE', # 10/8 '0110010001': 'CARRIER_GRADE_NAT', # 100.64/10 - '01111111': 'PRIVATE', # 127.0/8 + '01111111': 'LOOPBACK', # 127.0/8 '1': 'PUBLIC', # fall back '1010100111111110': 'PRIVATE', # 169.254/16 '101011000001': 'PRIVATE', # 172.16/12 @@ -243,7 +243,7 @@ class IPint(object): else: raise ValueError("can't parse") - (self.ip, parsedVersion) = parseAddress(ip) + (self.ip, parsedVersion) = parseAddress(ip, ipversion) if ipversion == 0: ipversion = parsedVersion if prefixlen == -1: @@ -473,7 +473,7 @@ class IPint(object): """Return a description of the IP type ('PRIVATE', 'RESERVED', etc). >>> print(IP('127.0.0.1').iptype()) - PRIVATE + LOOPBACK >>> print(IP('192.168.1.1').iptype()) PRIVATE >>> print(IP('195.185.1.2').iptype()) @@ -553,6 +553,9 @@ class IPint(object): """ return True + def __bool__(self): + return self.__nonzero__() + def __len__(self): """ Return the length of a subnet. @@ -757,6 +760,9 @@ class IPint(object): def __lt__(self, other): return self.__cmp__(other) < 0 + def __le__(self, other): + return self.__cmp__(other) <= 0 + def __hash__(self): """Called for the key object for dictionary operations, and by the built-in function hash(). Should return a 32-bit integer @@ -1328,7 +1334,7 @@ def _parseAddressIPv6(ipstr): return value -def parseAddress(ipstr): +def parseAddress(ipstr, ipversion=0): """ Parse a string and return the corresponding IP address (as integer) and a guess of the IP version. @@ -1397,7 +1403,7 @@ def parseAddress(ipstr): # assume IPv6 in pure hexadecimal notation return (hexval, 6) - elif ipstr.find('.') != -1 or (intval is not None and intval < 256): + elif ipstr.find('.') != -1 or (intval is not None and intval < 256 and ipversion != 6): # assume IPv4 ('127' gets interpreted as '127.0.0.0') bytes = ipstr.split('.') if len(bytes) > 4: @@ -1415,7 +1421,7 @@ def parseAddress(ipstr): # will be interpreted as IPv4 first byte if intval > MAX_IPV6_ADDRESS: raise ValueError("IP Address can't be larger than %x: %x" % (MAX_IPV6_ADDRESS, intval)) - if intval <= MAX_IPV4_ADDRESS: + if intval <= MAX_IPV4_ADDRESS and ipversion != 6: return (intval, 4) else: return (intval, 6) From fdbb6739c17e9f7f75e21c57a8eb0060742f7403 Mon Sep 17 00:00:00 2001 From: catborise Date: Tue, 10 Sep 2019 09:45:49 +0300 Subject: [PATCH 05/12] instances/view.py: Fix resize_disk and pep8 style corrections --- instances/views.py | 77 ++++++++++++++++++++++------------------------ 1 file changed, 37 insertions(+), 40 deletions(-) diff --git a/instances/views.py b/instances/views.py index 5f8c55a..808a273 100644 --- a/instances/views.py +++ b/instances/views.py @@ -27,6 +27,7 @@ from logs.views import addlogmsg from django.conf import settings from django.contrib import messages + @login_required def index(request): """ @@ -514,20 +515,16 @@ def instance(request, compute_id, vname): msg = _("User %s quota reached, cannot resize disks of '%s'!" % (quota_msg, instance.name)) error_messages.append(msg) else: - cur_memory = new_cur_memory - memory = new_memory - cur_vcpu = new_cur_vcpu - vcpu = new_vcpu - conn.resize(cur_memory, memory, cur_vcpu, vcpu, disks_new) + conn.resize_disk(disks_new) msg = _("Resize") addlogmsg(request.user.username, instance.name, msg) return HttpResponseRedirect(request.get_full_path() + '#resize') if 'add_new_vol' in request.POST and allow_admin_or_not_template: - connCreate = wvmCreate(compute.hostname, - compute.login, - compute.password, - compute.type) + conn_create = wvmCreate(compute.hostname, + compute.login, + compute.password, + compute.type) storage = request.POST.get('storage', '') name = request.POST.get('name', '') format = request.POST.get('format', default_format) @@ -537,7 +534,7 @@ def instance(request, compute_id, vname): cache = request.POST.get('cache', default_cache) target = get_new_disk_dev(media, disks, bus) - path = connCreate.create_volume(storage, name, size, format, meta_prealloc, default_owner) + path = conn_create.create_volume(storage, name, size, format, meta_prealloc, default_owner) conn.attach_disk(path, target, subdriver=format, cache=cache, targetbus=bus) msg = _('Attach new disk {} ({})'.format(name, format)) addlogmsg(request.user.username, instance.name, msg) @@ -549,16 +546,16 @@ def instance(request, compute_id, vname): bus = request.POST.get('bus', default_bus) cache = request.POST.get('cache', default_cache) - connCreate = wvmStorage(compute.hostname, - compute.login, - compute.password, - compute.type, - storage) + conn_create = wvmStorage(compute.hostname, + compute.login, + compute.password, + compute.type, + storage) - format = connCreate.get_volume_type(name) - path = connCreate.get_target_path() + format = conn_create.get_volume_type(name) + path = conn_create.get_target_path() target = get_new_disk_dev(media, disks, bus) - source = path + "/" + name; + source = path + "/" + name conn.attach_disk(source, target, subdriver=format, cache=cache, targetbus=bus) msg = _('Attach Existing disk: ' + target) @@ -567,17 +564,17 @@ def instance(request, compute_id, vname): if 'delete_vol' in request.POST and allow_admin_or_not_template: storage = request.POST.get('storage', '') - connDelete = wvmStorage(compute.hostname, - compute.login, - compute.password, - compute.type, - storage) + conn_delete = wvmStorage(compute.hostname, + compute.login, + compute.password, + compute.type, + storage) dev = request.POST.get('dev', '') path = request.POST.get('path', '') name = request.POST.get('name', '') conn.detach_disk(dev) - connDelete.del_volume(name) + conn_delete.del_volume(name) msg = _('Delete disk: ' + dev) addlogmsg(request.user.username, instance.name, msg) @@ -688,8 +685,8 @@ def instance(request, compute_id, vname): if bootorder: order_list = {} for idx, val in enumerate(bootorder.split(',')): - type, dev = val.split(':', 1) - order_list[idx] = {"type": type, "dev": dev} + dev_type, dev = val.split(':', 1) + order_list[idx] = {"type": dev_type, "dev": dev} conn.set_bootorder(order_list) msg = _("Set boot order") @@ -859,7 +856,7 @@ def instance(request, compute_id, vname): elif not re.match(r'^[a-zA-Z0-9-]+$', clone_data['name']): msg = _("Instance name '%s' contains invalid characters!" % clone_data['name']) error_messages.append(msg) - elif not re.match(r'^([0-9A-F]{2})(\:?[0-9A-F]{2}){5}$', clone_data['clone-net-mac-0'], + elif not re.match(r'^([0-9A-F]{2})(:?[0-9A-F]{2}){5}$', clone_data['clone-net-mac-0'], re.IGNORECASE): msg = _("Instance mac '%s' invalid format!" % clone_data['clone-net-mac-0']) error_messages.append(msg) @@ -967,17 +964,17 @@ def get_host_instances(request, comp): inst_on_db.save() all_host_vms[comp["id"], - comp["name"], - comp["status"], - comp["cpu"], - comp["mem_size"], - comp["mem_perc"]][inst_name]['is_template'] = inst_on_db.is_template + comp["name"], + comp["status"], + comp["cpu"], + comp["mem_size"], + comp["mem_perc"]][inst_name]['is_template'] = inst_on_db.is_template all_host_vms[comp["id"], - comp["name"], - comp["status"], - comp["cpu"], - comp["mem_size"], - comp["mem_perc"]][inst_name]['userinstances'] = get_userinstances_info(inst_on_db) + comp["name"], + comp["status"], + comp["cpu"], + comp["mem_size"], + comp["mem_perc"]][inst_name]['userinstances'] = get_userinstances_info(inst_on_db) except Instance.DoesNotExist: inst_on_db = Instance(compute_id=comp["id"], name=inst_name, uuid=info['uuid']) inst_on_db.save() @@ -1052,7 +1049,7 @@ def instances_actions(request): return HttpResponseRedirect(request.get_full_path()) if 'powerforce' in request.POST: - conn.force_shutdown() + conn.force_shutdown(name) msg = _("Force Off") addlogmsg(request.user.username, instance.name, msg) return HttpResponseRedirect(request.get_full_path()) @@ -1243,7 +1240,7 @@ def _get_clone_disks(disks, vname=''): def sshkeys(request, vname): """ :param request: - :param vm: + :param vname: :return: """ @@ -1282,7 +1279,7 @@ def delete_instance(instance, delete_disk=False): print("Forcing shutdown") conn.force_shutdown() if delete_disk: - snapshots = sorted(conn.get_snapshot(), reverse=True, key=lambda k:k['date']) + snapshots = sorted(conn.get_snapshot(), reverse=True, key=lambda k: k['date']) for snap in snapshots: print("Deleting snapshot {}".format(snap['name'])) conn.snapshot_delete(snap['name']) From 828a27178945097a01692391bba24df9a9533b03 Mon Sep 17 00:00:00 2001 From: catborise Date: Tue, 10 Sep 2019 09:48:31 +0300 Subject: [PATCH 06/12] pep8 style code corrections --- accounts/views.py | 4 ++-- computes/views.py | 10 +++++----- console/novncd | 2 +- console/views.py | 2 -- create/views.py | 5 +++-- datasource/views.py | 6 +++--- interfaces/views.py | 2 ++ logs/views.py | 10 +++++++--- networks/views.py | 9 ++++++--- storages/views.py | 6 +++++- vrtManager/connection.py | 2 +- vrtManager/create.py | 8 +------- vrtManager/hostdetails.py | 14 +++++++------- vrtManager/instance.py | 29 +++++++++++++---------------- vrtManager/network.py | 9 +++++---- vrtManager/nwfilters.py | 2 +- vrtManager/secrets.py | 6 +++--- vrtManager/util.py | 7 ++++--- 18 files changed, 69 insertions(+), 64 deletions(-) diff --git a/accounts/views.py b/accounts/views.py index 494bdd6..61a26ef 100644 --- a/accounts/views.py +++ b/accounts/views.py @@ -2,7 +2,6 @@ from django.shortcuts import render from django.http import HttpResponseRedirect from django.core.urlresolvers import reverse from django.utils.translation import ugettext_lazy as _ -from django.contrib.auth.models import User from django.contrib.auth.decorators import login_required from accounts.models import * from instances.models import Instance @@ -11,7 +10,6 @@ from django.conf import settings from django.core.validators import ValidationError - @login_required def profile(request): """ @@ -70,6 +68,7 @@ def profile(request): return HttpResponseRedirect(request.get_full_path()) return render(request, 'profile.html', locals()) + @login_required def accounts(request): """ @@ -154,6 +153,7 @@ def accounts(request): def account(request, user_id): """ :param request: + :param user_id: :return: """ diff --git a/computes/views.py b/computes/views.py index 1253541..80c0693 100644 --- a/computes/views.py +++ b/computes/views.py @@ -1,4 +1,3 @@ -import time import json from django.utils import timezone from django.http import HttpResponse, HttpResponseRedirect @@ -140,6 +139,7 @@ def computes(request): def overview(request, compute_id): """ :param request: + :param compute_id: :return: """ @@ -171,6 +171,7 @@ def overview(request, compute_id): def compute_graph(request, compute_id): """ :param request: + :param compute_id: :return: """ compute = get_object_or_404(Compute, pk=compute_id) @@ -207,17 +208,16 @@ def get_compute_disk_buses(request, compute_id, disk): compute.type) disk_device_types = conn.get_disk_device_types() - disk_bus_types = conn.get_disk_bus_types() if disk in disk_device_types: if disk == 'disk': data['bus'] = sorted(disk_device_types) elif disk == 'cdrom': - data['bus'] = ['ide', 'sata', 'scsi',] + data['bus'] = ['ide', 'sata', 'scsi'] elif disk == 'floppy': - data['bus'] = ['fdc',] + data['bus'] = ['fdc'] elif disk == 'lun': - data['bus'] = ['scsi',] + data['bus'] = ['scsi'] except libvirtError: pass diff --git a/console/novncd b/console/novncd index e017898..e49fee9 100755 --- a/console/novncd +++ b/console/novncd @@ -120,7 +120,7 @@ def get_connection_infos(token): console_host = conn.get_console_listen_addr() console_port = conn.get_console_port() console_socket = conn.get_console_socket() - except Exception, e: + except Exception as e: logging.error('Fail to retrieve console connection infos for token %s : %s' % (token, e)) raise return (connhost, connport, connuser, conntype, console_host, diff --git a/console/views.py b/console/views.py index 4196ff0..9dfe54e 100644 --- a/console/views.py +++ b/console/views.py @@ -1,7 +1,5 @@ import re from django.shortcuts import render -from django.http import HttpResponseRedirect -from django.core.urlresolvers import reverse from django.contrib.auth.decorators import login_required from instances.models import Instance from vrtManager.instance import wvmInstance diff --git a/create/views.py b/create/views.py index 9bd881a..f758bd1 100644 --- a/create/views.py +++ b/create/views.py @@ -21,6 +21,7 @@ from logs.views import addlogmsg def create_instance(request, compute_id): """ :param request: + :param compute_id: :return: """ @@ -109,7 +110,7 @@ def create_instance(request, compute_id): msg = _("A virtual machine with this name already exists") error_messages.append(msg) if Instance.objects.filter(name__exact=data['name']): - messages.warning(request,_("There is an instance with same name. Are you sure?")) + messages.warning(request, _("There is an instance with same name. Are you sure?")) if not error_messages: if data['hdd_size']: if not data['mac']: @@ -175,7 +176,7 @@ def create_instance(request, compute_id): addlogmsg(request.user.username, create_instance.name, msg) return HttpResponseRedirect(reverse('instance', args=[compute_id, data['name']])) except libvirtError as lib_err: - if data['hdd_size'] or volume_list.count() > 0: + if data['hdd_size'] or len(volume_list) > 0: for vol in volume_list: conn.delete_volume(vol['path']) error_messages.append(lib_err) diff --git a/datasource/views.py b/datasource/views.py index 163ecb5..a3d3521 100644 --- a/datasource/views.py +++ b/datasource/views.py @@ -26,7 +26,7 @@ def os_metadata_json(request, version): if version == 'latest': ip = get_client_ip(request) hostname = get_hostname_by_ip(ip) - response = { 'uuid': OS_UUID, 'hostname': hostname } + response = {'uuid': OS_UUID, 'hostname': hostname} return HttpResponse(json.dumps(response)) else: err = 'Invalid version: {}'.format(version) @@ -70,8 +70,8 @@ def get_client_ip(request): def get_hostname_by_ip(ip): try: addrs = socket.gethostbyaddr(ip) - except Exception: - addrs = [ip,] + except: + addrs = [ip] return addrs[0] diff --git a/interfaces/views.py b/interfaces/views.py index 921d0b8..f71289c 100644 --- a/interfaces/views.py +++ b/interfaces/views.py @@ -12,6 +12,7 @@ from libvirt import libvirtError def interfaces(request, compute_id): """ :param request: + :param compute_id: :return: """ @@ -60,6 +61,7 @@ def interfaces(request, compute_id): def interface(request, compute_id, iface): """ :param request: + :param iface: :return: """ diff --git a/logs/views.py b/logs/views.py index ab6ae1b..6b19f97 100644 --- a/logs/views.py +++ b/logs/views.py @@ -10,7 +10,9 @@ import json def addlogmsg(user, instance, message): """ - :param request: + :param user: + :param instance: + :param message: :return: """ add_log_msg = Logs(user=user, instance=instance, message=message) @@ -21,6 +23,7 @@ def addlogmsg(user, instance, message): def showlogs(request, page=1): """ :param request: + :param page: :return: """ @@ -36,11 +39,12 @@ def showlogs(request, page=1): return render(request, 'showlogs.html', locals()) + @login_required def vm_logs(request, vname): """ :param request: - :param vm: + :param vname: :return: """ @@ -51,7 +55,7 @@ def vm_logs(request, vname): logs_ = Logs.objects.filter(instance=vm.name, date__gte=vm.created).order_by('-date') logs = [] for l in logs_: - log = {} + log = dict() log['user'] = l.user log['instance'] = l.instance log['message'] = l.message diff --git a/networks/views.py b/networks/views.py index 29fb802..abd06b0 100644 --- a/networks/views.py +++ b/networks/views.py @@ -15,6 +15,7 @@ from django.contrib import messages def networks(request, compute_id): """ :param request: + :param compute_id: :return: """ @@ -64,6 +65,8 @@ def networks(request, compute_id): def network(request, compute_id, pool): """ :param request: + :param compute_id: + :param pool: :return: """ @@ -154,9 +157,9 @@ def network(request, compute_id, pool): if edit_xml: try: new_conn = wvmNetworks(compute.hostname, - compute.login, - compute.password, - compute.type) + compute.login, + compute.password, + compute.type) conn.define_network(edit_xml) if conn.is_active(): messages.success(request, _("Network XML is changed. Stop and start network to activate new config.")) diff --git a/storages/views.py b/storages/views.py index d128de2..b5708de 100644 --- a/storages/views.py +++ b/storages/views.py @@ -10,10 +10,12 @@ from libvirt import libvirtError from django.contrib import messages import json + @login_required def storages(request, compute_id): """ :param request: + :param compute_id: :return: """ @@ -72,6 +74,8 @@ def storages(request, compute_id): def storage(request, compute_id, pool): """ :param request: + :param compute_id: + :param pool: :return: """ @@ -225,4 +229,4 @@ def get_volumes(request, compute_id, pool): except libvirtError: pass data['vols'] = sorted(conn.get_volumes()) - return HttpResponse(json.dumps(data)) \ No newline at end of file + return HttpResponse(json.dumps(data)) diff --git a/vrtManager/connection.py b/vrtManager/connection.py index b918d82..278232c 100644 --- a/vrtManager/connection.py +++ b/vrtManager/connection.py @@ -2,7 +2,7 @@ import libvirt import threading import socket from vrtManager import util -from rwlock import ReadWriteLock +from vrtManager.rwlock import ReadWriteLock from django.conf import settings from libvirt import libvirtError diff --git a/vrtManager/create.py b/vrtManager/create.py index 536de7a..5b60dee 100644 --- a/vrtManager/create.py +++ b/vrtManager/create.py @@ -2,7 +2,6 @@ import string from vrtManager import util from vrtManager.connection import wvmConnect from webvirtcloud.settings import QEMU_CONSOLE_DEFAULT_TYPE -from webvirtcloud.settings import QEMU_CONSOLE_LISTEN_ADDRESSES from webvirtcloud.settings import INSTANCE_VOLUME_DEFAULT_OWNER as default_owner from webvirtcloud.settings import INSTANCE_VOLUME_DEFAULT_FORMAT @@ -107,7 +106,7 @@ class wvmCreate(wvmConnect): if not pool: storages = self.get_storages(only_actives=True) else: - storages = [pool,] + storages = [pool] for storage in storages: stg = self.get_storage(storage) if stg.info()[0] != 0: @@ -204,7 +203,6 @@ class wvmCreate(wvmConnect): hd_disk_letters = list(string.lowercase) sd_disk_letters = list(string.lowercase) add_cd = True - #for image, img_type in images.items(): for volume in images: stg = self.get_storage_by_vol_path(volume['path']) stg_type = util.get_xml_path(stg.XMLDesc(0), "/pool/@type") @@ -283,8 +281,4 @@ class wvmCreate(wvmConnect): """ % video - - - - self._defineXML(xml) diff --git a/vrtManager/hostdetails.py b/vrtManager/hostdetails.py index 8db70f2..6a036e1 100644 --- a/vrtManager/hostdetails.py +++ b/vrtManager/hostdetails.py @@ -58,13 +58,13 @@ class wvmHostDetails(wvmConnect): """ Function return host server information: hostname, cpu, memory, ... """ - info = [] - info.append(self.wvm.getHostname()) # hostname - info.append(self.wvm.getInfo()[0]) # architecture - info.append(self.wvm.getInfo()[1] * 1048576) # memory - info.append(self.wvm.getInfo()[2]) # cpu core count - info.append(get_xml_path(self.wvm.getSysinfo(0), func=cpu_version)) # cpu version - info.append(self.wvm.getURI()) #uri + info = list() + info.append(self.wvm.getHostname()) # hostname + info.append(self.wvm.getInfo()[0]) # architecture + info.append(self.wvm.getInfo()[1] * 1048576) # memory + info.append(self.wvm.getInfo()[2]) # cpu core count + info.append(get_xml_path(self.wvm.getSysinfo(0), func=cpu_version)) # cpu version + info.append(self.wvm.getURI()) # uri return info diff --git a/vrtManager/instance.py b/vrtManager/instance.py index 3286f9d..c18e368 100644 --- a/vrtManager/instance.py +++ b/vrtManager/instance.py @@ -96,7 +96,7 @@ class wvmInstances(wvmConnect): if listen_addr is None: listen_addr = util.get_xml_path(inst.XMLDesc(0), "/domain/devices/graphics/listen/@address") if listen_addr is None: - return "None" + return "None" return listen_addr def graphics_port(self, name): @@ -237,9 +237,9 @@ class wvmInstance(wvmConnect): try: net = self.get_network(network_host) ip = get_mac_ipaddr(net, mac_host) - except libvirtError as e: + except libvirtError: ip = None - result.append({'mac': mac_host, 'nic': network_host, 'target': target_host,'ip': ip, 'filterref': filterref_host}) + result.append({'mac': mac_host, 'nic': network_host, 'target': target_host, 'ip': ip, 'filterref': filterref_host}) return result return util.get_xml_path(self._XMLDesc(0), func=networks) @@ -322,7 +322,7 @@ class wvmInstance(wvmConnect): os = tree.find('os') menu = os.find("bootmenu") - if menu == None: + if menu is None: bootmenu = ElementTree.fromstring("") os.append(bootmenu) menu = os.find("bootmenu") @@ -365,7 +365,7 @@ class wvmInstance(wvmConnect): for dev in devices: dev_target = dev_type = dev_device = dev_alias = None boot_dev = dev.find('boot') - if boot_dev != None: + if boot_dev is not None: idx = boot_dev.get('order') dev_type = dev.get('type') dev_device = dev.get('device') @@ -398,7 +398,7 @@ class wvmInstance(wvmConnect): # Remove rest of them for dev in tree.find('devices'): boot_dev = dev.find('boot') - if boot_dev != None: + if boot_dev is not None: dev.remove(boot_dev) return tree @@ -410,19 +410,19 @@ class wvmInstance(wvmConnect): devices = tree.findall("./devices/disk[@device='disk']") for d in devices: device = d.find("./target[@dev='{}']".format(dev['dev'])) - if device != None: + if device is not None: d.append(order) elif dev['type'] == 'cdrom': devices = tree.findall("./devices/disk[@device='cdrom']") for d in devices: device = d.find("./target[@dev='{}']".format(dev['dev'])) - if device != None: + if device is not None: d.append(order) elif dev['type'] == 'network': devices = tree.findall("./devices/interface[@type='network']") for d in devices: device = d.find("mac[@address='{}']".format(dev['dev'])) - if device != None: + if device is not None: d.append(order) else: raise Exception('Invalid Device Type for boot order') @@ -478,7 +478,6 @@ class wvmInstance(wvmConnect): self._defineXML(xmldom) def attach_disk(self, source, target, sourcetype='file', device='disk', driver='qemu', subdriver='raw', cache='none', targetbus='ide'): - tree = ElementTree.fromstring(self._XMLDesc(0)) xml_disk = "" % (sourcetype, device) if device == 'cdrom': xml_disk += "" % (driver, subdriver) @@ -622,7 +621,7 @@ class wvmInstance(wvmConnect): if listen_addr is None: listen_addr = util.get_xml_path(self._XMLDesc(0), "/domain/devices/graphics/listen/@address") if listen_addr is None: - return "127.0.0.1" + return "127.0.0.1" return listen_addr def set_console_listen_addr(self, listen_addr): @@ -656,7 +655,7 @@ class wvmInstance(wvmConnect): return socket def get_console_type(self): - console_type = util.get_xml_path(self._XMLDesc(0),"/domain/devices/graphics/@type") + console_type = util.get_xml_path(self._XMLDesc(0), "/domain/devices/graphics/@type") return console_type def set_console_type(self, console_type): @@ -805,7 +804,7 @@ class wvmInstance(wvmConnect): new_xml = ElementTree.tostring(tree) self._defineXML(new_xml) - def resize_disk(self, disks=[]): + def resize_disk(self, disks): """ Function change disks on vds. """ @@ -1007,7 +1006,6 @@ class wvmInstance(wvmConnect): return bridge_name def add_network(self, mac_address, source, source_type='net', interface_type='bridge', model='virtio', nwfilter=None): - tree = ElementTree.fromstring(self._XMLDesc(0)) bridge_name = self.get_bridge_name(source, source_type) xml_interface = """ @@ -1029,7 +1027,6 @@ class wvmInstance(wvmConnect): def delete_network(self, mac_address): tree = ElementTree.fromstring(self._XMLDesc(0)) - devices = tree.find('devices') for interface in tree.findall('devices/interface'): source = interface.find('mac') if source.get('address', '') == mac_address: @@ -1089,7 +1086,7 @@ class wvmInstance(wvmConnect): option = tree.find(o) option_value = options.get(o, '').strip() if not option_value: - if not option is None: + if option is not None: tree.remove(option) else: if option is None: diff --git a/vrtManager/network.py b/vrtManager/network.py index d3c67f3..971cc66 100644 --- a/vrtManager/network.py +++ b/vrtManager/network.py @@ -22,6 +22,7 @@ def network_size(net, dhcp=None): class wvmNetworks(wvmConnect): + def get_networks_info(self): get_networks = self.get_networks() networks = [] @@ -166,7 +167,7 @@ class wvmNetwork(wvmConnect): return dhcp[1] def can_pxe(self): - xml = self.get_xml() + xml = self._XMLDesc(0) forward = self.get_ipv4_forward()[0] if forward and forward != "nat": return True @@ -204,14 +205,14 @@ class wvmNetwork(wvmConnect): break if host is None: self.update(VIR_NETWORK_UPDATE_COMMAND_ADD_LAST, VIR_NETWORK_SECTION_IP_DHCP_HOST, -1, new_xml, - VIR_NETWORK_UPDATE_AFFECT_LIVE|VIR_NETWORK_UPDATE_AFFECT_CONFIG) + VIR_NETWORK_UPDATE_AFFECT_LIVE | VIR_NETWORK_UPDATE_AFFECT_CONFIG) else: # change the host if host.get('name') == new_host_xml.get('name') and host.get('ip') == new_host_xml.get('ip'): return False else: self.update(VIR_NETWORK_UPDATE_COMMAND_MODIFY, VIR_NETWORK_SECTION_IP_DHCP_HOST, -1, new_xml, - VIR_NETWORK_UPDATE_AFFECT_LIVE|VIR_NETWORK_UPDATE_AFFECT_CONFIG) + VIR_NETWORK_UPDATE_AFFECT_LIVE | VIR_NETWORK_UPDATE_AFFECT_CONFIG) def delete_fixed_address(self, mac): util.validate_macaddr(mac) @@ -222,7 +223,7 @@ class wvmNetwork(wvmConnect): if h.get('mac') == mac: new_xml = ''.format(mac, h.get('name'), h.get('ip')) self.update(VIR_NETWORK_UPDATE_COMMAND_DELETE, VIR_NETWORK_SECTION_IP_DHCP_HOST, -1, new_xml, - VIR_NETWORK_UPDATE_AFFECT_LIVE|VIR_NETWORK_UPDATE_AFFECT_CONFIG) + VIR_NETWORK_UPDATE_AFFECT_LIVE | VIR_NETWORK_UPDATE_AFFECT_CONFIG) break def modify_dhcp_range(self, range_start, range_end): diff --git a/vrtManager/nwfilters.py b/vrtManager/nwfilters.py index 58784b9..aeb7e4f 100644 --- a/vrtManager/nwfilters.py +++ b/vrtManager/nwfilters.py @@ -12,7 +12,7 @@ class wvmNWFilters(wvmConnect): def create_nwfilter(self, xml): self.wvm.nwfilterDefineXML(xml) - def clone_nwfilter(self,name, cln_name): + def clone_nwfilter(self, name, cln_name): nwfilter = self.get_nwfilter(name) if nwfilter: tree = ElementTree.fromstring(nwfilter.XMLDesc(0)) diff --git a/vrtManager/secrets.py b/vrtManager/secrets.py index b3b4aea..1f92850 100644 --- a/vrtManager/secrets.py +++ b/vrtManager/secrets.py @@ -7,11 +7,11 @@ class wvmSecrets(wvmConnect): xml = """ """ % (ephemeral, private, secret_type) if secret_type == 'ceph': - xml += """%s""" % (data) + xml += """%s""" % data if secret_type == 'volume': - xml += """%s""" % (data) + xml += """%s""" % data if secret_type == 'iscsi': - xml += """%s""" % (data) + xml += """%s""" % data xml += """ """ self.wvm.secretDefineXML(xml) diff --git a/vrtManager/util.py b/vrtManager/util.py index b4aa949..054e94f 100644 --- a/vrtManager/util.py +++ b/vrtManager/util.py @@ -110,7 +110,7 @@ def get_xpath(doc, path): if ret is not None: if type(ret) == list: if len(ret) >= 1: - if hasattr(ret[0],'text'): + if hasattr(ret[0], 'text'): result = ret[0].text else: result = ret[0] @@ -119,6 +119,7 @@ def get_xpath(doc, path): return result + def pretty_mem(val): val = int(val) if val > (10 * 1024 * 1024): @@ -146,8 +147,8 @@ def validate_uuid(val): if form is None: raise ValueError( "UUID must be a 32-digit hexadecimal number. It may take " - "the form xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx or may " - "omit hyphens altogether.") + "the form xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx or may " + "omit hyphens altogether.") else: # UUID had no dashes, so add them in val = (val[0:8] + "-" + val[8:12] + "-" + val[12:16] + From d22aed5ef7b9a37096ac9628cfee28d3ef92168a Mon Sep 17 00:00:00 2001 From: catborise Date: Tue, 10 Sep 2019 16:05:23 +0300 Subject: [PATCH 07/12] Rearrange host resources variables and change variable names --- .../templates/add_instance_network_block.html | 6 ++--- instances/templates/add_instance_volume.html | 2 +- instances/templates/instance.html | 6 ++--- instances/views.py | 27 +++++++++++-------- 4 files changed, 23 insertions(+), 18 deletions(-) diff --git a/instances/templates/add_instance_network_block.html b/instances/templates/add_instance_network_block.html index e7564c7..b55be35 100644 --- a/instances/templates/add_instance_network_block.html +++ b/instances/templates/add_instance_network_block.html @@ -24,10 +24,10 @@
    @@ -38,7 +38,7 @@
    diff --git a/instances/templates/add_instance_volume.html b/instances/templates/add_instance_volume.html index ba2f978..779ba20 100644 --- a/instances/templates/add_instance_volume.html +++ b/instances/templates/add_instance_volume.html @@ -28,7 +28,7 @@
    diff --git a/instances/templates/instance.html b/instances/templates/instance.html index ece29d4..99adbcf 100644 --- a/instances/templates/instance.html +++ b/instances/templates/instance.html @@ -873,10 +873,10 @@ @@ -887,7 +887,7 @@ diff --git a/instances/views.py b/instances/views.py index 808a273..61292a3 100644 --- a/instances/views.py +++ b/instances/views.py @@ -101,11 +101,12 @@ def instances(request, compute_id): def instance(request, compute_id, vname): """ :param request: + :param compute_id: + :param vname: :return: """ error_messages = [] - # messages = [] compute = get_object_or_404(Compute, pk=compute_id) computes = Compute.objects.all().order_by('name') computes_count = computes.count() @@ -258,9 +259,6 @@ def instance(request, compute_id, vname): compute.password, compute.type, vname) - compute_networks = sorted(conn.get_networks()) - compute_interfaces = sorted(conn.get_ifaces()) - compute_nwfilters = conn.get_nwfilters() status = conn.get_status() autostart = conn.get_autostart() bootmenu = conn.get_bootmenu() @@ -272,13 +270,13 @@ def instance(request, compute_id, vname): cur_memory = conn.get_cur_memory() title = conn.get_title() description = conn.get_description() + networks = conn.get_net_device() disks = conn.get_disk_devices() media = conn.get_media_devices() if len(media) != 0: media_iso = sorted(conn.get_iso_media()) else: media_iso = [] - networks = conn.get_net_device() vcpu_range = conn.get_max_cpus() memory_range = [256, 512, 768, 1024, 2048, 3072, 4096, 6144, 8192, 16384] @@ -286,8 +284,6 @@ def instance(request, compute_id, vname): insort(memory_range, memory) if cur_memory not in memory_range: insort(memory_range, cur_memory) - memory_host = conn.get_max_memory() - vcpu_host = len(vcpu_range) telnet_port = conn.get_telnet_port() console_type = conn.get_console_type() console_port = conn.get_console_port() @@ -299,18 +295,16 @@ def instance(request, compute_id, vname): console_passwd = conn.get_console_passwd() clone_free_names = get_clone_free_names() user_quota_msg = check_user_quota(0, 0, 0, 0) - storages = sorted(conn.get_storages()) cache_modes = sorted(conn.get_cache_modes().items()) default_cache = settings.INSTANCE_VOLUME_DEFAULT_CACHE default_format = settings.INSTANCE_VOLUME_DEFAULT_FORMAT default_owner = settings.INSTANCE_VOLUME_DEFAULT_OWNER formats = conn.get_image_formats() - busses = conn.get_disk_bus_types() - default_bus = settings.INSTANCE_VOLUME_DEFAULT_BUS show_access_root_password = settings.SHOW_ACCESS_ROOT_PASSWORD show_access_ssh_keys = settings.SHOW_ACCESS_SSH_KEYS clone_instance_auto_name = settings.CLONE_INSTANCE_AUTO_NAME + default_bus = settings.INSTANCE_VOLUME_DEFAULT_BUS try: instance = Instance.objects.get(compute_id=compute_id, name=vname) @@ -328,6 +322,15 @@ def instance(request, compute_id, vname): userinstances = UserInstance.objects.filter(instance=instance).order_by('user__username') allow_admin_or_not_template = request.user.is_superuser or request.user.is_staff or not instance.is_template + # Host resources + vcpu_host = len(vcpu_range) + memory_host = conn.get_max_memory() + bus_host = conn.get_disk_bus_types() + networks_host = sorted(conn.get_networks()) + interfaces_host = sorted(conn.get_ifaces()) + nwfilters_host = conn.get_nwfilters() + storages_host = sorted(conn.get_storages(True)) + if request.method == 'POST': if 'poweron' in request.POST: if instance.is_template: @@ -502,7 +505,7 @@ def instance(request, compute_id, vname): if 'resizevm_disk' in request.POST and ( request.user.is_superuser or request.user.is_staff or userinstance.is_change): - disks_new = [] + disks_new = list() for disk in disks: input_disk_size = filesizefstr(request.POST.get('disk_size_' + disk['dev'], '')) if input_disk_size > disk['size'] + (64 << 20): @@ -907,6 +910,8 @@ def instance(request, compute_id, vname): def inst_status(request, compute_id, vname): """ :param request: + :param compute_id: + :param vname: :return: """ From caf00bd4f9ac9b3686a587a9bd2744eaacc754bb Mon Sep 17 00:00:00 2001 From: catborise Date: Tue, 10 Sep 2019 16:06:30 +0300 Subject: [PATCH 08/12] create/views.py: rearrange variable order --- create/views.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/create/views.py b/create/views.py index f758bd1..d44ad26 100644 --- a/create/views.py +++ b/create/views.py @@ -42,9 +42,6 @@ def create_instance(request, compute_id): compute.password, compute.type) - storages = sorted(conn.get_storages(only_actives=True)) - networks = sorted(conn.get_networks()) - nwfilters = conn.get_nwfilters() instances = conn.get_instances() videos = conn.get_video() cache_modes = sorted(conn.get_cache_modes().items()) @@ -54,6 +51,9 @@ def create_instance(request, compute_id): disk_devices = conn.get_disk_device_types() disk_buses = conn.get_disk_bus_types() default_bus = INSTANCE_VOLUME_DEFAULT_BUS + networks = sorted(conn.get_networks()) + nwfilters = conn.get_nwfilters() + storages = sorted(conn.get_storages(only_actives=True)) except libvirtError as lib_err: error_messages.append(lib_err) @@ -149,7 +149,6 @@ def create_instance(request, compute_id): else: for idx, vol in enumerate(data['images'].split(',')): try: - path = conn.get_volume_path(vol) volume = dict() volume['path'] = path From 0fdc2dae3355497fd44fed3043defb3c63efa848 Mon Sep 17 00:00:00 2001 From: catborise Date: Wed, 11 Sep 2019 11:12:33 +0300 Subject: [PATCH 09/12] fix redirection for network connection error --- networks/views.py | 1 + 1 file changed, 1 insertion(+) diff --git a/networks/views.py b/networks/views.py index abd06b0..71a0b9a 100644 --- a/networks/views.py +++ b/networks/views.py @@ -94,6 +94,7 @@ def network(request, compute_id, pool): xml = conn._XMLDesc(0) except libvirtError as lib_err: error_messages.append(lib_err) + return HttpResponseRedirect(reverse('networks', args=compute_id)) if request.method == 'POST': if 'start' in request.POST: From 1e2fbc84531307d6754601c6ebbb08ba3035d6e1 Mon Sep 17 00:00:00 2001 From: catborise Date: Wed, 11 Sep 2019 11:51:20 +0300 Subject: [PATCH 10/12] add redirection for instance_actions error --- instances/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/instances/views.py b/instances/views.py index 61292a3..0ef489f 100644 --- a/instances/views.py +++ b/instances/views.py @@ -1098,7 +1098,7 @@ def instances_actions(request): addlogmsg(request.user.username, instance.name, msg) conn.resume(name) return HttpResponseRedirect(request.get_full_path()) - + return HttpResponseRedirect(request.get_full_path()) @login_required def inst_graph(request, compute_id, vname): From 1a8eb7c2c3739e5fbb425e4e094a77c9284e4c3b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 17 Oct 2019 19:09:48 +0000 Subject: [PATCH 11/12] Bump django from 1.11.21 to 1.11.23 in /conf Bumps [django](https://github.com/django/django) from 1.11.21 to 1.11.23. - [Release notes](https://github.com/django/django/releases) - [Commits](https://github.com/django/django/compare/1.11.21...1.11.23) Signed-off-by: dependabot[bot] --- conf/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/requirements.txt b/conf/requirements.txt index 05f2743..fd3071b 100644 --- a/conf/requirements.txt +++ b/conf/requirements.txt @@ -1,4 +1,4 @@ -Django==1.11.21 +Django==1.11.23 websockify==0.8.0 gunicorn==19.9.0 lxml==4.2.5 From a0324ac60eee9218962d26f3c51d9e391192a4ab Mon Sep 17 00:00:00 2001 From: catborise Date: Thu, 24 Oct 2019 13:26:58 +0300 Subject: [PATCH 12/12] Capitalized iso suffixs not seen by cdrom. Make them case insensitive. --- vrtManager/create.py | 2 +- vrtManager/instance.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/vrtManager/create.py b/vrtManager/create.py index 5b60dee..671de97 100644 --- a/vrtManager/create.py +++ b/vrtManager/create.py @@ -38,7 +38,7 @@ class wvmCreate(wvmConnect): except: pass for img in stg.listVolumes(): - if img.endswith('.iso'): + if img.lower().endswith('.iso'): pass else: images.append(img) diff --git a/vrtManager/instance.py b/vrtManager/instance.py index c18e368..6c1cfec 100644 --- a/vrtManager/instance.py +++ b/vrtManager/instance.py @@ -830,7 +830,7 @@ class wvmInstance(wvmConnect): except: pass for img in stg.listVolumes(): - if img.endswith('.iso'): + if img.lower().endswith('.iso'): iso.append(img) return iso