1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-12-03 09:26:03 +00:00

fix(computes): the Balance page shows each host's load as bars

The page was a bare table of rounded GiB totals, a footnote shown also
when nothing would move, three tables with their own columns and a
Migrate button far below the list. Now:

- a breadcrumb back to Computes and a one-line description;
- a card per host with its running VMs' memory and vCPUs now and after,
  as bars on one scale, so the imbalance and its fix show at a glance;
- the proposed migrations in one card, "host -> destination" in one
  column, sizes as on the Computes page, and the number at once with a
  "Migrate N VMs" button in its footer;
- the VMs that stay (kept by the user, or unable to move) in one table
  with the reason;
- a success message when the hosts are balanced.

The VM boxes join the proposal's form by their form attribute, so the
migrations' form holds the list.
This commit is contained in:
catborise 2026-11-16 08:11:47 +03:00
parent 4941a8a048
commit 1259c11591
10 changed files with 349 additions and 258 deletions

View file

@ -2,124 +2,132 @@
{% load i18n %}
{% load static %}
{% load operations %}
{% load bootstrap_icons %}
{% block title %}{% trans "Balance" %}{% endblock %}
{% block page_heading %}{% trans "Balance" %}{% endblock page_heading %}
{% block content %}
<p class="text-body-secondary">{% trans "Migrations of running VMs that even out the memory, then the vCPUs, the hosts give their running VMs. Each VM migrates live in a job of its own; one that fails or stops meanwhile stays where it is." %}</p>
<nav aria-label="breadcrumb">
<ol class="breadcrumb shadow-sm">
<li class="breadcrumb-item"><a href="{% url 'computes' %}">{% bs_icon 'hdd-rack' %} {% trans "Computes" %}</a></li>
<li class="breadcrumb-item active fw-bold" aria-current="page">{% trans "Balance" %}</li>
</ol>
</nav>
<p class="text-body-secondary">{% trans "Migrations that share the memory, then the vCPUs, of running VMs evenly among the hosts." %}</p>
{% if unreachable %}
<div class="alert alert-warning shadow-sm">{% trans "These hosts cannot be read and are left out:" %} {{ unreachable|join:", " }}</div>
{% endif %}
<div class="table-responsive">
<table class="table align-middle w-auto">
<thead>
<tr>
<th scope="col">{% trans "Host" %}</th>
<th scope="col" class="text-end">{% trans "Memory" %}</th>
<th scope="col" class="text-end">{% trans "VCPU" %}</th>
</tr>
</thead>
<tbody>
{% for host in hosts %}
<tr>
<td>{{ host.name }}</td>
<td class="text-end text-nowrap">{% widthratio host.before.0 1048576 1 %} GiB{% if host.after.0 != host.before.0 %} &rarr; <strong>{% widthratio host.after.0 1048576 1 %} GiB</strong>{% endif %}</td>
<td class="text-end text-nowrap">{{ host.before.1 }}{% if host.after.1 != host.before.1 %} &rarr; <strong>{{ host.after.1 }}</strong>{% endif %}</td>
</tr>
{% endfor %}
</tbody>
</table>
{# each host's running VMs: memory now and, light to dark, after the migrations; all bars on one scale #}
<div class="row row-cols-1 row-cols-md-2 row-cols-xl-3 g-3 mb-4">
{% for host in hosts %}
<div class="col">
<div class="card h-100 shadow-sm"><div class="card-body">
<div class="fw-semibold mb-2">{{ host.name }}</div>
{% for bar in host.bars %}{% if forloop.first or moves %}
{% if forloop.first %}{% with memory=host.before.0 vcpus=host.before.1 %}
<div class="d-flex justify-content-between small"><span class="text-body-secondary">{% if moves %}{% trans "Now" %}{% else %}{% trans "Running VMs" %}{% endif %}</span>
<span>{% widthratio memory 1 1024 as bytes %}{{ bytes|filesizeformat }}, {% blocktrans count counter=vcpus %}{{ counter }} vCPU{% plural %}{{ counter }} vCPUs{% endblocktrans %}</span></div>
{% endwith %}{% else %}{% with memory=host.after.0 vcpus=host.after.1 %}
<div class="d-flex justify-content-between small mt-2"><span class="text-body-secondary">{% trans "After" %}</span>
<span class="fw-semibold">{% widthratio memory 1 1024 as bytes %}{{ bytes|filesizeformat }}, {% blocktrans count counter=vcpus %}{{ counter }} vCPU{% plural %}{{ counter }} vCPUs{% endblocktrans %}</span></div>
{% endwith %}{% endif %}
<div class="progress" role="progressbar" style="--bs-progress-height: 0.6rem;" aria-label="{% if forloop.first %}{% trans "Memory now" %}{% else %}{% trans "Memory after" %}{% endif %}"
aria-valuenow="{{ bar|floatformat:0 }}" aria-valuemin="0" aria-valuemax="100">
<div class="progress-bar bg-primary{% if forloop.first and moves %} bg-opacity-50{% endif %}" style="width: {{ bar|stringformat:".1f" }}%"></div>
</div>
{% endif %}{% endfor %}
</div></div>
</div>
{% endfor %}
</div>
<p class="small text-body-secondary">{% trans "After: if every migration below succeeds." %}</p>
{# unticking a VM keeps it where it is and makes the proposal again #}
<form method="get" id="balance-form">
{% for instance in moves %}<input type="hidden" name="shown" value="{{ instance.pk }}">{% endfor %}
{% for instance in pinned %}<input type="hidden" name="shown" value="{{ instance.pk }}">{% endfor %}
{% if moves %}
</form>
{% if moves %}
<form method="post" class="card shadow-sm mb-4">{% csrf_token %}{% submission_key %}
<div class="card-header fw-semibold">{% blocktrans count counter=moves|length %}Proposed migration ({{ counter }}){% plural %}Proposed migrations ({{ counter }}){% endblocktrans %}</div>
<div class="table-responsive">
<table class="table table-hover align-middle">
<table class="table table-hover align-middle mb-0">
<thead>
<tr>
<th scope="col"><input class="form-check-input" type="checkbox" id="balance-all"{% if not pinned %} checked{% endif %} aria-label="{% trans "Select all" %}" title="{% trans "Select all" %}"></th>
<th scope="col" class="ps-3"><input class="form-check-input" type="checkbox" id="balance-all" form="balance-form"{% if not pinned %} checked{% endif %} aria-label="{% trans "Select all" %}" title="{% trans "Select all" %}"></th>
<th scope="col">{% trans "Name" %}</th>
<th scope="col">{% trans "VCPU" %}</th>
<th scope="col" class="text-end">{% trans "Memory" %}</th>
<th scope="col">{% trans "Host" %}</th>
<th scope="col">{% trans "Destination" %}</th>
<th scope="col" class="text-end">vCPU</th>
<th scope="col">{% trans "Migration" %}</th>
</tr>
</thead>
<tbody>
{% for instance in moves %}
<tr>
<td><input class="form-check-input" type="checkbox" name="vm" value="{{ instance.pk }}" id="balance-{{ instance.pk }}" checked></td>
<td><label for="balance-{{ instance.pk }}">{{ instance.name }}</label></td>
<td>{{ instance.info.3 }}</td>
<td class="text-end">{% widthratio instance.info.2 1024 1 %} MiB</td>
<td>{{ instance.compute.name }}</td>
<td>{{ instance.target.name }}</td>
<td class="ps-3"><input class="form-check-input" type="checkbox" name="vm" value="{{ instance.pk }}" id="balance-{{ instance.pk }}" form="balance-form" checked></td>
<td><label for="balance-{{ instance.pk }}">{{ instance.name }}</label>
<input type="hidden" name="instance" value="{{ instance.pk }}">
<input type="hidden" name="source" value="{{ instance.compute_id }}">
<input type="hidden" name="target" value="{{ instance.target.pk }}"></td>
<td class="text-end text-nowrap">{% widthratio instance.info.2 1 1024 as bytes %}{{ bytes|filesizeformat }}</td>
<td class="text-end">{{ instance.info.3 }}</td>
<td>{{ instance.compute.name }} {% bs_icon 'arrow-right' %} {{ instance.target.name }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
<div class="alert alert-info shadow-sm">{% trans "No migration would even out the hosts more." %}</div>
{% endif %}
{% if pinned %}
<h5>{% trans "Stay where they are" %}</h5>
<div class="card-footer d-flex flex-wrap align-items-center gap-2">
{% if parallel %}
<label class="small text-body-secondary" for="balance-parallel">{% trans "Migrations at once" %}</label>
<select name="parallel" id="balance-parallel" class="form-select form-select-sm w-auto">
{% for n in parallel %}<option value="{{ n }}"{% if forloop.last %} selected{% endif %}>{{ n }}</option>{% endfor %}
</select>
{% blocktrans count counter=moves|length asvar label %}Migrate {{ counter }} VM{% plural %}Migrate {{ counter }} VMs{% endblocktrans %}
<button type="submit" class="btn btn-primary ms-auto" data-confirm="{% trans "Migrate the VMs listed?" %}">{{ label }}</button>
{% else %}
<span class="small text-warning-emphasis">{% trans "The worker runs one job at a time: set Worker Concurrency to 2 or more on the Settings page." %}</span>
{% endif %}
</div>
</form>
{% else %}
<div class="alert alert-success shadow-sm">{% trans "The hosts are balanced: no migration would even them out more." %}</div>
{% endif %}
{% if pinned or unmovable %}
<div class="card shadow-sm">
<div class="card-header fw-semibold">{% trans "Stay where they are" %}</div>
<div class="table-responsive">
<table class="table align-middle">
<table class="table align-middle mb-0">
<thead>
<tr>
<th scope="col" class="ps-3"><span class="visually-hidden">{% trans "Let it move" %}</span></th>
<th scope="col">{% trans "Name" %}</th>
<th scope="col">{% trans "Host" %}</th>
<th scope="col">{% trans "Why" %}</th>
</tr>
</thead>
<tbody>
{% for instance in pinned %}
<tr>
<td><input class="form-check-input" type="checkbox" name="vm" value="{{ instance.pk }}" id="balance-{{ instance.pk }}" aria-label="{% trans "Let it move" %}" title="{% trans "Let it move" %}"></td>
<td class="ps-3"><input class="form-check-input" type="checkbox" name="vm" value="{{ instance.pk }}" id="balance-{{ instance.pk }}" form="balance-form" aria-label="{% trans "Let it move" %}" title="{% trans "Let it move" %}"></td>
<td><label for="balance-{{ instance.pk }}">{{ instance.name }}</label></td>
<td>{{ instance.compute.name }}</td>
<td class="small text-body-secondary">{% trans "You kept it here: tick it to let it move" %}</td>
</tr>
{% endfor %}
{% for instance in unmovable %}
<tr>
<td class="ps-3"></td>
<td>{{ instance.name }}</td>
<td>{{ instance.compute.name }}</td>
<td class="small text-body-secondary">{% for refusal in instance.refusals %}{{ refusal }}{% if not forloop.last %}<br>{% endif %}{% endfor %}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endif %}
</form>
{% if unmovable %}
<h5>{% trans "Cannot move" %}</h5>
<div class="table-responsive">
<table class="table align-middle">
<tbody>
{% for instance in unmovable %}
<tr>
<td>{{ instance.name }}</td>
<td>{{ instance.compute.name }}</td>
<td class="small text-danger">{% for refusal in instance.refusals %}{{ refusal }}{% if not forloop.last %}<br>{% endif %}{% endfor %}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endif %}
{% if moves %}
{% if not parallel %}
<div class="alert alert-warning shadow-sm">{% trans "The worker runs one job at a time: set Worker Concurrency to 2 or more on the Settings page." %}</div>
{% else %}
<form method="post">{% csrf_token %}{% submission_key %}
{% for instance in moves %}
<input type="hidden" name="instance" value="{{ instance.pk }}">
<input type="hidden" name="source" value="{{ instance.compute_id }}">
<input type="hidden" name="target" value="{{ instance.target.pk }}">
{% endfor %}
<div class="mb-3">
<label class="form-label" for="balance-parallel">{% trans "Migrations at once" %}</label>
<select name="parallel" id="balance-parallel" class="form-select w-auto">
{% for n in parallel %}<option value="{{ n }}"{% if forloop.last %} selected{% endif %}>{{ n }}</option>{% endfor %}
</select>
</div>
<button type="submit" class="btn btn-primary" data-confirm="{% trans "Migrate the VMs listed?" %}">{% trans "Migrate" %}</button>
</form>
{% endif %}
{% endif %}
{% endblock %}
{% block script %}
<script src="{% static 'js/balance.js' %}"></script>

View file

@ -106,7 +106,8 @@ class BalancePageTests(TestCase):
def test_a_vm_with_a_disk_the_hosts_do_not_share_cannot_move_and_still_counts(self):
page = self.page()
self.assertIn("ba-local", page.xpath("//h5[.='Cannot move']/following-sibling::div[1]")[0].text_content())
(row,) = [row for row in page.xpath("//tr") if "ba-local" in row.text_content()]
self.assertIn("not on storage both hosts share", row.text_content())
host = next(host for host in self.response.context["hosts"] if host == self.compute)
self.assertEqual(host.before, [3 * 128 * 1024, 3]) # the shut-off VM is not counted
self.assertNotIn(str(self.vms["ba-off"].pk), page.xpath("//input[@name='vm' or @name='instance']/@value"))

View file

@ -12,18 +12,18 @@ SCRIPT = Path(__file__).resolve().parents[2] / "static" / "js" / "balance.js"
RUN = """
const vm = require("vm");
const boxes = [{name: "moves", checked: true}, {name: "stays", checked: false}];
const boxes = [{name: "vm", id: "moves", checked: true}, {name: "vm", id: "stays", checked: false}];
let handler, submitted = 0;
const form = {
const form = {elements: boxes, submit: () => { submitted += 1; }};
const other = {elements: [], submit: () => { throw new Error("another form"); }};
vm.runInNewContext(SCRIPT, vm.createContext({document: {
getElementById: () => form,
addEventListener: (name, fn) => { handler = fn; },
querySelectorAll: () => boxes,
submit: () => { submitted += 1; },
};
vm.runInNewContext(SCRIPT, vm.createContext({document: {getElementById: () => form}}));
}}));
const seen = [];
for (const [id, checked] of STEPS) {
handler({target: {id, checked}});
seen.push(boxes.filter((b) => b.checked).map((b) => b.name));
for (const [id, checked, owner] of STEPS) {
handler({target: {id, checked, form: owner === "other" ? other : form}});
seen.push(boxes.filter((b) => b.checked).map((b) => b.id));
}
console.log(JSON.stringify({seen, submitted}));
"""
@ -40,6 +40,9 @@ class BalanceScriptTests(unittest.TestCase):
def test_a_vm_box_makes_the_proposal_again(self):
self.assertEqual(self.run_script([["balance-7", False]]), {"seen": [["moves"]], "submitted": 1})
def test_a_change_outside_the_proposal_does_not_reload_it(self):
self.assertEqual(self.run_script([["balance-parallel", True, "other"]])["submitted"], 0)
def test_select_all_ticks_or_unticks_every_vm_and_makes_the_proposal_again(self):
result = self.run_script([["balance-all", True], ["balance-all", False]])
self.assertEqual(result, {"seen": [["moves", "stays"], []], "submitted": 2})

View file

@ -341,8 +341,11 @@ def balance(request):
room = {pk: (compute.shown_capacity["memory"] - compute.shown_capacity["assigned"]["running"]) // 1024
for pk, compute in hosts.items()}
moves, after = propose(loads, movable, room)
# the bars of each host's memory before and after, on the scale of the largest
scale = max([load[0] for load in (*loads.values(), *after.values())] + [1])
for pk, compute in hosts.items():
compute.before, compute.after = loads[pk], after[pk]
compute.bars = [load[0] * 100 / scale for load in (loads[pk], after[pk])]
by_pk = {instance.pk: instance for instance in running}
for vm, _source, target in moves:
by_pk[vm].target = hosts[target]

Binary file not shown.

View file

@ -11,7 +11,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-11-16 04:31+0000\n"
"POT-Creation-Date: 2026-11-16 05:10+0000\n"
"PO-Revision-Date: 2020-11-04 12:00+0000\n"
"Last-Translator: catborise <muhammetalisag@gmail.com>, 2020\n"
"Language-Team: Turkish (https://www.transifex.com/catborise/teams/110663/tr/)\n"
@ -64,7 +64,8 @@ msgstr "Açık anahtar zaten mevcut"
msgid "Invalid key"
msgstr "Geçersiz anahtar"
#: accounts/forms.py:95 computes/templates/computes/balance.html:45
#: accounts/forms.py:95 computes/templates/computes/balance.html:57
#: computes/templates/computes/balance.html:104
#: computes/templates/computes/bulk_migrate.html:45
#: computes/templates/computes/instances.html:46
#: instances/templates/add_instance_volume.html:39
@ -237,7 +238,7 @@ msgid "Add VM"
msgstr "Sanal makine ekle"
#: accounts/templates/account.html:68 admin/templates/admin/logs.html:40
#: computes/templates/computes/balance.html:17
#: computes/templates/computes/balance.html:105
#: computes/templates/computes/list.html:59
#: instances/templates/allinstances.html:108
#: instances/templates/allinstances_index_nongrouped.html:8
@ -770,8 +771,7 @@ msgstr ""
msgid "vCPUs"
msgstr "vCPU"
#: admin/forms.py:209 computes/templates/computes/balance.html:18
#: computes/templates/computes/balance.html:47
#: admin/forms.py:209 computes/templates/computes/balance.html:58
#: computes/templates/computes/bulk_migrate.html:48
#: computes/templates/computes/instances.html:50
#: computes/templates/computes/list.html:62 computes/templates/overview.html:66
@ -1985,8 +1985,8 @@ msgstr ""
msgid "Bulk migrate"
msgstr "Toplu taşıma"
#: computes/jobs.py:171 computes/templates/computes/balance.html:5
#: computes/templates/computes/balance.html:6
#: computes/jobs.py:171 computes/templates/computes/balance.html:6
#: computes/templates/computes/balance.html:12
#: computes/templates/computes/list.html:12
msgid "Balance"
msgstr "Dengele"
@ -2064,65 +2064,87 @@ msgstr ""
"Bu, VM'lerinin bulunduğu sunucudan başka bir sunucu: yeni bir sunucu olarak "
"ekleyin"
#: computes/templates/computes/balance.html:9
msgid ""
"Migrations of running VMs that even out the memory, then the vCPUs, the hosts"
" give their running VMs. Each VM migrates live in a job of its own; one that "
"fails or stops meanwhile stays where it is."
msgstr ""
"Sunucuların çalışan sanal makinelere verdiği belleği, ardından vCPU'ları "
"eşitleyen taşımalar. Her sanal makine kendi işinde canlı taşınır; başarısız "
"olan ya da bu arada duran sanal makine olduğu yerde kalır."
#: computes/templates/computes/balance.html:11
#: computes/templates/computes/list.html:6
#: computes/templates/computes/list.html:14 templates/navbar.html:18
msgid "Computes"
msgstr "Sunucular"
#: computes/templates/computes/balance.html:15
msgid ""
"Migrations that share the memory, then the vCPUs, of running VMs evenly among"
" the hosts."
msgstr ""
"Çalışan sanal makinelerin belleğini, ardından vCPU'larını sunuculara eşit "
"dağıtan taşımalar."
#: computes/templates/computes/balance.html:17
msgid "These hosts cannot be read and are left out:"
msgstr "Bu sunucular okunamıyor ve hesaba katılmadı:"
#: computes/templates/computes/balance.html:19
#: computes/templates/computes/balance.html:46
#: computes/templates/computes/bulk_migrate.html:47
#: computes/templates/computes/instances.html:49
msgid "VCPU"
msgstr "VCPU"
#: computes/templates/computes/balance.html:28
#: instances/templates/instances/snapshots_tab.html:18
msgid "Now"
msgstr "Şimdi"
#: computes/templates/computes/balance.html:33
msgid "After: if every migration below succeeds."
msgstr "Sonrası: aşağıdaki taşımaların hepsi başarılı olursa."
#: computes/templates/computes/balance.html:28
msgid "Running VMs"
msgstr "Çalışan sanal makineler"
#: computes/templates/computes/balance.html:44
#: computes/templates/computes/balance.html:29
#: computes/templates/computes/balance.html:32
#: computes/templates/computes/capacity_vcpus.html:4
#, python-format
msgid "%(counter)s vCPU"
msgid_plural "%(counter)s vCPUs"
msgstr[0] "%(counter)s vCPU"
msgstr[1] "%(counter)s vCPU"
#: computes/templates/computes/balance.html:31
msgid "After"
msgstr "Sonra"
#: computes/templates/computes/balance.html:34
msgid "Memory now"
msgstr "Şimdiki bellek"
#: computes/templates/computes/balance.html:34
msgid "Memory after"
msgstr "Sonraki bellek"
#: computes/templates/computes/balance.html:51
#, python-format
msgid "Proposed migration (%(counter)s)"
msgid_plural "Proposed migrations (%(counter)s)"
msgstr[0] "Önerilen taşımalar (%(counter)s)"
msgstr[1] "Önerilen taşımalar (%(counter)s)"
#: computes/templates/computes/balance.html:56
#: computes/templates/computes/bulk_migrate.html:44
msgid "Select all"
msgstr "Tümünü seç"
#: computes/templates/computes/balance.html:48
#: instances/templates/instances/settings_tab.html:527
#: networks/templates/network.html:396
msgid "From"
msgstr "Başlangıç"
#: computes/templates/computes/balance.html:60
msgid "Migration"
msgstr "Taşıma"
#: computes/templates/computes/balance.html:49
#: instances/templates/instances/settings_tab.html:532
#: networks/templates/network.html:400
msgid "To"
msgstr "Bitiş"
#: computes/templates/computes/balance.html:81
#: computes/templates/computes/bulk_migrate.html:70
msgid "Migrations at once"
msgstr "Aynı anda taşıma"
#: computes/templates/computes/balance.html:67
msgid "No migration would even out the hosts more."
msgstr "Sunucuları daha fazla dengeleyecek bir taşıma yok."
#: computes/templates/computes/balance.html:85
#, python-format
msgid "Migrate %(counter)s VM"
msgid_plural "Migrate %(counter)s VMs"
msgstr[0] "%(counter)s sanal makineyi taşı"
msgstr[1] "%(counter)s sanal makineyi taşı"
#: computes/templates/computes/balance.html:70
msgid "Stay where they are"
msgstr "Yerinde kalanlar"
#: computes/templates/computes/balance.html:86
msgid "Migrate the VMs listed?"
msgstr "Listelenen sanal makineler taşınsın mı?"
#: computes/templates/computes/balance.html:76
msgid "Let it move"
msgstr "Taşınabilsin"
#: computes/templates/computes/balance.html:87
msgid "Cannot move"
msgstr "Taşınamayanlar"
#: computes/templates/computes/balance.html:105
#: computes/templates/computes/balance.html:88
#: computes/templates/computes/bulk_migrate.html:30
msgid ""
"The worker runs one job at a time: set Worker Concurrency to 2 or more on the"
@ -2131,22 +2153,26 @@ msgstr ""
"İş yürütücü aynı anda tek iş çalıştırıyor: Ayarlar sayfasında Eş zamanlı iş "
"sayısı değerini 2 veya daha fazla yapın."
#: computes/templates/computes/balance.html:114
#: computes/templates/computes/bulk_migrate.html:70
msgid "Migrations at once"
msgstr "Aynı anda taşıma"
#: computes/templates/computes/balance.html:93
msgid "The hosts are balanced: no migration would even them out more."
msgstr "Sunucular dengeli: onları daha fazla dengeleyecek bir taşıma yok."
#: computes/templates/computes/balance.html:119
msgid "Migrate the VMs listed?"
msgstr "Listelenen sanal makineler taşınsın mı?"
#: computes/templates/computes/balance.html:98
msgid "Stay where they are"
msgstr "Yerinde kalanlar"
#: computes/templates/computes/balance.html:119
#: computes/templates/computes/bulk_migrate.html:76
#: instances/templates/instances/settings_tab.html:60
#: instances/templates/instances/settings_tab.html:617
#: instances/templates/instances/settings_tab.html:620
msgid "Migrate"
msgstr "Taşı"
#: computes/templates/computes/balance.html:103
#: computes/templates/computes/balance.html:112
msgid "Let it move"
msgstr "Taşınabilsin"
#: computes/templates/computes/balance.html:106
msgid "Why"
msgstr "Neden"
#: computes/templates/computes/balance.html:115
msgid "You kept it here: tick it to let it move"
msgstr "Yerinde tuttunuz: taşınabilmesi için işaretleyin"
#: computes/templates/computes/bulk_migrate.html:5
#: computes/templates/computes/bulk_migrate.html:6
@ -2186,6 +2212,11 @@ msgstr "Kapalı sanal makineleri de taşı"
msgid "Status"
msgstr "Durum"
#: computes/templates/computes/bulk_migrate.html:47
#: computes/templates/computes/instances.html:49
msgid "VCPU"
msgstr "VCPU"
#: computes/templates/computes/bulk_migrate.html:75
#, python-format
msgid "Migrate the chosen VMs from %(source)s to %(dest)s?"
@ -2193,6 +2224,13 @@ msgstr ""
"Seçilen sanal makineler %(source)s sunucusundan %(dest)s sunucusuna taşınsın "
"mı?"
#: computes/templates/computes/bulk_migrate.html:76
#: instances/templates/instances/settings_tab.html:60
#: instances/templates/instances/settings_tab.html:617
#: instances/templates/instances/settings_tab.html:620
msgid "Migrate"
msgstr "Taşı"
#: computes/templates/computes/capacity_line.txt:2
#, python-format
msgid "Given to VMs: %(counter)s vCPU (%(ratio)s:1), %(assigned)s memory."
@ -2258,13 +2296,6 @@ msgid_plural "%(counter)s more pools"
msgstr[0] "%(counter)s havuz daha"
msgstr[1] "%(counter)s havuz daha"
#: computes/templates/computes/capacity_vcpus.html:4
#, python-format
msgid "%(counter)s vCPU"
msgid_plural "%(counter)s vCPUs"
msgstr[0] "%(counter)s vCPU"
msgstr[1] "%(counter)s vCPU"
#: computes/templates/computes/capacity_vcpus.html:4
#: computes/templates/computes/list.html:42
#, python-format
@ -2455,11 +2486,6 @@ msgstr "Hipervizör üzerinde hiç sanal makine yok"
msgid "Actions"
msgstr "Eylemler"
#: computes/templates/computes/list.html:6
#: computes/templates/computes/list.html:14 templates/navbar.html:18
msgid "Computes"
msgstr "Sunucular"
#: computes/templates/computes/list.html:19
msgid "You don't have any computes"
msgstr "Hiç sunucunuz yok"
@ -2698,12 +2724,12 @@ msgstr ""
"Bir disk dosyası iki sunucunun paylaştığı depolamada değil: sanal makineyi "
"kendi sayfasından taşıyın"
#: computes/views.py:359
#: computes/views.py:366
#, 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:415
#: computes/views.py:422
#, python-format
msgid ""
"Its VMs keep running on the host and leave the panel; their owners are kept "
@ -5617,6 +5643,16 @@ msgstr "Sanal makinenin sunucu aygıtı yok."
msgid "Migration route"
msgstr "Taşıma yolu"
#: instances/templates/instances/settings_tab.html:527
#: networks/templates/network.html:396
msgid "From"
msgstr "Başlangıç"
#: instances/templates/instances/settings_tab.html:532
#: networks/templates/network.html:400
msgid "To"
msgstr "Bitiş"
#: instances/templates/instances/settings_tab.html:541
msgid ""
"The VM is running: it migrates live, or paused for the transfer when Live "
@ -6042,10 +6078,6 @@ msgstr ""
"Bu sanal makinede bir disk işi çalışıyor; bitene kadar anlık görüntü "
"işlemleri kullanılamaz."
#: instances/templates/instances/snapshots_tab.html:18
msgid "Now"
msgstr "Şimdi"
#: instances/templates/instances/snapshots_tab.html:20
#: instances/templates/instances/snapshots_tab.html:31
msgid "Take a snapshot"

Binary file not shown.

View file

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-11-16 04:31+0000\n"
"POT-Creation-Date: 2026-11-16 05:10+0000\n"
"PO-Revision-Date: \n"
"Last-Translator: \n"
"Language-Team: \n"
@ -61,7 +61,8 @@ msgstr "公钥已存在"
msgid "Invalid key"
msgstr "无效的密钥"
#: accounts/forms.py:95 computes/templates/computes/balance.html:45
#: accounts/forms.py:95 computes/templates/computes/balance.html:57
#: computes/templates/computes/balance.html:104
#: computes/templates/computes/bulk_migrate.html:45
#: computes/templates/computes/instances.html:46
#: instances/templates/add_instance_volume.html:39
@ -232,7 +233,7 @@ msgid "Add VM"
msgstr "添加虚拟机"
#: accounts/templates/account.html:68 admin/templates/admin/logs.html:40
#: computes/templates/computes/balance.html:17
#: computes/templates/computes/balance.html:105
#: computes/templates/computes/list.html:59
#: instances/templates/allinstances.html:108
#: instances/templates/allinstances_index_nongrouped.html:8
@ -747,8 +748,7 @@ msgstr "NEW_USER_DEFAULT_INSTANCES:%(name)s 已有所有者,且只允许一
msgid "vCPUs"
msgstr "vCPU"
#: admin/forms.py:209 computes/templates/computes/balance.html:18
#: computes/templates/computes/balance.html:47
#: admin/forms.py:209 computes/templates/computes/balance.html:58
#: computes/templates/computes/bulk_migrate.html:48
#: computes/templates/computes/instances.html:50
#: computes/templates/computes/list.html:62 computes/templates/overview.html:66
@ -1916,8 +1916,8 @@ msgstr "批量迁移已停止:已启动的迁移作为各自的任务继续进
msgid "Bulk migrate"
msgstr "批量迁移"
#: computes/jobs.py:171 computes/templates/computes/balance.html:5
#: computes/templates/computes/balance.html:6
#: computes/jobs.py:171 computes/templates/computes/balance.html:6
#: computes/templates/computes/balance.html:12
#: computes/templates/computes/list.html:12
msgid "Balance"
msgstr "均衡"
@ -1986,85 +1986,108 @@ msgstr "其虚拟机所在的主机尚不明确:请在面板通过当前连接
msgid "This is another host than the one its VMs are on: add it as a new host"
msgstr "这不是其虚拟机所在的主机:请将其添加为新主机"
#: computes/templates/computes/balance.html:9
msgid ""
"Migrations of running VMs that even out the memory, then the vCPUs, the hosts"
" give their running VMs. Each VM migrates live in a job of its own; one that "
"fails or stops meanwhile stays where it is."
msgstr ""
"迁移正在运行的虚拟机,使各主机分配给运行中虚拟机的内存(其次是 vCPU)趋于均衡。每台虚拟机在各自的任务中在线迁移;失败或期间停止的虚拟机留在原处。"
#: computes/templates/computes/balance.html:11
#: computes/templates/computes/list.html:6
#: computes/templates/computes/list.html:14 templates/navbar.html:18
msgid "Computes"
msgstr "计算节点"
#: computes/templates/computes/balance.html:15
msgid ""
"Migrations that share the memory, then the vCPUs, of running VMs evenly among"
" the hosts."
msgstr "在各主机之间均衡分配运行中虚拟机的内存(其次是 vCPU)的迁移。"
#: computes/templates/computes/balance.html:17
msgid "These hosts cannot be read and are left out:"
msgstr "以下主机无法读取,已排除:"
#: computes/templates/computes/balance.html:19
#: computes/templates/computes/balance.html:46
#: computes/templates/computes/bulk_migrate.html:47
#: computes/templates/computes/instances.html:49
msgid "VCPU"
msgstr "VCPU"
#: computes/templates/computes/balance.html:28
#: instances/templates/instances/snapshots_tab.html:18
msgid "Now"
msgstr "现在"
#: computes/templates/computes/balance.html:33
msgid "After: if every migration below succeeds."
msgstr "之后:假设下面的每次迁移都成功。"
#: computes/templates/computes/balance.html:28
msgid "Running VMs"
msgstr "运行中的虚拟机"
#: computes/templates/computes/balance.html:44
#: computes/templates/computes/balance.html:29
#: computes/templates/computes/balance.html:32
#: computes/templates/computes/capacity_vcpus.html:4
#, python-format
msgid "%(counter)s vCPU"
msgid_plural "%(counter)s vCPUs"
msgstr[0] "%(counter)s 个 vCPU"
#: computes/templates/computes/balance.html:31
msgid "After"
msgstr "之后"
#: computes/templates/computes/balance.html:34
msgid "Memory now"
msgstr "当前内存"
#: computes/templates/computes/balance.html:34
msgid "Memory after"
msgstr "迁移后内存"
#: computes/templates/computes/balance.html:51
#, python-format
msgid "Proposed migration (%(counter)s)"
msgid_plural "Proposed migrations (%(counter)s)"
msgstr[0] "建议的迁移(%(counter)s)"
#: computes/templates/computes/balance.html:56
#: computes/templates/computes/bulk_migrate.html:44
msgid "Select all"
msgstr "全选"
#: computes/templates/computes/balance.html:48
#: instances/templates/instances/settings_tab.html:527
#: networks/templates/network.html:396
msgid "From"
msgstr "源"
#: computes/templates/computes/balance.html:60
msgid "Migration"
msgstr "迁移"
#: computes/templates/computes/balance.html:49
#: instances/templates/instances/settings_tab.html:532
#: networks/templates/network.html:400
msgid "To"
msgstr "目标"
#: computes/templates/computes/balance.html:81
#: computes/templates/computes/bulk_migrate.html:70
msgid "Migrations at once"
msgstr "同时迁移数"
#: computes/templates/computes/balance.html:67
msgid "No migration would even out the hosts more."
msgstr "没有能让主机更均衡的迁移。"
#: computes/templates/computes/balance.html:85
#, python-format
msgid "Migrate %(counter)s VM"
msgid_plural "Migrate %(counter)s VMs"
msgstr[0] "迁移 %(counter)s 台虚拟机"
#: computes/templates/computes/balance.html:70
msgid "Stay where they are"
msgstr "留在原处"
#: computes/templates/computes/balance.html:86
msgid "Migrate the VMs listed?"
msgstr "迁移列出的虚拟机?"
#: computes/templates/computes/balance.html:76
msgid "Let it move"
msgstr "允许迁移"
#: computes/templates/computes/balance.html:87
msgid "Cannot move"
msgstr "无法迁移"
#: computes/templates/computes/balance.html:105
#: computes/templates/computes/balance.html:88
#: computes/templates/computes/bulk_migrate.html:30
msgid ""
"The worker runs one job at a time: set Worker Concurrency to 2 or more on the"
" Settings page."
msgstr "任务执行器一次只运行一个任务:请在设置页面将工作进程并发数设为 2 或更大。"
#: computes/templates/computes/balance.html:114
#: computes/templates/computes/bulk_migrate.html:70
msgid "Migrations at once"
msgstr "同时迁移数"
#: computes/templates/computes/balance.html:93
msgid "The hosts are balanced: no migration would even them out more."
msgstr "主机已均衡:没有能使其更均衡的迁移。"
#: computes/templates/computes/balance.html:119
msgid "Migrate the VMs listed?"
msgstr "迁移列出的虚拟机?"
#: computes/templates/computes/balance.html:98
msgid "Stay where they are"
msgstr "留在原处"
#: computes/templates/computes/balance.html:119
#: computes/templates/computes/bulk_migrate.html:76
#: instances/templates/instances/settings_tab.html:60
#: instances/templates/instances/settings_tab.html:617
#: instances/templates/instances/settings_tab.html:620
msgid "Migrate"
msgstr "迁移"
#: computes/templates/computes/balance.html:103
#: computes/templates/computes/balance.html:112
msgid "Let it move"
msgstr "允许迁移"
#: computes/templates/computes/balance.html:106
msgid "Why"
msgstr "原因"
#: computes/templates/computes/balance.html:115
msgid "You kept it here: tick it to let it move"
msgstr "您将其保留在原处:勾选后即可迁移"
#: computes/templates/computes/bulk_migrate.html:5
#: computes/templates/computes/bulk_migrate.html:6
@ -2102,11 +2125,23 @@ msgstr "同时迁移已关机的虚拟机"
msgid "Status"
msgstr "状态"
#: computes/templates/computes/bulk_migrate.html:47
#: computes/templates/computes/instances.html:49
msgid "VCPU"
msgstr "VCPU"
#: computes/templates/computes/bulk_migrate.html:75
#, python-format
msgid "Migrate the chosen VMs from %(source)s to %(dest)s?"
msgstr "将选中的虚拟机从 %(source)s 迁移到 %(dest)s?"
#: computes/templates/computes/bulk_migrate.html:76
#: instances/templates/instances/settings_tab.html:60
#: instances/templates/instances/settings_tab.html:617
#: instances/templates/instances/settings_tab.html:620
msgid "Migrate"
msgstr "迁移"
#: computes/templates/computes/capacity_line.txt:2
#, python-format
msgid "Given to VMs: %(counter)s vCPU (%(ratio)s:1), %(assigned)s memory."
@ -2164,12 +2199,6 @@ msgid "%(counter)s more pool"
msgid_plural "%(counter)s more pools"
msgstr[0] "另有 %(counter)s 个存储池"
#: computes/templates/computes/capacity_vcpus.html:4
#, python-format
msgid "%(counter)s vCPU"
msgid_plural "%(counter)s vCPUs"
msgstr[0] "%(counter)s 个 vCPU"
#: computes/templates/computes/capacity_vcpus.html:4
#: computes/templates/computes/list.html:42
#, python-format
@ -2357,11 +2386,6 @@ msgstr "虚拟机管理程序中没有任何虚拟机"
msgid "Actions"
msgstr "操作"
#: computes/templates/computes/list.html:6
#: computes/templates/computes/list.html:14 templates/navbar.html:18
msgid "Computes"
msgstr "计算节点"
#: computes/templates/computes/list.html:19
msgid "You don't have any computes"
msgstr "您还没有任何计算节点"
@ -2590,12 +2614,12 @@ msgid ""
"A disk file is not on storage both hosts share: migrate it from its page"
msgstr "有磁盘文件不在两台主机共享的存储上:请在该虚拟机的页面上迁移它"
#: computes/views.py:359
#: computes/views.py:366
#, python-format
msgid "The host was saved, but the panel cannot connect to it: %(error)s"
msgstr "主机已保存,但面板无法连接到它:%(error)s"
#: computes/views.py:415
#: computes/views.py:422
#, python-format
msgid ""
"Its VMs keep running on the host and leave the panel; their owners are kept "
@ -5333,6 +5357,16 @@ msgstr "该虚拟机没有主机设备。"
msgid "Migration route"
msgstr "迁移路径"
#: instances/templates/instances/settings_tab.html:527
#: networks/templates/network.html:396
msgid "From"
msgstr "源"
#: instances/templates/instances/settings_tab.html:532
#: networks/templates/network.html:400
msgid "To"
msgstr "目标"
#: instances/templates/instances/settings_tab.html:541
msgid ""
"The VM is running: it migrates live, or paused for the transfer when Live "
@ -5720,10 +5754,6 @@ msgid ""
"ends."
msgstr "此虚拟机正在运行磁盘任务;任务结束前快照操作不可用。"
#: instances/templates/instances/snapshots_tab.html:18
msgid "Now"
msgstr "现在"
#: instances/templates/instances/snapshots_tab.html:20
#: instances/templates/instances/snapshots_tab.html:31
msgid "Take a snapshot"

View file

@ -0,0 +1,8 @@
<?xml version="1.0" ?>
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-arrow-right" viewBox="0 0 16 16">
<path fill-rule="evenodd" d="M1 8a.5.5 0 0 1 .5-.5h11.793l-3.147-3.146a.5.5 0 0 1 .708-.708l4 4a.5.5 0 0 1 0 .708l-4 4a.5.5 0 0 1-.708-.708L13.293 8.5H1.5A.5.5 0 0 1 1 8"/>
</svg>

After

Width:  |  Height:  |  Size: 342 B

View file

@ -1,12 +1,18 @@
// The Balance page: unticking a VM keeps it where it is, ticking it again
// lets it move; either makes the proposal again. The header box ticks or
// unticks every VM listed.
// unticks every VM listed. The boxes sit in the page's tables and belong
// to the proposal's form by their form attribute.
const form = document.getElementById("balance-form");
form?.addEventListener("change", function (event) {
document.addEventListener("change", function (event) {
if (!form || event.target.form !== form) {
return;
}
if (event.target.id === "balance-all") {
form.querySelectorAll("input[name=vm]").forEach(function (box) {
box.checked = event.target.checked;
});
for (const box of form.elements) {
if (box.name === "vm") {
box.checked = event.target.checked;
}
}
}
form.submit();
});