mirror of
https://github.com/retspen/webvirtcloud
synced 2024-12-25 15:45:23 +00:00
Added VM DRBD Status to appsettings
This commit is contained in:
parent
af5acc8c24
commit
421f17d5ca
4 changed files with 42 additions and 2 deletions
29
appsettings/migrations/0007_auto_20220629_1213.py
Normal file
29
appsettings/migrations/0007_auto_20220629_1213.py
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
# Generated by Django 3.2.12 on 2022-06-29 12:13
|
||||||
|
|
||||||
|
from django.db import migrations
|
||||||
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
|
||||||
|
|
||||||
|
def add_default_settings(apps, schema_editor):
|
||||||
|
setting = apps.get_model("appsettings", "AppSettings")
|
||||||
|
db_alias = schema_editor.connection.alias
|
||||||
|
setting.objects.using(db_alias).bulk_create([
|
||||||
|
setting(31, _("VM DRBD Status"), "VM_DRBD_STATUS", "False", "True,False", _("Show VM DRBD Status")),
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
|
def del_default_settings(apps, schema_editor):
|
||||||
|
setting = apps.get_model("appsettings", "AppSettings")
|
||||||
|
db_alias = schema_editor.connection.alias
|
||||||
|
setting.objects.using(db_alias).filter(key="VM_DRBD_STATUS").delete()
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('appsettings', '0006_alter_appsettings_id'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RunPython(add_default_settings, del_default_settings),
|
||||||
|
]
|
|
@ -7,7 +7,9 @@
|
||||||
<th scope="col">{% trans "Name" %}<br>{% trans "Description" %}</th>
|
<th scope="col">{% trans "Name" %}<br>{% trans "Description" %}</th>
|
||||||
<th scope="col" class="d-none d-sm-table-cell">{% trans "User"%}</th>
|
<th scope="col" class="d-none d-sm-table-cell">{% trans "User"%}</th>
|
||||||
<th scope="col">{% trans "Status" %}</th>
|
<th scope="col">{% trans "Status" %}</th>
|
||||||
|
{% if app_settings.VM_DRBD_STATUS == 'True' %}
|
||||||
<th scope="col">{% trans "Role/Disk" %}</th>
|
<th scope="col">{% trans "Role/Disk" %}</th>
|
||||||
|
{% endif %}
|
||||||
<th scope="col" class="d-none d-sm-table-cell">{% trans "VCPU" %}</th>
|
<th scope="col" class="d-none d-sm-table-cell">{% trans "VCPU" %}</th>
|
||||||
<th scope="col" class="d-none d-sm-table-cell">{% trans "Memory" %}</th>
|
<th scope="col" class="d-none d-sm-table-cell">{% trans "Memory" %}</th>
|
||||||
<th scope="col" style="width:200px;" data-sortable="false">{% trans "Actions" %} & {% trans "Mem Usage" %}</th>
|
<th scope="col" style="width:200px;" data-sortable="false">{% trans "Actions" %} & {% trans "Mem Usage" %}</th>
|
||||||
|
@ -28,7 +30,9 @@
|
||||||
<td>
|
<td>
|
||||||
<span class="text-success">{% trans "Connected" %}</span>
|
<span class="text-success">{% trans "Connected" %}</span>
|
||||||
</td>
|
</td>
|
||||||
|
{% if app_settings.VM_DRBD_STATUS == 'True' %}
|
||||||
<td class="d-none d-sm-table-cell"></td>
|
<td class="d-none d-sm-table-cell"></td>
|
||||||
|
{% endif %}
|
||||||
<td class="d-none d-sm-table-cell text-center">{{ compute.cpu_count }}</td>
|
<td class="d-none d-sm-table-cell text-center">{{ compute.cpu_count }}</td>
|
||||||
<td class="d-none d-sm-table-cell text-right">{{ compute.ram_size|filesizeformat }}</td>
|
<td class="d-none d-sm-table-cell text-right">{{ compute.ram_size|filesizeformat }}</td>
|
||||||
<td>
|
<td>
|
||||||
|
@ -64,9 +68,11 @@
|
||||||
<span class="text-warning">{% trans "Suspended" %}</span>
|
<span class="text-warning">{% trans "Suspended" %}</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
|
{% if app_settings.VM_DRBD_STATUS == 'True' %}
|
||||||
<td>
|
<td>
|
||||||
{% if instance.drbd == "Primary/OK" or instance.drbd == "Secondary/OK" %}<span class="text-success">{% else %}<span class="text-danger">{% endif %}{{ instance.drbd }}</span>
|
{% if instance.drbd == "Primary/OK" or instance.drbd == "Secondary/OK" %}<span class="text-success">{% else %}<span class="text-danger">{% endif %}{{ instance.drbd }}</span>
|
||||||
</td>
|
</td>
|
||||||
|
{% endif %}
|
||||||
<td>{{ instance.proxy.instance.info.3 }}</td>
|
<td>{{ instance.proxy.instance.info.3 }}</td>
|
||||||
<td>{{ instance.cur_memory }} MB</td>
|
<td>{{ instance.cur_memory }} MB</td>
|
||||||
<td class="text-nowrap">
|
<td class="text-nowrap">
|
||||||
|
|
|
@ -7,7 +7,9 @@
|
||||||
<th scope="col">{% trans 'Host' %}<br>{% trans 'User' %}</th>
|
<th scope="col">{% trans 'Host' %}<br>{% trans 'User' %}</th>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<th scope="col">{% trans 'Status' %}</th>
|
<th scope="col">{% trans 'Status' %}</th>
|
||||||
|
{% if app_settings.VM_DRBD_STATUS == 'True' %}
|
||||||
<th scope="col">{% trans 'Role/Disk' %}</th>
|
<th scope="col">{% trans 'Role/Disk' %}</th>
|
||||||
|
{% endif %}
|
||||||
<th scope="col">{% trans 'VCPU' %}</th>
|
<th scope="col">{% trans 'VCPU' %}</th>
|
||||||
<th scope="col">{% trans 'Memory' %}</th>
|
<th scope="col">{% trans 'Memory' %}</th>
|
||||||
<th scope="col" data-sortable="false">{% trans 'Actions' %}</th>
|
<th scope="col" data-sortable="false">{% trans 'Actions' %}</th>
|
||||||
|
@ -45,9 +47,11 @@
|
||||||
{% if instance.proxy.instance.info.0 == 3 %}<span
|
{% if instance.proxy.instance.info.0 == 3 %}<span
|
||||||
class="text-warning">{% trans "Suspended" %}</span>{% endif %}
|
class="text-warning">{% trans "Suspended" %}</span>{% endif %}
|
||||||
</td>
|
</td>
|
||||||
|
{% if app_settings.VM_DRBD_STATUS == 'True' %}
|
||||||
<td>
|
<td>
|
||||||
{% if instance.drbd == "Primary/OK" or instance.drbd == "Secondary/OK" %}<span class="text-success">{% else %}<span class="text-danger">{% endif %}{{ instance.drbd }}</span>
|
{% if instance.drbd == "Primary/OK" or instance.drbd == "Secondary/OK" %}<span class="text-success">{% else %}<span class="text-danger">{% endif %}{{ instance.drbd }}</span>
|
||||||
</td>
|
</td>
|
||||||
|
{% endif %}
|
||||||
<td>{{ instance.proxy.instance.info.3 }}</td>
|
<td>{{ instance.proxy.instance.info.3 }}</td>
|
||||||
<td>{{ instance.cur_memory }} MB</td>
|
<td>{{ instance.cur_memory }} MB</td>
|
||||||
<td class="text-nowrap">
|
<td class="text-nowrap">
|
||||||
|
|
|
@ -128,6 +128,7 @@ def instance(request, pk):
|
||||||
storages_host = sorted(instance.proxy.get_storages(True))
|
storages_host = sorted(instance.proxy.get_storages(True))
|
||||||
net_models_host = instance.proxy.get_network_models()
|
net_models_host = instance.proxy.get_network_models()
|
||||||
|
|
||||||
|
if app_settings.VM_DRBD_STATUS == 'True':
|
||||||
instance.drbd = drbd_status(request, pk)
|
instance.drbd = drbd_status(request, pk)
|
||||||
instance.save()
|
instance.save()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue