diff --git a/computes/templates/computes/attention.html b/computes/templates/computes/attention.html
new file mode 100644
index 00000000..be197c6f
--- /dev/null
+++ b/computes/templates/computes/attention.html
@@ -0,0 +1,36 @@
+{% load i18n %}{% load bootstrap_icons %}{# what wants a look: views.attention, each with a link to where it is handled #}
+{% if attention %}
+
+
{% bs_icon 'exclamation-triangle' %} {% trans "Needs attention" %}
+ {% endif %}
+ {% for policy, count in attention.not_taken %}
+
{{ policy.name }}: {% blocktrans count counter=count %}{{ counter }} scheduled backup not taken in the last 7 days{% plural %}{{ counter }} scheduled backups not taken in the last 7 days{% endblocktrans %}
+{% include "computes/attention.html" %}
{% if not computes %}
{% bs_icon 'exclamation-triangle'%} {% trans "Warning" %}: {% trans "You don't have any computes" %}
diff --git a/computes/tests/test_attention.py b/computes/tests/test_attention.py
new file mode 100644
index 00000000..e3172f35
--- /dev/null
+++ b/computes/tests/test_attention.py
@@ -0,0 +1,131 @@
+"""The box above the Computes page's hosts: what wants a look, each with a link to where it is handled."""
+
+import datetime
+import time
+from types import SimpleNamespace
+from unittest.mock import MagicMock, patch
+
+from django.contrib.auth import get_user_model
+from libvirt import libvirtError
+from django.test import TestCase
+from django.urls import reverse
+from django.utils import timezone
+
+from computes import views
+from computes.models import Compute
+from instances.models import Instance
+from operations.models import Operation
+from operations.utils import say
+from vmbackups.models import Backup, BackupPolicy, BackupRun, BackupTarget
+from vmbackups.schedule import IN_MAINTENANCE, NOT_STARTED
+from vrtManager.hostdetails import wvmHostDetails
+
+NOW = timezone.now()
+
+
+class AttentionBoxTests(TestCase):
+ def setUp(self):
+ self.admin = get_user_model().objects.create_superuser("at-admin", "at@example.com", "pw")
+ self.client.force_login(self.admin)
+ self.up = Compute.objects.create(name="up", hostname="192.0.2.1", login="wvc", password="", type=1,
+ host_uuid="11111111-0000-0000-0000-000000000000")
+ self.down = Compute.objects.create(name="down", hostname="192.0.2.2", login="wvc", password="", type=1,
+ host_uuid="22222222-0000-0000-0000-000000000000")
+ self.vm = Instance.objects.create(compute=self.up, name="vm1", uuid="33333333-0000-4000-8000-000000000001")
+ self.addCleanup(lambda: [read.join(5) for read in views._reading.values()]) # none left for the next test
+
+ def read(self, compute):
+ return (False, "refused", None, "") if compute.name == "down" else (True, None, None, "")
+
+ def page(self, pools=(), snapshots=()):
+ with patch("computes.views._read_host", side_effect=self.read), patch(
+ "computes.views._read_attention", return_value={"pools": list(pools), "snapshots": list(snapshots)}):
+ return self.client.get(reverse("computes"))
+
+ def test_nothing_to_look_at_shows_no_box(self):
+ self.down.delete()
+ self.assertNotContains(self.page(), "Needs attention")
+
+ def test_hosts_pools_and_snapshots(self):
+ page = self.page(pools=[{"name": "default", "percent": 91}], snapshots=[{"vm": "vm1", "count": 2}])
+ self.assertContains(page, "Needs attention")
+ self.assertContains(page, f'down: not answering',
+ html=False)
+ self.assertContains(page, reverse("storage", args=[self.up.pk, "default"]))
+ self.assertContains(page, "91% full")
+ self.assertContains(page, reverse("instances:instance", args=[self.vm.pk]) + "#snapshots")
+ self.assertContains(page, "2 snapshots older than 30 days")
+
+ def test_snapshots_slow_to_list_do_not_hold_the_page(self):
+ slow = {"pools": [{"name": "default", "percent": 91}], "snapshots": []}
+ with patch("computes.views._read_host", side_effect=self.read), patch("computes.views.ATTENTION_WAIT", 0.2), patch(
+ "computes.views._read_attention", side_effect=lambda compute: time.sleep(1) or slow):
+ started = time.monotonic()
+ page = self.client.get(reverse("computes"))
+ took = time.monotonic() - started
+ self.assertLess(took, 0.9)
+ self.assertEqual({c.name: c.status for c in page.context["computes"]}, {"up": True, "down": False})
+ self.assertNotContains(page, "91% full") # left out this time
+
+ def test_backups_and_jobs(self):
+ target = BackupTarget.objects.create(name="t")
+ policy = BackupPolicy.objects.create(name="n", target=target, time=datetime.time(2), keep=1)
+
+ def backup(state, days_ago=0, **fields):
+ b = Backup.objects.create(target=target, instance=self.vm, vm_uuid=self.vm.uuid, vm_name="vm1",
+ compute_name="up", state=state, **fields)
+ Backup.objects.filter(pk=b.pk).update(created_at=NOW - datetime.timedelta(days=days_ago))
+
+ backup(Backup.MISSING, days_ago=40)
+ backup(Backup.READY, damage=say("x"))
+ today = timezone.localdate()
+ BackupRun.objects.create(policy=policy, instance=self.vm, day=today, state=BackupRun.SKIPPED, note=say(NOT_STARTED))
+ BackupRun.objects.create(policy=policy, instance=self.vm, day=today - datetime.timedelta(days=1),
+ state=BackupRun.SKIPPED, note=say(IN_MAINTENANCE)) # the operator's choice
+ Operation.objects.create(kind="backup.verify", user=self.admin, username="at-admin", submission_key="k1",
+ resource="r1", state=Operation.UNCERTAIN)
+ for key, days_ago in (("k4", 0), ("k5", 8)): # a backup job failed this week, one before
+ Operation.objects.create(kind="backup.create", user=self.admin, username="at-admin", submission_key=key,
+ resource=key, state=Operation.FAILED,
+ finished_at=NOW - datetime.timedelta(days=days_ago))
+ waiting = Operation.objects.create(kind="backup.verify", user=self.admin, username="at-admin",
+ submission_key="k2", resource="r2", state=Operation.QUEUED)
+ Operation.objects.filter(pk=waiting.pk).update(created_at=NOW - datetime.timedelta(hours=2))
+ Operation.objects.create(kind="backup.verify", user=self.admin, username="at-admin", submission_key="k3",
+ resource="r3", state=Operation.QUEUED) # just queued
+ self.down.delete()
+ page = self.page()
+ for text in ("1 backup failed in the last 7 days", "1 scheduled backup not taken in the last 7 days",
+ "1 backup missing from its target", "1 backup damaged", "1 job ended uncertain",
+ "1 job queued for over an hour"):
+ self.assertContains(page, text)
+ self.assertContains(page, reverse("operations:jobs") + "?kind=backup.create&state=failed")
+ self.assertContains(page, f'n: 1 scheduled')
+ self.assertContains(page, reverse("vmbackups:index") + "?state=damaged")
+ self.assertContains(page, reverse("operations:jobs") + "?state=uncertain")
+ listed = self.client.get(reverse("vmbackups:index") + "?state=damaged")
+ self.assertEqual([b.state for b in listed.context["rows"]], [Backup.READY])
+
+
+class HostAttentionTests(TestCase):
+ def test_full_pools_and_old_snapshots_of_the_host(self):
+ def pool(name, capacity, allocation):
+ return MagicMock(**{"name.return_value": name, "info.return_value": [2, capacity, allocation, 0]})
+
+ def snapshot(days_ago):
+ created = int((NOW - datetime.timedelta(days=days_ago)).timestamp())
+ return MagicMock(**{"getXMLDesc.return_value": f"{created}"
+ ""})
+
+ def domain(name, *snapshots):
+ return MagicMock(**{"name.return_value": name, "listAllSnapshots.return_value": list(snapshots)})
+
+ host = wvmHostDetails.__new__(wvmHostDetails)
+ gone = MagicMock(**{"info.side_effect": libvirtError("undefined meanwhile")})
+ deleted = MagicMock(**{"getXMLDesc.side_effect": libvirtError("deleted meanwhile")})
+ host.wvm = SimpleNamespace(
+ listAllStoragePools=lambda flags: [pool("default", 100, 90), gone, pool("big", 100, 10), pool("empty", 0, 0)],
+ listAllDomains=lambda flags: [domain("old", snapshot(40), deleted, snapshot(31), snapshot(1)),
+ domain("new", snapshot(2))])
+ self.assertEqual(host.get_attention(85, NOW - datetime.timedelta(days=30)),
+ {"pools": [{"name": "default", "percent": 90}], "snapshots": [{"vm": "old", "count": 2}]})
diff --git a/computes/tests/test_capacity.py b/computes/tests/test_capacity.py
index 07fae02c..a8fd7e15 100644
--- a/computes/tests/test_capacity.py
+++ b/computes/tests/test_capacity.py
@@ -52,7 +52,7 @@ class ComputesPageTests(TestCase):
found = {c1.id: {"cpus": 16, "memory": 64 * GIB, "vcpus": {"all": 40, "running": 24},
"assigned": {"all": 48 * GIB, "running": 32 * GIB}, "ratio": 2.5, "vms": VMS}}
with patch.object(Compute, "capacity", new=property(lambda c: found.get(c.id))), \
- patch.object(Compute, "status", new=True):
+ patch.object(Compute, "status", new=True), patch("computes.views._read_attention", return_value=None):
page = html.fromstring(self.client.get(reverse("computes")).content)
headers = [" ".join(th.text_content().split()) for th in page.xpath("//thead//th")]
# no pools: measuring their space scans each pool of each host (views.host_pools)
diff --git a/computes/tests/test_list_hosts.py b/computes/tests/test_list_hosts.py
index 42f3e3d5..f844b982 100644
--- a/computes/tests/test_list_hosts.py
+++ b/computes/tests/test_list_hosts.py
@@ -9,6 +9,7 @@ from django.contrib.auth import get_user_model
from django.test import TestCase
from django.urls import reverse
+from computes import views
from computes.models import Compute
@@ -18,6 +19,10 @@ class ListHostsTests(TestCase):
for number, name in enumerate(("fast", "slow-1", "slow-2")):
Compute.objects.create(name=name, hostname="192.0.2.1", login="wvc", password="", type=1,
host_uuid=f"{number}" * 8 + "-0000-0000-0000-000000000000")
+ patcher = patch("computes.views._read_attention", return_value=None) # the box's reads: test_attention
+ patcher.start()
+ self.addCleanup(patcher.stop) # last: the reads still running end with it
+ self.addCleanup(lambda: [read.join(5) for read in views._reading.values()])
self.release = threading.Event()
self.addCleanup(self.release.set)
diff --git a/computes/views.py b/computes/views.py
index b2dc1e46..218d222a 100644
--- a/computes/views.py
+++ b/computes/views.py
@@ -2,6 +2,8 @@ import json
import logging
import threading
import time
+from collections import Counter
+from datetime import timedelta
from contextlib import suppress
from copy import copy
@@ -25,7 +27,9 @@ from libvirt import libvirtError
from logs.audit import audit, changed_fields, snapshot
from operations import claims, jobs
from operations.models import Operation
-from operations.utils import busy_message
+from operations.utils import busy_message, say
+from vmbackups.models import Backup, BackupRun
+from vmbackups.schedule import IN_MAINTENANCE
from vrtManager.connection import CONN_SOCKET, CONN_SSH, CONN_TCP, CONN_TLS
from vrtManager.hostdetails import wvmHostDetails
from vrtManager.storage import wvmStorages
@@ -93,6 +97,11 @@ CONNECTIONS = {CONN_TCP: "TCP", CONN_SSH: "SSH", CONN_TLS: "TLS", CONN_SOCKET: "
LIST_WAIT = 10
+# what the box above the hosts tells of: a pool this full (percent), a snapshot this old
+POOL_FULL = 85
+SNAPSHOT_OLD = timedelta(days=30)
+
+
def _read_host(compute):
"""Whether the panel reaches the compute, why not, its capacity
(shown_capacity) and, for one whose host UUID is not kept yet, that UUID
@@ -104,23 +113,35 @@ def _read_host(compute):
return compute.status, compute.connection_error, shown_capacity(compute), uuid
-class _HostRead(threading.Thread):
- """One read of a host (_read_host) on a daemon thread: one stuck on its
- host does not hold the process when it exits."""
+def _read_attention(compute):
+ """The compute's full pools and old snapshots (get_attention); None when
+ they cannot be read."""
+ if compute.status is True:
+ with suppress(libvirtError):
+ return compute.proxy.get_attention(POOL_FULL, timezone.now() - SNAPSHOT_OLD)
+ return None
- def __init__(self, compute):
+
+class _HostRead(threading.Thread):
+ """One read of a host (read: _read_host or _read_attention) on a daemon
+ thread: one stuck on its host does not hold the process when it exits."""
+
+ def __init__(self, compute, read):
super().__init__(daemon=True, name=f"wvc-host-{compute.pk}")
- self.compute, self.result = compute, None
+ self.compute, self.read, self.result = compute, read, None
def run(self):
- self.result = _read_host(self.compute)
+ self.result = self.read(self.compute)
# the reads of the Computes pages of this process, one of a host at a time: a host that
# hangs holds one thread however often the page is loaded, and no other host's
-_reading = {} # (compute pk, its connection settings): its last read
+_reading = {} # (its kind, compute pk, its connection settings): its last read
_reading_lock = threading.Lock()
+# the box's reads (_read_attention) are waited for this long at most: one slow does not hold the page
+ATTENTION_WAIT = 2
+
def _read_key(compute):
"""A compute as read: a compute whose connection settings change is read anew, not
@@ -128,30 +149,42 @@ def _read_key(compute):
return (compute.pk, *(getattr(compute, field) for field in ENDPOINT))
-def read_hosts(computes):
+def _start(compute, kind):
+ """compute's read of kind ("host": _read_host, "attention": _read_attention): one of an earlier load
+ still running, else a new one. Callers hold _reading_lock."""
+ key = (kind, *_read_key(compute))
+ if key not in _reading or not _reading[key].is_alive():
+ _reading[key] = _HostRead(copy(compute), _read_host if kind == "host" else _read_attention)
+ _reading[key].start()
+ return _reading[key]
+
+
+def read_hosts(computes, attention=False):
"""Reads each of computes (_read_host) on its own thread: a slow host
holds back only itself, and one not read within LIST_WAIT is shown as
not answering. A host whose read of an earlier load still runs is not
read again: that read is waited for. Each thread reads a copy: one still
- running later does not change what the page shows."""
+ running later does not change what the page shows. With attention, each
+ one's full pools and old snapshots too (_read_attention, compute.attention),
+ waited for up to ATTENTION_WAIT: None for one that comes later."""
with _reading_lock:
- keys = {compute: _read_key(compute) for compute in computes}
+ keys = {(kind, *_read_key(compute)) for compute in computes for kind in ("host", "attention")}
# reads ended of computes deleted or changed since: their copies (and credentials) go
- for key in [key for key, read in _reading.items() if key not in keys.values() and not read.is_alive()]:
+ for key in [key for key, read in _reading.items() if key not in keys and not read.is_alive()]:
del _reading[key]
- for compute, key in keys.items():
- if key not in _reading or not _reading[key].is_alive():
- _reading[key] = _HostRead(copy(compute))
- _reading[key].start()
- reads = {compute: _reading[key] for compute, key in keys.items()}
- deadline = time.monotonic() + LIST_WAIT
+ reads = {compute: _start(compute, "host") for compute in computes}
+ scans = {compute: _start(compute, "attention") for compute in computes} if attention else {}
+ started = time.monotonic()
for read in reads.values():
- read.join(max(0, deadline - time.monotonic()))
+ read.join(max(0, started + LIST_WAIT - time.monotonic()))
+ for scan in scans.values():
+ scan.join(max(0, started + ATTENTION_WAIT - time.monotonic()))
for compute, read in reads.items():
+ compute.attention = scans[compute].result if compute in scans else None
if read.result is not None:
compute.status, compute.connection_error, compute.shown_capacity, compute.read_uuid = read.result
else:
- compute.status, compute.shown_capacity, compute.read_uuid = False, None, ""
+ compute.status, compute.shown_capacity, compute.read_uuid, compute.attention = False, None, "", None
compute.connection_error = _("The host did not answer within %(seconds)s seconds") % {"seconds": LIST_WAIT}
@@ -162,7 +195,7 @@ def computes(request):
computes = list(Compute.objects.order_by("name").prefetch_related("tags"))
totals = {"hosts": len(computes), "connected": 0, "vms": 0, "running": 0,
"vcpus": 0, "cpus": 0, "assigned": 0, "memory": 0}
- read_hosts(computes)
+ read_hosts(computes, attention=True)
for compute in computes:
compute.connection_name = CONNECTIONS.get(compute.type, "")
if compute.read_uuid:
@@ -180,7 +213,31 @@ def computes(request):
totals["memory"] += given["memory"]
return render(request, "computes/list.html",
{"computes": computes, "totals": totals, "job_resource": claims.bulk_migrate_key(),
- "tags": Tag.counts(computes)})
+ "tags": Tag.counts(computes), "attention": attention(computes)})
+
+
+def attention(computes):
+ """What wants a look, for the box above the hosts; empty when nothing: the
+ computes not answering, their full pools and old snapshots (_read_attention),
+ the backup jobs that failed and the backups a schedule did not take in the last 7 days
+ (not for a host in maintenance: the operator's choice), the backups missing
+ or damaged, and the jobs that ended uncertain or wait for over an hour."""
+ week = timezone.now() - timedelta(days=7)
+ vms = {(vm.compute_id, vm.name): vm for vm in Instance.objects.filter(compute__in=computes)}
+ found = {
+ "hosts": [c for c in computes if c.status is not True],
+ "pools": [(c, pool) for c in computes for pool in (c.attention or {}).get("pools", [])],
+ "snapshots": [(c, vms.get((c.pk, s["vm"])), s) for c in computes for s in (c.attention or {}).get("snapshots", [])],
+ "failed": Operation.objects.filter(kind="backup.create", state=Operation.FAILED, finished_at__gte=week).count(),
+ "not_taken": sorted(Counter(run.policy for run in BackupRun.objects.filter(
+ day__gte=timezone.localtime(week).date(), state__in=(BackupRun.SKIPPED, BackupRun.FAILED)
+ ).select_related("policy") if run.note != say(IN_MAINTENANCE)).items(), key=lambda item: item[0].name),
+ "missing": Backup.objects.filter(state=Backup.MISSING).count(),
+ "damaged": Backup.objects.filter(state=Backup.READY).exclude(damage=[]).count(),
+ "uncertain": Operation.objects.filter(state=Operation.UNCERTAIN).count(),
+ "waiting": Operation.objects.filter(state=Operation.QUEUED, created_at__lt=timezone.now() - timedelta(hours=1)).count(),
+ }
+ return found if any(found.values()) else {}
@superuser_only
diff --git a/locale/tr/LC_MESSAGES/django.mo b/locale/tr/LC_MESSAGES/django.mo
index 0932e775..0e11b447 100644
Binary files a/locale/tr/LC_MESSAGES/django.mo and b/locale/tr/LC_MESSAGES/django.mo differ
diff --git a/locale/tr/LC_MESSAGES/django.po b/locale/tr/LC_MESSAGES/django.po
index af235182..236951c8 100644
--- a/locale/tr/LC_MESSAGES/django.po
+++ b/locale/tr/LC_MESSAGES/django.po
@@ -11,7 +11,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2026-11-19 19:01+0000\n"
+"POT-Creation-Date: 2026-11-19 19:29+0000\n"
"PO-Revision-Date: 2020-11-04 12:00+0000\n"
"Last-Translator: catborise , 2020\n"
"Language-Team: Turkish (https://www.transifex.com/catborise/teams/110663/tr/)\n"
@@ -224,8 +224,8 @@ msgstr "Kullanıcı bölümleri"
#: accounts/templates/account.html:50 accounts/templates/account.html:58
#: admin/forms.py:221 admin/templates/admin/tag_list.html:25
-#: computes/templates/computes/list.html:33
-#: computes/templates/computes/list.html:61 computes/templates/overview.html:90
+#: computes/templates/computes/list.html:34
+#: computes/templates/computes/list.html:62 computes/templates/overview.html:90
#: instances/views.py:267 vmbackups/templates/vmbackups/policies.html:17
msgid "VMs"
msgstr "Sanal makineler"
@@ -246,7 +246,7 @@ msgstr "Sanal makine ekle"
#: accounts/templates/account.html:68 admin/templates/admin/logs.html:40
#: computes/templates/computes/balance.html:109
-#: computes/templates/computes/list.html:60
+#: computes/templates/computes/list.html:61
#: instances/templates/allinstances.html:109
#: instances/templates/allinstances_index_nongrouped.html:8
#: instances/templates/create_steps.html:6
@@ -260,7 +260,7 @@ msgstr "Sunucu"
msgid "Power and console only"
msgstr "Yalnızca güç ve konsol"
-#: accounts/templates/account.html:81 computes/templates/computes/list.html:109
+#: accounts/templates/account.html:81 computes/templates/computes/list.html:110
#: instances/templates/instance_actions.html:9
#: storages/templates/storage.html:140
#, python-format
@@ -792,7 +792,7 @@ msgstr ""
"NEW_USER_DEFAULT_INSTANCES: %(name)s sanal makinesinin bir sahibi var ve "
"yalnızca bir sahibe izin veriliyor"
-#: admin/forms.py:222 computes/templates/computes/list.html:62
+#: admin/forms.py:222 computes/templates/computes/list.html:63
#: computes/templates/overview.html:102 instances/forms.py:15
#: instances/templates/allinstances_index_grouped.html:16
#: instances/templates/allinstances_index_nongrouped.html:14
@@ -805,7 +805,7 @@ msgstr "vCPU"
#: admin/forms.py:223 computes/templates/computes/balance.html:62
#: computes/templates/computes/bulk_migrate.html:73
#: computes/templates/computes/instances.html:57
-#: computes/templates/computes/list.html:63
+#: computes/templates/computes/list.html:64
#: computes/templates/overview.html:110 computes/templates/overview.html:194
#: instances/templates/allinstances_index_grouped.html:17
#: instances/templates/allinstances_index_nongrouped.html:15
@@ -1059,13 +1059,13 @@ msgid "Tag"
msgstr "Etiket"
#: admin/templates/admin/tag_list.html:26
-#: computes/templates/computes/list.html:26
+#: computes/templates/computes/list.html:27
msgid "Hosts"
msgstr "Sunucular"
#: admin/templates/admin/tag_list.html:27
#: computes/templates/computes/instances.html:58
-#: computes/templates/computes/list.html:64
+#: computes/templates/computes/list.html:65
#: instances/templates/allinstances_index_grouped.html:18
#: instances/templates/allinstances_index_nongrouped.html:16
#: instances/templates/instances/settings_tab.html:450
@@ -2337,6 +2337,68 @@ msgstr ""
"Bir disk dosyası iki sunucunun paylaştığı depolamada değil: sanal makineyi "
"kendi sayfasından taşıyın"
+#: computes/templates/computes/attention.html:4
+msgid "Needs attention"
+msgstr "Dikkat gerekiyor"
+
+#: computes/templates/computes/attention.html:7
+msgid "not answering"
+msgstr "yanıt vermiyor"
+
+#: computes/templates/computes/attention.html:10
+#, python-format
+msgid "%(percent)s%% full"
+msgstr "%%%(percent)s dolu"
+
+#: computes/templates/computes/attention.html:14
+#, python-format
+msgid "%(counter)s snapshot older than 30 days"
+msgid_plural "%(counter)s snapshots older than 30 days"
+msgstr[0] "30 günden eski %(counter)s snapshot"
+msgstr[1] "30 günden eski %(counter)s snapshot"
+
+#: computes/templates/computes/attention.html:17
+#, python-format
+msgid "%(counter)s backup failed in the last 7 days"
+msgid_plural "%(counter)s backups failed in the last 7 days"
+msgstr[0] "Son 7 günde %(counter)s yedek başarısız oldu"
+msgstr[1] "Son 7 günde %(counter)s yedek başarısız oldu"
+
+#: computes/templates/computes/attention.html:20
+#, python-format
+msgid "%(counter)s scheduled backup not taken in the last 7 days"
+msgid_plural "%(counter)s scheduled backups not taken in the last 7 days"
+msgstr[0] "Son 7 günde zamanlanmış %(counter)s yedek alınmadı"
+msgstr[1] "Son 7 günde zamanlanmış %(counter)s yedek alınmadı"
+
+#: computes/templates/computes/attention.html:23
+#, python-format
+msgid "%(counter)s backup missing from its target"
+msgid_plural "%(counter)s backups missing from their targets"
+msgstr[0] "Hedefinde eksik %(counter)s yedek"
+msgstr[1] "Hedeflerinde eksik %(counter)s yedek"
+
+#: computes/templates/computes/attention.html:26
+#, python-format
+msgid "%(counter)s backup damaged"
+msgid_plural "%(counter)s backups damaged"
+msgstr[0] "%(counter)s yedek hasarlı"
+msgstr[1] "%(counter)s yedek hasarlı"
+
+#: computes/templates/computes/attention.html:29
+#, python-format
+msgid "%(counter)s job ended uncertain"
+msgid_plural "%(counter)s jobs ended uncertain"
+msgstr[0] "%(counter)s iş belirsiz bitti"
+msgstr[1] "%(counter)s iş belirsiz bitti"
+
+#: computes/templates/computes/attention.html:32
+#, python-format
+msgid "%(counter)s job queued for over an hour"
+msgid_plural "%(counter)s jobs queued for over an hour"
+msgstr[0] "%(counter)s iş bir saatten uzun kuyrukta bekliyor"
+msgstr[1] "%(counter)s iş bir saatten uzun kuyrukta bekliyor"
+
#: computes/templates/computes/balance.html:11
#: computes/templates/computes/list.html:6
#: computes/templates/computes/list.html:14 templates/navbar.html:18
@@ -2383,7 +2445,7 @@ msgstr[1] "%(counter)s vCPU"
#: computes/templates/computes/balance.html:33
#: computes/templates/computes/balance.html:36
#: computes/templates/computes/capacity_vcpus.html:4
-#: computes/templates/computes/list.html:42
+#: computes/templates/computes/list.html:43
#, python-format
msgid "on %(counter)s CPU"
msgid_plural "on %(counter)s CPUs"
@@ -2571,7 +2633,7 @@ msgstr[1] ""
"bellek."
#: computes/templates/computes/capacity_line.txt:4
-#: computes/templates/computes/list.html:102
+#: computes/templates/computes/list.html:103
#: computes/templates/overview.html:127
msgid "The capacity could not be read."
msgstr "Kapasite okunamadı."
@@ -2604,7 +2666,7 @@ msgstr "Sunucunun %(memory)s belleğinden %(stopped)s"
#: computes/templates/computes/capacity_memory.html:18
#: computes/templates/computes/capacity_vcpus.html:18
-#: computes/templates/computes/list.html:93
+#: computes/templates/computes/list.html:94
#, python-format
msgid "%(running)s running"
msgstr "%(running)s çalışıyor"
@@ -2719,7 +2781,7 @@ msgstr "Sunucu bölümleri"
#: computes/templates/computes/host_nav.html:7
#: computes/templates/computes/host_nav.html:8
-#: computes/templates/computes/list.html:111 computes/templates/overview.html:7
+#: computes/templates/computes/list.html:112 computes/templates/overview.html:7
msgid "Overview"
msgstr "Genel Bakış"
@@ -2792,7 +2854,7 @@ msgid "Problem occurred with host %(name)s: %(error)s"
msgstr "%(name)s sunucusuyla ilgili bir sorun oluştu: %(error)s"
#: computes/templates/computes/instances.html:44
-#: computes/templates/computes/list.html:19
+#: computes/templates/computes/list.html:20
msgid "Warning"
msgstr "Uyarı"
@@ -2804,32 +2866,32 @@ msgstr "Hipervizör üzerinde hiç sanal makine yok"
msgid "VCPU"
msgstr "VCPU"
-#: computes/templates/computes/list.html:19
+#: computes/templates/computes/list.html:20
msgid "You don't have any computes"
msgstr "Hiç sunucunuz yok"
-#: computes/templates/computes/list.html:28
+#: computes/templates/computes/list.html:29
msgid "connected"
msgstr "bağlı"
-#: computes/templates/computes/list.html:35
+#: computes/templates/computes/list.html:36
msgid "running"
msgstr "çalışıyor"
-#: computes/templates/computes/list.html:40
+#: computes/templates/computes/list.html:41
msgid "vCPUs given"
msgstr "Verilen vCPU"
-#: computes/templates/computes/list.html:47
+#: computes/templates/computes/list.html:48
msgid "Memory given"
msgstr "Atanan bellek"
-#: computes/templates/computes/list.html:49
+#: computes/templates/computes/list.html:50
#, python-format
msgid "of %(memory)s"
msgstr "/ %(memory)s"
-#: computes/templates/computes/list.html:75 computes/templates/overview.html:34
+#: computes/templates/computes/list.html:76 computes/templates/overview.html:34
#: console/templates/console-vnc.html:13
#: console/templates/console-xterm.html:16
#: instances/templates/allinstances_index_grouped.html:36
@@ -2838,38 +2900,38 @@ msgstr "/ %(memory)s"
msgid "Connected"
msgstr "Bağlı"
-#: computes/templates/computes/list.html:77 computes/templates/overview.html:36
+#: computes/templates/computes/list.html:78 computes/templates/overview.html:36
#: instances/templates/allinstances_index_grouped.html:38
msgid "Not connected"
msgstr "Bağlı değil"
-#: computes/templates/computes/list.html:80
+#: computes/templates/computes/list.html:81
msgid "In maintenance"
msgstr "Bakımda"
-#: computes/templates/computes/list.html:80
+#: computes/templates/computes/list.html:81
msgid "Maintenance requested"
msgstr "Bakım istendi"
-#: computes/templates/computes/list.html:102
+#: computes/templates/computes/list.html:103
msgid "No capacity while the host cannot be reached."
msgstr "Sunucuya ulaşılamadığı sürece kapasite gösterilmez."
-#: computes/templates/computes/list.html:112
+#: computes/templates/computes/list.html:113
#: computes/templates/overview.html:24 computes/templates/overview.html:78
msgid "Edit connection"
msgstr "Bağlantıyı düzenle"
-#: computes/templates/computes/list.html:114
+#: computes/templates/computes/list.html:115
#: computes/templates/overview.html:25
msgid "Remove from panel"
msgstr "Panelden kaldır"
-#: computes/templates/computes/list.html:126
+#: computes/templates/computes/list.html:127
msgid "No host matches the filters."
msgstr "Filtrelerle eşleşen sunucu yok."
-#: computes/templates/computes/list.html:127
+#: computes/templates/computes/list.html:128
#: instances/templates/allinstances.html:71
msgid "Clear the filters"
msgstr "Filtreleri temizle"
@@ -3125,21 +3187,21 @@ msgstr ""
"Sunucudaki /etc/default/webvirt-gstfsd içindeki GSTFSD_KEY değerinin 64 "
"onaltılık karakterini girin"
-#: computes/views.py:155
+#: computes/views.py:168
#, python-format
msgid "The host did not answer within %(seconds)s seconds"
msgstr "Sunucu %(seconds)s saniye içinde yanıt vermedi"
-#: computes/views.py:360
+#: computes/views.py:396
msgid "No other host has room for it"
msgstr "Başka hiçbir sunucuda ona yer yok"
-#: computes/views.py:439
+#: computes/views.py:475
#, python-format
msgid "The host was saved, but the panel cannot connect to it: %(error)s"
msgstr "Sunucu kaydedildi, ancak panel ona bağlanamıyor: %(error)s"
-#: computes/views.py:512
+#: computes/views.py:548
#, python-format
msgid ""
"Its VMs keep running on the host and leave the panel; their owners are kept "
diff --git a/locale/zh/LC_MESSAGES/django.mo b/locale/zh/LC_MESSAGES/django.mo
index ebcd74ae..bd729ba4 100644
Binary files a/locale/zh/LC_MESSAGES/django.mo and b/locale/zh/LC_MESSAGES/django.mo differ
diff --git a/locale/zh/LC_MESSAGES/django.po b/locale/zh/LC_MESSAGES/django.po
index 292952a8..bcbeb7de 100644
--- a/locale/zh/LC_MESSAGES/django.po
+++ b/locale/zh/LC_MESSAGES/django.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2026-11-19 19:01+0000\n"
+"POT-Creation-Date: 2026-11-19 19:29+0000\n"
"PO-Revision-Date: \n"
"Last-Translator: \n"
"Language-Team: \n"
@@ -219,8 +219,8 @@ msgstr "用户页面导航"
#: accounts/templates/account.html:50 accounts/templates/account.html:58
#: admin/forms.py:221 admin/templates/admin/tag_list.html:25
-#: computes/templates/computes/list.html:33
-#: computes/templates/computes/list.html:61 computes/templates/overview.html:90
+#: computes/templates/computes/list.html:34
+#: computes/templates/computes/list.html:62 computes/templates/overview.html:90
#: instances/views.py:267 vmbackups/templates/vmbackups/policies.html:17
msgid "VMs"
msgstr "虚拟机"
@@ -241,7 +241,7 @@ msgstr "添加虚拟机"
#: accounts/templates/account.html:68 admin/templates/admin/logs.html:40
#: computes/templates/computes/balance.html:109
-#: computes/templates/computes/list.html:60
+#: computes/templates/computes/list.html:61
#: instances/templates/allinstances.html:109
#: instances/templates/allinstances_index_nongrouped.html:8
#: instances/templates/create_steps.html:6
@@ -255,7 +255,7 @@ msgstr "主机"
msgid "Power and console only"
msgstr "仅电源和控制台"
-#: accounts/templates/account.html:81 computes/templates/computes/list.html:109
+#: accounts/templates/account.html:81 computes/templates/computes/list.html:110
#: instances/templates/instance_actions.html:9
#: storages/templates/storage.html:140
#, python-format
@@ -766,7 +766,7 @@ msgid ""
"NEW_USER_DEFAULT_INSTANCES: %(name)s has an owner, and only one is allowed"
msgstr "NEW_USER_DEFAULT_INSTANCES:%(name)s 已有所有者,且只允许一个所有者"
-#: admin/forms.py:222 computes/templates/computes/list.html:62
+#: admin/forms.py:222 computes/templates/computes/list.html:63
#: computes/templates/overview.html:102 instances/forms.py:15
#: instances/templates/allinstances_index_grouped.html:16
#: instances/templates/allinstances_index_nongrouped.html:14
@@ -779,7 +779,7 @@ msgstr "vCPU"
#: admin/forms.py:223 computes/templates/computes/balance.html:62
#: computes/templates/computes/bulk_migrate.html:73
#: computes/templates/computes/instances.html:57
-#: computes/templates/computes/list.html:63
+#: computes/templates/computes/list.html:64
#: computes/templates/overview.html:110 computes/templates/overview.html:194
#: instances/templates/allinstances_index_grouped.html:17
#: instances/templates/allinstances_index_nongrouped.html:15
@@ -1028,13 +1028,13 @@ msgid "Tag"
msgstr "标签"
#: admin/templates/admin/tag_list.html:26
-#: computes/templates/computes/list.html:26
+#: computes/templates/computes/list.html:27
msgid "Hosts"
msgstr "主机"
#: admin/templates/admin/tag_list.html:27
#: computes/templates/computes/instances.html:58
-#: computes/templates/computes/list.html:64
+#: computes/templates/computes/list.html:65
#: instances/templates/allinstances_index_grouped.html:18
#: instances/templates/allinstances_index_nongrouped.html:16
#: instances/templates/instances/settings_tab.html:450
@@ -2233,6 +2233,61 @@ msgid ""
"A disk file is not on storage both hosts share: migrate it from its page"
msgstr "有磁盘文件不在两台主机共享的存储上:请在该虚拟机的页面上迁移它"
+#: computes/templates/computes/attention.html:4
+msgid "Needs attention"
+msgstr "需要关注"
+
+#: computes/templates/computes/attention.html:7
+msgid "not answering"
+msgstr "无响应"
+
+#: computes/templates/computes/attention.html:10
+#, python-format
+msgid "%(percent)s%% full"
+msgstr "已用 %(percent)s%%"
+
+#: computes/templates/computes/attention.html:14
+#, python-format
+msgid "%(counter)s snapshot older than 30 days"
+msgid_plural "%(counter)s snapshots older than 30 days"
+msgstr[0] "%(counter)s 个超过 30 天的快照"
+
+#: computes/templates/computes/attention.html:17
+#, python-format
+msgid "%(counter)s backup failed in the last 7 days"
+msgid_plural "%(counter)s backups failed in the last 7 days"
+msgstr[0] "最近 7 天有 %(counter)s 个备份失败"
+
+#: computes/templates/computes/attention.html:20
+#, python-format
+msgid "%(counter)s scheduled backup not taken in the last 7 days"
+msgid_plural "%(counter)s scheduled backups not taken in the last 7 days"
+msgstr[0] "最近 7 天有 %(counter)s 个计划备份未执行"
+
+#: computes/templates/computes/attention.html:23
+#, python-format
+msgid "%(counter)s backup missing from its target"
+msgid_plural "%(counter)s backups missing from their targets"
+msgstr[0] "%(counter)s 个备份在目标中缺失"
+
+#: computes/templates/computes/attention.html:26
+#, python-format
+msgid "%(counter)s backup damaged"
+msgid_plural "%(counter)s backups damaged"
+msgstr[0] "%(counter)s 个备份已损坏"
+
+#: computes/templates/computes/attention.html:29
+#, python-format
+msgid "%(counter)s job ended uncertain"
+msgid_plural "%(counter)s jobs ended uncertain"
+msgstr[0] "%(counter)s 个任务以不确定状态结束"
+
+#: computes/templates/computes/attention.html:32
+#, python-format
+msgid "%(counter)s job queued for over an hour"
+msgid_plural "%(counter)s jobs queued for over an hour"
+msgstr[0] "%(counter)s 个任务排队超过一小时"
+
#: computes/templates/computes/balance.html:11
#: computes/templates/computes/list.html:6
#: computes/templates/computes/list.html:14 templates/navbar.html:18
@@ -2275,7 +2330,7 @@ msgstr[0] "%(counter)s 个 vCPU"
#: computes/templates/computes/balance.html:33
#: computes/templates/computes/balance.html:36
#: computes/templates/computes/capacity_vcpus.html:4
-#: computes/templates/computes/list.html:42
+#: computes/templates/computes/list.html:43
#, python-format
msgid "on %(counter)s CPU"
msgid_plural "on %(counter)s CPUs"
@@ -2446,7 +2501,7 @@ msgid_plural ""
msgstr[0] "已分配给虚拟机:%(counter)s 个 vCPU(%(ratio)s:1),%(assigned)s 内存。"
#: computes/templates/computes/capacity_line.txt:4
-#: computes/templates/computes/list.html:102
+#: computes/templates/computes/list.html:103
#: computes/templates/overview.html:127
msgid "The capacity could not be read."
msgstr "无法读取容量。"
@@ -2477,7 +2532,7 @@ msgstr "占主机 %(memory)s 中的 %(stopped)s"
#: computes/templates/computes/capacity_memory.html:18
#: computes/templates/computes/capacity_vcpus.html:18
-#: computes/templates/computes/list.html:93
+#: computes/templates/computes/list.html:94
#, python-format
msgid "%(running)s running"
msgstr "运行中 %(running)s"
@@ -2589,7 +2644,7 @@ msgstr "主机栏目"
#: computes/templates/computes/host_nav.html:7
#: computes/templates/computes/host_nav.html:8
-#: computes/templates/computes/list.html:111 computes/templates/overview.html:7
+#: computes/templates/computes/list.html:112 computes/templates/overview.html:7
msgid "Overview"
msgstr "概览"
@@ -2662,7 +2717,7 @@ msgid "Problem occurred with host %(name)s: %(error)s"
msgstr "主机 %(name)s 出现问题:%(error)s"
#: computes/templates/computes/instances.html:44
-#: computes/templates/computes/list.html:19
+#: computes/templates/computes/list.html:20
msgid "Warning"
msgstr "警告"
@@ -2674,32 +2729,32 @@ msgstr "虚拟机管理程序中没有任何虚拟机"
msgid "VCPU"
msgstr "VCPU"
-#: computes/templates/computes/list.html:19
+#: computes/templates/computes/list.html:20
msgid "You don't have any computes"
msgstr "您还没有任何计算节点"
-#: computes/templates/computes/list.html:28
+#: computes/templates/computes/list.html:29
msgid "connected"
msgstr "已连接"
-#: computes/templates/computes/list.html:35
+#: computes/templates/computes/list.html:36
msgid "running"
msgstr "运行中"
-#: computes/templates/computes/list.html:40
+#: computes/templates/computes/list.html:41
msgid "vCPUs given"
msgstr "已分配 vCPU"
-#: computes/templates/computes/list.html:47
+#: computes/templates/computes/list.html:48
msgid "Memory given"
msgstr "已分配内存"
-#: computes/templates/computes/list.html:49
+#: computes/templates/computes/list.html:50
#, python-format
msgid "of %(memory)s"
msgstr "共 %(memory)s"
-#: computes/templates/computes/list.html:75 computes/templates/overview.html:34
+#: computes/templates/computes/list.html:76 computes/templates/overview.html:34
#: console/templates/console-vnc.html:13
#: console/templates/console-xterm.html:16
#: instances/templates/allinstances_index_grouped.html:36
@@ -2708,38 +2763,38 @@ msgstr "共 %(memory)s"
msgid "Connected"
msgstr "已连接"
-#: computes/templates/computes/list.html:77 computes/templates/overview.html:36
+#: computes/templates/computes/list.html:78 computes/templates/overview.html:36
#: instances/templates/allinstances_index_grouped.html:38
msgid "Not connected"
msgstr "未连接"
-#: computes/templates/computes/list.html:80
+#: computes/templates/computes/list.html:81
msgid "In maintenance"
msgstr "维护中"
-#: computes/templates/computes/list.html:80
+#: computes/templates/computes/list.html:81
msgid "Maintenance requested"
msgstr "已请求维护"
-#: computes/templates/computes/list.html:102
+#: computes/templates/computes/list.html:103
msgid "No capacity while the host cannot be reached."
msgstr "无法连接主机时不显示容量。"
-#: computes/templates/computes/list.html:112
+#: computes/templates/computes/list.html:113
#: computes/templates/overview.html:24 computes/templates/overview.html:78
msgid "Edit connection"
msgstr "编辑连接"
-#: computes/templates/computes/list.html:114
+#: computes/templates/computes/list.html:115
#: computes/templates/overview.html:25
msgid "Remove from panel"
msgstr "从面板中移除"
-#: computes/templates/computes/list.html:126
+#: computes/templates/computes/list.html:127
msgid "No host matches the filters."
msgstr "没有主机匹配这些筛选条件。"
-#: computes/templates/computes/list.html:127
+#: computes/templates/computes/list.html:128
#: instances/templates/allinstances.html:71
msgid "Clear the filters"
msgstr "清除筛选"
@@ -2972,21 +3027,21 @@ msgid ""
"/etc/default/webvirt-gstfsd"
msgstr "请输入主机 /etc/default/webvirt-gstfsd 中 GSTFSD_KEY 的 64 个十六进制字符"
-#: computes/views.py:155
+#: computes/views.py:168
#, python-format
msgid "The host did not answer within %(seconds)s seconds"
msgstr "主机未在 %(seconds)s 秒内响应"
-#: computes/views.py:360
+#: computes/views.py:396
msgid "No other host has room for it"
msgstr "没有其他主机能容纳它"
-#: computes/views.py:439
+#: computes/views.py:475
#, python-format
msgid "The host was saved, but the panel cannot connect to it: %(error)s"
msgstr "主机已保存,但面板无法连接到它:%(error)s"
-#: computes/views.py:512
+#: computes/views.py:548
#, python-format
msgid ""
"Its VMs keep running on the host and leave the panel; their owners are kept "
diff --git a/vmbackups/templates/vmbackups/index.html b/vmbackups/templates/vmbackups/index.html
index f9acacd8..cc117b10 100644
--- a/vmbackups/templates/vmbackups/index.html
+++ b/vmbackups/templates/vmbackups/index.html
@@ -34,6 +34,7 @@
+
diff --git a/vmbackups/views.py b/vmbackups/views.py
index 24c243b8..6b67e82c 100644
--- a/vmbackups/views.py
+++ b/vmbackups/views.py
@@ -205,6 +205,8 @@ def index(request):
rows = rows.filter(target_id=int(target))
if state in dict(Backup.STATES):
rows = rows.filter(state=state)
+ elif state == "damaged": # ready, but a verification found damage
+ rows = rows.filter(state=Backup.READY).exclude(damage=[])
# schedules add a backup of each VM a night: the list is read a page at a time, as the jobs are
page = Paginator(rows, 50).get_page(request.GET.get("page"))
return render(request, "vmbackups/index.html", {
diff --git a/vrtManager/hostdetails.py b/vrtManager/hostdetails.py
index b358e574..ef53e2bf 100644
--- a/vrtManager/hostdetails.py
+++ b/vrtManager/hostdetails.py
@@ -1,8 +1,12 @@
import time
+from contextlib import suppress
+from datetime import datetime, timezone
from libvirt import (
libvirtError,
VIR_CONNECT_GET_ALL_DOMAINS_STATS_NOWAIT,
+ VIR_CONNECT_LIST_DOMAINS_HAS_SNAPSHOT,
+ VIR_CONNECT_LIST_STORAGE_POOLS_ACTIVE,
VIR_ERR_NO_DOMAIN,
VIR_DOMAIN_BLOCKED,
VIR_DOMAIN_PAUSED,
@@ -51,6 +55,31 @@ def cpu_version(doc):
class wvmHostDetails(wvmConnect):
+ def get_attention(self, pool_percent, snapshot_before):
+ """What wants a look on the host: its active pools filled to
+ pool_percent or more, as last measured (a refresh scans each pool),
+ and per VM the count of its snapshots taken before snapshot_before
+ (aware). A VM gone meanwhile is passed over."""
+ pools = []
+ for pool in self.wvm.listAllStoragePools(VIR_CONNECT_LIST_STORAGE_POOLS_ACTIVE):
+ try:
+ _state, capacity, allocation, _available = pool.info()
+ except libvirtError: # undefined meanwhile
+ continue
+ if capacity and allocation * 100 / capacity >= pool_percent:
+ pools.append({"name": pool.name(), "percent": round(allocation * 100 / capacity)})
+ snapshots = []
+ for domain in self.wvm.listAllDomains(VIR_CONNECT_LIST_DOMAINS_HAS_SNAPSHOT):
+ count = 0
+ with suppress(libvirtError): # the VM gone meanwhile
+ for snap in domain.listAllSnapshots(0):
+ with suppress(libvirtError): # the snapshot deleted meanwhile
+ taken = int(etree.fromstring(snap.getXMLDesc(0)).findtext("creationTime"))
+ count += datetime.fromtimestamp(taken, timezone.utc) < snapshot_before
+ if count:
+ snapshots.append({"vm": domain.name(), "count": count})
+ return {"pools": pools, "snapshots": snapshots}
+
def get_memory_usage(self):
"""
Function return memory usage on node.