diff --git a/README.md b/README.md index 31204815..a94ccc96 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ WebVirtCloud and `virt-manager`/`virsh` can manage the same libvirt host **concu ## Features * QEMU/KVM hypervisor management (multiple compute nodes), with each host's capacity and what its VMs were given -* Virtual machine lifecycle: create, delete, power management, clone (also of a running VM, with libvirt 11.10 or later), migrate (with or without shared storage), evacuate a host (its chosen VMs migrate to another, the chosen number at once), disk moves between pools +* Virtual machine lifecycle: create, delete, power management, clone (also of a running VM, with libvirt 11.10 or later), migrate (with or without shared storage), bulk migrate (a host's chosen VMs to another host, the chosen number at once), disk moves between pools * Long operations (create, clone, delete, snapshots, migration, disk moves, ISO upload) run as jobs that the page follows; a queued job can be cancelled, and a running clone, migration, disk move or ISO upload too * External snapshots (memory optional; without memory, guest file systems can be frozen through the agent) * **External change detection:** VMs created, deleted or renamed via `virt-manager` or `virsh` are reconciled into the database automatically diff --git a/computes/jobs.py b/computes/jobs.py index 4564882d..ca32f868 100644 --- a/computes/jobs.py +++ b/computes/jobs.py @@ -14,7 +14,7 @@ from operations.jobs import Cancelled, Kind, Outcome, Plan, register from operations.models import Claim, Operation -# where a host is: an evacuation stops if either host's record points elsewhere since it was asked +# where a host is: a bulk migration stops if either host's record points elsewhere since it was asked WHERE = ("hostname", "login", "type") @@ -23,20 +23,20 @@ def _where(params): def parallel_limit(): - """The most migrations an evacuation runs at once: the worker gives a - host's jobs half of its slots, and the evacuation itself takes one.""" + """The most migrations a bulk migration runs at once: the worker gives a + host's jobs half of its slots, and the bulk migration itself takes one.""" slots = utils.concurrency() return min(max(1, slots // 2), slots - 1) @register -class EvacuateHost(Kind): +class BulkMigrate(Kind): """Migrates the chosen VMs of a host to another, each in a migrate job of its own, at most parallel at once: one that fails leaves its VM on the host and the rest go on.""" - name = "host.evacuate" - label = gettext_noop("Evacuate host") + name = "host.bulk_migrate" + label = gettext_noop("Bulk migrate") cancellable = True def normalize(self, raw): @@ -55,7 +55,7 @@ class EvacuateHost(Kind): def plan(self, user, params): compute = Compute.objects.get(pk=params["compute"]) target = Compute.objects.get(pk=params["target"]) - return Plan(claims={claims.evacuate_key(): Claim.EXCLUSIVE}, resource=claims.compute_key(compute.pk), + return Plan(claims={claims.bulk_migrate_key(): Claim.EXCLUSIVE}, resource=claims.compute_key(compute.pk), label=f"{compute.name} -> {target.name}", intent={"migrations": {}, "where": _where(params)}) def precheck(self, op, ctx): @@ -122,9 +122,9 @@ class EvacuateHost(Kind): def reconcile(self, op): return Outcome(Operation.FAILED, error=utils.say(gettext_noop( - "The evacuation stopped: the migrations it started go on as their own jobs; the other VMs stay"))) + "The bulk migration stopped: the migrations it started go on as their own jobs; the other VMs stay"))) def log_entry(self, op, state): source, _sep, target = op.resource_label.partition(" -> ") - message = f"Evacuate to {target}" + message = f"Bulk migrate to {target}" return source, "", "", message if state == Operation.SUCCEEDED else f"{message} ({state})" diff --git a/computes/templates/computes/evacuate.html b/computes/templates/computes/bulk_migrate.html similarity index 64% rename from computes/templates/computes/evacuate.html rename to computes/templates/computes/bulk_migrate.html index ae9e00e0..cb5cd326 100644 --- a/computes/templates/computes/evacuate.html +++ b/computes/templates/computes/bulk_migrate.html @@ -2,8 +2,8 @@ {% load i18n %} {% load static %} {% load operations %} -{% block title %}{% trans "Evacuate" %} - {{ compute.name }}{% endblock %} -{% block page_heading %}{{ compute.name }} - {% trans "Evacuate" %}{% endblock page_heading %} +{% block title %}{% trans "Bulk Migrate" %} - {{ compute.name }}{% endblock %} +{% block page_heading %}{{ compute.name }} - {% trans "Bulk Migrate" %}{% endblock page_heading %} {% block content %}
@@ -15,15 +15,17 @@
{% trans "There is no other host to migrate to." %}
{% else %}

{% trans "Each chosen VM migrates in a job of its own: a running VM live, a shut-off one offline. A VM that fails stays on this host." %}

-
-
- - -
-
+{% if targets|length > 1 %} +{# another destination reloads the list: which VMs can go depends on it #} + + +
+{% else %} +

{% trans "Destination" %}: {{ target.name }}

+{% endif %} {% if not parallel %}
{% trans "The worker runs one job at a time: set Worker Concurrency to 2 or more on the Settings page." %}
{% elif not instances %} @@ -32,14 +34,14 @@
{% csrf_token %}{% submission_key %}
- - + +
- + @@ -51,10 +53,10 @@ {% for instance in instances %} - + @@ -65,8 +67,8 @@
{% trans "Migrate" %} {% trans "Name" %} {% trans "Status" %} {% trans "VCPU" %}
- {% include 'instance_state.html' %} {{ instance.info.3 }} {% if instance.info %}{% widthratio instance.info.2 1024 1 %} MiB{% endif %}
- - {% for n in parallel %}{% endfor %}
@@ -77,5 +79,5 @@ {% endif %} {% endblock %} {% block script %} - + {% endblock %} diff --git a/computes/templates/computes/instances.html b/computes/templates/computes/instances.html index 0459a9ae..d0819713 100644 --- a/computes/templates/computes/instances.html +++ b/computes/templates/computes/instances.html @@ -12,7 +12,7 @@ {% bs_icon 'plus-circle-fill' %} {% if instances %} -{% trans "Evacuate" %} +{% trans "Bulk Migrate" %} {% include 'search_block.html' %} {% endif %} {% endblock page_heading_extra %} diff --git a/computes/tests/test_evacuate.py b/computes/tests/test_bulk_migrate.py similarity index 83% rename from computes/tests/test_evacuate.py rename to computes/tests/test_bulk_migrate.py index ccb04730..0794b0eb 100644 --- a/computes/tests/test_evacuate.py +++ b/computes/tests/test_bulk_migrate.py @@ -1,4 +1,4 @@ -"""Evacuating a host migrates its chosen VMs in one job, a migrate job each, +"""Bulk migrating a host migrates its chosen VMs in one job, a migrate job each, the chosen number at once; the page ticks the running VMs, leaves the shut-off ones to choose and refuses a VM with a disk the two hosts do not share. Migrations share the hosts, so the job's migrations are admitted @@ -14,7 +14,7 @@ from django.urls import reverse from instances.models import Instance from lxml import etree, html from appsettings.models import AppSettings -from computes.jobs import EvacuateHost +from computes.jobs import BulkMigrate from operations import claims, jobs from operations.models import Claim, Operation from vrtManager import util @@ -24,7 +24,7 @@ DOMAIN = """{name}128 ({addEventListener: (name, fn) => { handlers[id] = fn; }}); +const ids = {"bulk-migrate-all": box("all"), "bulk-migrate-shut-off": box("shut-off"), "bulk-migrate-target": box("target")}; +let submitted = 0; +const selectors = { + "input[name=instance]:not(:disabled)": (b) => !b.disabled, + "input[data-shut-off]:not(:disabled)": (b) => b.shutOff && !b.disabled, +}; +vm.runInNewContext(SCRIPT, vm.createContext({document: { + getElementById: (id) => ids[id], + querySelectorAll: (selector) => boxes.filter(selectors[selector]), +}})); +const ticked = () => boxes.filter((b) => b.checked).map((b) => b.name); +const seen = []; +for (const [id, checked] of STEPS) { + handlers[id]({target: {checked, form: {submit: () => { submitted += 1; }}}}); + seen.push(ticked()); +} +console.log(JSON.stringify({seen, submitted})); +""" + + +@unittest.skipUnless(shutil.which("node"), "node is not installed") +class BulkMigrateScriptTests(unittest.TestCase): + def run_script(self, steps): + """{seen: the ticked VMs after each step, submitted: the destination form's reloads}.""" + code = f"const SCRIPT = {json.dumps(SCRIPT.read_text())};" + RUN.replace("STEPS", json.dumps(steps)) + out = subprocess.run(["node", "-e", code], capture_output=True, text=True, check=True, timeout=30) + return json.loads(out.stdout) + + def test_select_all_ticks_every_vm_that_can_migrate(self): + self.assertEqual(self.run_script([["all", True], ["all", False]])["seen"], [["run", "off"], []]) + + def test_the_shut_off_box_ticks_only_the_shut_off_vms(self): + self.assertEqual(self.run_script([["shut-off", True], ["shut-off", False]])["seen"], [["run", "off"], ["run"]]) + + def test_another_destination_reloads_the_list(self): + self.assertEqual(self.run_script([["target", False]])["submitted"], 1) diff --git a/computes/urls.py b/computes/urls.py index a42af6a1..d6797e22 100644 --- a/computes/urls.py +++ b/computes/urls.py @@ -62,7 +62,7 @@ urlpatterns = [ path("statistics", views.compute_graph, name="compute_graph"), path("capacity/", views.capacity, name="compute_capacity"), path("instances/", views.instances, name="instances"), - path("evacuate/", views.evacuate, name="evacuate"), + path("bulk-migrate/", views.bulk_migrate, name="bulk_migrate"), path("nodedevs/", nodedevs, name="nodedevs"), path("storages/", storages, name="storages"), path("storage//volumes/", get_volumes, name="volumes"), diff --git a/computes/views.py b/computes/views.py index 6340774d..36581660 100644 --- a/computes/views.py +++ b/computes/views.py @@ -230,7 +230,7 @@ def instances(request, compute_id): @superuser_only -def evacuate(request, compute_id): +def bulk_migrate(request, compute_id): """Migrates the chosen VMs of the host to another in one job, for the host's maintenance: a migrate job each, the chosen number at once; a running VM live, a shut-off one offline. A VM with a disk file the two @@ -247,7 +247,7 @@ def evacuate(request, compute_id): raw = {"compute": compute.pk, "target": target.pk, "parallel": request.POST.get("parallel", ""), "instances": [pk for pk in request.POST.getlist("instance") if pk.isdigit()]} try: - op = jobs.submit("host.evacuate", request.user, raw, request.POST.get("submission_key", "")) + op = jobs.submit("host.bulk_migrate", request.user, raw, request.POST.get("submission_key", "")) except claims.Busy as busy: messages.error(request, busy_message(busy, request.user)) except (ValueError, jobs.SubmissionConflict, libvirtError) as err: @@ -255,7 +255,7 @@ def evacuate(request, compute_id): else: jobs.remember_job(request, op) return redirect("instances", compute.pk) - return redirect(reverse("evacuate", args=[compute.pk]) + f"?target={target.pk}") + return redirect(reverse("bulk_migrate", args=[compute.pk]) + f"?target={target.pk}") chosen = request.GET.get("target") target = next((t for t in targets if str(t.pk) == chosen), targets[0] if targets else None) @@ -274,7 +274,7 @@ def evacuate(request, compute_id): instance.refusal = _("A disk file is not on storage both hosts share: migrate it from its page") except libvirtError as err: instance.refusal = error_text(request, err) - return render(request, "computes/evacuate.html", + return render(request, "computes/bulk_migrate.html", {"compute": compute, "targets": targets, "target": target, "instances": instances, "parallel": range(1, parallel_limit() + 1)}) diff --git a/instances/jobs.py b/instances/jobs.py index be073f28..df3d74aa 100644 --- a/instances/jobs.py +++ b/instances/jobs.py @@ -1165,7 +1165,7 @@ class MigrateInstance(Kind): def normalize(self, raw): # disk_pools: {target: pool of the destination} of the disks to copy there - # source: the host an evacuation migrates the VM from; one that left it since is refused + # source: the host a bulk migration takes the VM from; one that left it since is refused return {"instance": int(raw["instance"]), "target": int(raw["target"]), "source": int(raw["source"]) if raw.get("source") else None, "disk_pools": {str(k): str(v) for k, v in (raw.get("disk_pools") or {}).items() if v}, @@ -1181,7 +1181,7 @@ class MigrateInstance(Kind): if params["source"] not in (None, instance.compute_id): raise util.OperationError(MOVED) keys = vm_claims(Compute.objects.get(pk=params["target"]), instance.name) - # migrations share the hosts' VM sets, so a host evacuates several VMs at once; + # migrations share the hosts' VM sets, so a host's VMs migrate several at once; # creates, clones, deletes and the VM list reconcile still wait for them keys.update({claims.reconcile_key(params["target"]): Claim.SHARED, claims.compute_key(instance.compute_id): Claim.SHARED, diff --git a/instances/tests/test_live_jobs.py b/instances/tests/test_live_jobs.py index 5205a9cc..fd75548c 100644 --- a/instances/tests/test_live_jobs.py +++ b/instances/tests/test_live_jobs.py @@ -183,7 +183,7 @@ class LiveJobsTestCase(TransactionTestCase): self.assertFalse(self.conn.lookupByUUIDString(uuid).isActive()) # defined on the source again self.assertEqual(Instance.objects.get(uuid=uuid).compute, self.compute) - def test_an_evacuation_migrates_the_chosen_vms_two_at_once(self): + def test_a_bulk_migration_migrates_the_chosen_vms_two_at_once(self): dest, dest_conn = self.second_host() vms = [] for name, running in (("evac-run", True), ("evac-off", False)): @@ -194,11 +194,11 @@ class LiveJobsTestCase(TransactionTestCase): local = self.vm("evac-disk")[0] # its disk is in a pool of this host only local = Instance.objects.create(compute=self.compute, name=local.name(), uuid=local.UUIDString()) self.client.force_login(self.admin) - page = html.fromstring(self.client.get(reverse("evacuate", args=[self.compute.pk]) + f"?target={dest.pk}").content) + page = html.fromstring(self.client.get(reverse("bulk_migrate", args=[self.compute.pk]) + f"?target={dest.pk}").content) disabled = {int(box.get("value")): box.get("disabled") is not None for box in page.xpath("//input[@name='instance']")} self.assertEqual([disabled[vm.pk] for vm in (*vms, local)], [False, False, True]) # the host's other VMs as they are raw = {"compute": self.compute.pk, "target": dest.pk, "parallel": 2, "instances": [vm.pk for vm in vms]} - self.run_job(jobs.submit("host.evacuate", self.admin, raw, "key-evac0001"), concurrency=4) + self.run_job(jobs.submit("host.bulk_migrate", self.admin, raw, "key-evac0001"), concurrency=4) self.assertEqual(Operation.objects.filter(kind="instance.migrate", state=Operation.SUCCEEDED).count(), 2) self.assertEqual([dest_conn.lookupByUUIDString(vm.uuid).isActive() for vm in vms], [True, False]) self.assertEqual({vm.compute for vm in Instance.objects.filter(pk__in=[vm.pk for vm in vms])}, {dest}) diff --git a/locale/tr/LC_MESSAGES/django.mo b/locale/tr/LC_MESSAGES/django.mo index ba6d4cec..70400623 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 c3852fbb..8d678983 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-15 14:47+0000\n" +"POT-Creation-Date: 2026-11-15 16:43+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" @@ -64,7 +64,7 @@ msgstr "Açık anahtar zaten mevcut" msgid "Invalid key" msgstr "Geçersiz anahtar" -#: accounts/forms.py:95 computes/templates/computes/evacuate.html:43 +#: accounts/forms.py:95 computes/templates/computes/bulk_migrate.html:45 #: computes/templates/computes/instances.html:46 #: instances/templates/add_instance_volume.html:39 #: instances/templates/allinstances_index_grouped.html:11 @@ -768,7 +768,7 @@ msgstr "" msgid "vCPUs" msgstr "vCPU" -#: admin/forms.py:209 computes/templates/computes/evacuate.html:46 +#: admin/forms.py:209 computes/templates/computes/bulk_migrate.html:48 #: computes/templates/computes/instances.html:50 #: computes/templates/computes/list.html:59 computes/templates/overview.html:66 #: computes/templates/overview.html:150 @@ -1937,8 +1937,8 @@ msgid "the libvirt of the host the panel runs on, by its socket" msgstr "panelin çalıştığı sunucunun libvirt'i, soketi üzerinden" #: computes/jobs.py:39 -msgid "Evacuate host" -msgstr "Sunucuyu boşalt" +msgid "Bulk migrate" +msgstr "Toplu taşıma" #: computes/jobs.py:50 msgid "Choose the VMs to migrate" @@ -1953,7 +1953,7 @@ msgstr "Aynı anda en fazla %(limit)s taşıma çalışabilir" msgid "Migrating the VMs" msgstr "Sanal makineler taşınıyor" -#: computes/jobs.py:84 +#: computes/jobs.py:85 msgid "" "The worker now runs one job at a time: the VMs not yet started stay on the " "host" @@ -1961,24 +1961,24 @@ msgstr "" "İş yürütücü artık aynı anda tek iş çalıştırıyor: henüz başlatılmamış sanal " "makineler sunucuda kalıyor" -#: computes/jobs.py:87 +#: computes/jobs.py:88 msgid "A host was changed or deleted: the VMs not yet started stay on the host" msgstr "" "Bir sunucu değiştirildi ya da silindi: henüz başlatılmamış sanal makineler " "sunucuda kalıyor" -#: computes/jobs.py:111 +#: computes/jobs.py:117 #, python-format msgid "These VMs did not migrate: %(vms)s" msgstr "Bu sanal makineler taşınamadı: %(vms)s" -#: computes/jobs.py:119 +#: computes/jobs.py:125 msgid "" -"The evacuation stopped: the migrations it started go on as their own jobs; " -"the other VMs stay" +"The bulk migration stopped: the migrations it started go on as their own " +"jobs; the other VMs stay" msgstr "" -"Boşaltma durdu: başlattığı taşımalar kendi işleri olarak sürüyor; diğer sanal" -" makineler yerinde kalıyor" +"Toplu taşıma durdu: başlattığı taşımalar kendi işleri olarak sürüyor; diğer " +"sanal makineler yerinde kalıyor" #: computes/models.py:21 msgid "hostname" @@ -2049,6 +2049,79 @@ msgstr "" "Bu, VM'lerinin bulunduğu sunucudan başka bir sunucu: yeni bir sunucu olarak " "ekleyin" +#: computes/templates/computes/bulk_migrate.html:5 +#: computes/templates/computes/bulk_migrate.html:6 +#: computes/templates/computes/instances.html:15 +msgid "Bulk Migrate" +msgstr "Toplu Taşı" + +#: computes/templates/computes/bulk_migrate.html:15 instances/views.py:379 +msgid "There is no other host to migrate to." +msgstr "Taşınacak başka bir sunucu yok." + +#: computes/templates/computes/bulk_migrate.html:17 +msgid "" +"Each chosen VM migrates in a job of its own: a running VM live, a shut-off " +"one offline. A VM that fails stays on this host." +msgstr "" +"Seçilen her sanal makine kendi işinde taşınır: çalışan sanal makine canlı, " +"kapalı olan çevrimdışı. Taşınamayan sanal makine bu sunucuda kalır." + +#: computes/templates/computes/bulk_migrate.html:21 +#: computes/templates/computes/bulk_migrate.html:27 +msgid "Destination" +msgstr "Hedef" + +#: 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 "" +"İş 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/bulk_migrate.html:32 +msgid "The host has no VMs." +msgstr "Bu sunucuda sanal makine yok." + +#: computes/templates/computes/bulk_migrate.html:38 +msgid "Also migrate the shut-off VMs" +msgstr "Kapalı sanal makineleri de taşı" + +#: computes/templates/computes/bulk_migrate.html:44 +msgid "Select all" +msgstr "Tümünü seç" + +#: computes/templates/computes/bulk_migrate.html:46 +#: computes/templates/computes/instances.html:48 +#: instances/templates/allinstances_index_grouped.html:12 +#: instances/templates/allinstances_index_nongrouped.html:10 +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:70 +msgid "Migrations at once" +msgstr "Aynı anda taşıma" + +#: computes/templates/computes/bulk_migrate.html:75 +#, python-format +msgid "Migrate the chosen VMs from %(source)s to %(dest)s?" +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." @@ -2155,79 +2228,6 @@ msgstr "Kapalı sanal makinelerin vCPU'ları" msgid "%(stopped)s of the host's %(cpus)s CPUs" msgstr "Sunucunun %(cpus)s CPU'sundan %(stopped)s" -#: computes/templates/computes/evacuate.html:5 -#: computes/templates/computes/evacuate.html:6 -#: computes/templates/computes/instances.html:15 -msgid "Evacuate" -msgstr "Boşalt" - -#: computes/templates/computes/evacuate.html:15 instances/views.py:379 -msgid "There is no other host to migrate to." -msgstr "Taşınacak başka bir sunucu yok." - -#: computes/templates/computes/evacuate.html:17 -msgid "" -"Each chosen VM migrates in a job of its own: a running VM live, a shut-off " -"one offline. A VM that fails stays on this host." -msgstr "" -"Seçilen her sanal makine kendi işinde taşınır: çalışan sanal makine canlı, " -"kapalı olan çevrimdışı. Taşınamayan sanal makine bu sunucuda kalır." - -#: computes/templates/computes/evacuate.html:20 -msgid "Destination" -msgstr "Hedef" - -#: computes/templates/computes/evacuate.html:25 -msgid "Check" -msgstr "Denetle" - -#: computes/templates/computes/evacuate.html:28 -msgid "" -"The worker runs one job at a time: set Worker Concurrency to 2 or more on the" -" Settings page." -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/evacuate.html:30 -msgid "The host has no VMs." -msgstr "Bu sunucuda sanal makine yok." - -#: computes/templates/computes/evacuate.html:36 -msgid "Also migrate the shut-off VMs" -msgstr "Kapalı sanal makineleri de taşı" - -#: computes/templates/computes/evacuate.html:42 -#: computes/templates/computes/evacuate.html:74 -#: 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/evacuate.html:44 -#: computes/templates/computes/instances.html:48 -#: instances/templates/allinstances_index_grouped.html:12 -#: instances/templates/allinstances_index_nongrouped.html:10 -msgid "Status" -msgstr "Durum" - -#: computes/templates/computes/evacuate.html:45 -#: computes/templates/computes/instances.html:49 -msgid "VCPU" -msgstr "VCPU" - -#: computes/templates/computes/evacuate.html:68 -msgid "Migrations at once" -msgstr "Aynı anda taşıma" - -#: computes/templates/computes/evacuate.html:73 -#, python-format -msgid "Migrate the chosen VMs from %(source)s to %(dest)s?" -msgstr "" -"Seçilen sanal makineler %(source)s sunucusundan %(dest)s sunucusuna taşınsın " -"mı?" - #: computes/templates/computes/form.html:5 msgid "Edit host" msgstr "Sunucuyu düzenle" @@ -3408,78 +3408,78 @@ msgstr "Sanal makine taşındı, ancak NVRAM dosyası kaynakta kaldı: %(error)s msgid "Migrate VM" msgstr "Sanal makineyi taşı" -#: instances/jobs.py:1212 +#: instances/jobs.py:1216 msgid "Migrating the VM" msgstr "Sanal makine taşınıyor" -#: instances/jobs.py:1261 +#: instances/jobs.py:1265 msgid "libvirt is still migrating the VM" msgstr "libvirt sanal makineyi hâlâ taşıyor" -#: instances/jobs.py:1273 +#: instances/jobs.py:1277 msgid "The VM stayed on the source host" msgstr "Sanal makine kaynak sunucuda kaldı" -#: instances/jobs.py:1275 +#: instances/jobs.py:1279 msgid "" "The VM is on both computes or on neither; check them, then resolve this job." msgstr "" "Sanal makine ya iki sunucuda da var ya da hiçbirinde yok; kontrol edin, sonra" " bu işi çözün." -#: instances/jobs.py:1294 +#: instances/jobs.py:1298 msgid "Move disk" msgstr "Diski taşı" -#: instances/jobs.py:1301 +#: instances/jobs.py:1305 msgid "Choose a disk of the VM" msgstr "Sanal makinenin bir diskini seçin" -#: instances/jobs.py:1325 +#: instances/jobs.py:1329 msgid "Copying the disk" msgstr "Disk kopyalanıyor" -#: instances/jobs.py:1367 +#: instances/jobs.py:1371 #, python-format msgid "Another block job runs on %(dev)s; check the VM" msgstr "" "%(dev)s üzerinde başka bir blok işi çalışıyor; sanal makineyi kontrol edin" -#: instances/jobs.py:1373 +#: instances/jobs.py:1377 #, python-format msgid "The disk stayed in %(path)s; remove %(dest)s if it is there" msgstr "Disk %(path)s içinde kaldı; varsa %(dest)s dosyasını silin" -#: instances/jobs.py:1375 +#: instances/jobs.py:1379 #, python-format msgid "The definitions of %(dev)s name %(paths)s; check the VM" msgstr "%(dev)s tanımları %(paths)s gösteriyor; sanal makineyi kontrol edin" -#: instances/jobs.py:1382 +#: instances/jobs.py:1386 #, python-format msgid "Disk %(path)s was kept: a disk file that stays needs it" msgstr "%(path)s diski korundu: kalan bir disk dosyası ona ihtiyaç duyuyor" -#: instances/jobs.py:1383 +#: instances/jobs.py:1387 #, python-format msgid "The VM is removed, but disk %(path)s was not deleted: %(err)s" msgstr "Sanal makine kaldırıldı, ancak %(path)s diski silinmedi: %(err)s" -#: instances/jobs.py:1384 +#: instances/jobs.py:1388 #, python-format msgid "Disk %(path)s is used by another VM and was kept" msgstr "" "%(path)s diski başka bir sanal makine tarafından kullanılıyor ve korundu" -#: instances/jobs.py:1438 +#: instances/jobs.py:1442 msgid "Delete VM" msgstr "Sanal makineyi sil" -#: instances/jobs.py:1468 +#: instances/jobs.py:1472 msgid "Deleting the VM" msgstr "Sanal makine siliniyor" -#: instances/jobs.py:1480 +#: instances/jobs.py:1484 msgid "The VM was not deleted; it may have been shut off" msgstr "Sanal makine silinmedi; kapatılmış olabilir" @@ -9453,36 +9453,36 @@ msgstr "" "Bağlantı başarısız: %(host)s yanıt vermiyor: %(requests)s istek hâlâ onu " "bekliyor" -#: vrtManager/connection.py:243 +#: vrtManager/connection.py:248 #, python-format msgid "Connection Failed: %(host)s did not answer within %(seconds)s s" msgstr "Bağlantı başarısız: %(host)s %(seconds)s sn içinde yanıt vermedi" -#: vrtManager/connection.py:254 +#: vrtManager/connection.py:259 msgid "the connection closed right after opening" msgstr "bağlantı açıldıktan hemen sonra kapandı" -#: vrtManager/connection.py:267 +#: vrtManager/connection.py:272 #, python-format msgid "Connection Failed: %(error)s" msgstr "Bağlantı başarısız: %(error)s" -#: vrtManager/connection.py:336 +#: vrtManager/connection.py:341 #, python-format msgid "Connection closed (%(reason)s)" msgstr "Bağlantı kapandı (%(reason)s)" -#: vrtManager/connection.py:488 +#: vrtManager/connection.py:493 #, python-format msgid "Connection Failed: %(host)s is not connected" msgstr "Bağlantı başarısız: %(host)s bağlı değil" -#: vrtManager/connection.py:540 +#: vrtManager/connection.py:545 #, python-format msgid "This host has no architecture %(arch)s" msgstr "Bu sunucuda %(arch)s mimarisi yok" -#: vrtManager/connection.py:1203 +#: vrtManager/connection.py:1214 #, python-format msgid "" "Pool %(pool)s is not active: the files the disks of the VMs in it are made " diff --git a/locale/zh/LC_MESSAGES/django.mo b/locale/zh/LC_MESSAGES/django.mo index ae27b775..3acd3feb 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 8e7ae86f..3e35096e 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-15 14:47+0000\n" +"POT-Creation-Date: 2026-11-15 16:43+0000\n" "PO-Revision-Date: \n" "Last-Translator: \n" "Language-Team: \n" @@ -61,7 +61,7 @@ msgstr "公钥已存在" msgid "Invalid key" msgstr "无效的密钥" -#: accounts/forms.py:95 computes/templates/computes/evacuate.html:43 +#: accounts/forms.py:95 computes/templates/computes/bulk_migrate.html:45 #: computes/templates/computes/instances.html:46 #: instances/templates/add_instance_volume.html:39 #: instances/templates/allinstances_index_grouped.html:11 @@ -745,7 +745,7 @@ msgstr "NEW_USER_DEFAULT_INSTANCES:%(name)s 已有所有者,且只允许一 msgid "vCPUs" msgstr "vCPU" -#: admin/forms.py:209 computes/templates/computes/evacuate.html:46 +#: admin/forms.py:209 computes/templates/computes/bulk_migrate.html:48 #: computes/templates/computes/instances.html:50 #: computes/templates/computes/list.html:59 computes/templates/overview.html:66 #: computes/templates/overview.html:150 @@ -1874,8 +1874,8 @@ msgid "the libvirt of the host the panel runs on, by its socket" msgstr "面板所在主机的 libvirt,通过其套接字连接" #: computes/jobs.py:39 -msgid "Evacuate host" -msgstr "疏散主机" +msgid "Bulk migrate" +msgstr "批量迁移" #: computes/jobs.py:50 msgid "Choose the VMs to migrate" @@ -1890,26 +1890,26 @@ msgstr "最多可同时运行 %(limit)s 个迁移" msgid "Migrating the VMs" msgstr "正在迁移虚拟机" -#: computes/jobs.py:84 +#: computes/jobs.py:85 msgid "" "The worker now runs one job at a time: the VMs not yet started stay on the " "host" msgstr "任务执行器现在一次只运行一个任务:尚未开始的虚拟机留在主机上" -#: computes/jobs.py:87 +#: computes/jobs.py:88 msgid "A host was changed or deleted: the VMs not yet started stay on the host" msgstr "有主机被修改或删除:尚未开始的虚拟机留在主机上" -#: computes/jobs.py:111 +#: computes/jobs.py:117 #, python-format msgid "These VMs did not migrate: %(vms)s" msgstr "以下虚拟机未能迁移:%(vms)s" -#: computes/jobs.py:119 +#: computes/jobs.py:125 msgid "" -"The evacuation stopped: the migrations it started go on as their own jobs; " -"the other VMs stay" -msgstr "疏散已停止:已启动的迁移作为各自的任务继续进行;其他虚拟机保持不动" +"The bulk migration stopped: the migrations it started go on as their own " +"jobs; the other VMs stay" +msgstr "批量迁移已停止:已启动的迁移作为各自的任务继续进行;其他虚拟机保持不动" #: computes/models.py:21 msgid "hostname" @@ -1971,6 +1971,73 @@ msgstr "其虚拟机所在的主机尚不明确:请在面板通过当前连接 msgid "This is another host than the one its VMs are on: add it as a new host" msgstr "这不是其虚拟机所在的主机:请将其添加为新主机" +#: computes/templates/computes/bulk_migrate.html:5 +#: computes/templates/computes/bulk_migrate.html:6 +#: computes/templates/computes/instances.html:15 +msgid "Bulk Migrate" +msgstr "批量迁移" + +#: computes/templates/computes/bulk_migrate.html:15 instances/views.py:379 +msgid "There is no other host to migrate to." +msgstr "没有其他可迁移到的主机。" + +#: computes/templates/computes/bulk_migrate.html:17 +msgid "" +"Each chosen VM migrates in a job of its own: a running VM live, a shut-off " +"one offline. A VM that fails stays on this host." +msgstr "每台选中的虚拟机在各自的任务中迁移:运行中的虚拟机在线迁移,已关机的离线迁移。迁移失败的虚拟机留在此主机上。" + +#: computes/templates/computes/bulk_migrate.html:21 +#: computes/templates/computes/bulk_migrate.html:27 +msgid "Destination" +msgstr "目标主机" + +#: 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/bulk_migrate.html:32 +msgid "The host has no VMs." +msgstr "此主机没有虚拟机。" + +#: computes/templates/computes/bulk_migrate.html:38 +msgid "Also migrate the shut-off VMs" +msgstr "同时迁移已关机的虚拟机" + +#: computes/templates/computes/bulk_migrate.html:44 +msgid "Select all" +msgstr "全选" + +#: computes/templates/computes/bulk_migrate.html:46 +#: computes/templates/computes/instances.html:48 +#: instances/templates/allinstances_index_grouped.html:12 +#: instances/templates/allinstances_index_nongrouped.html:10 +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:70 +msgid "Migrations at once" +msgstr "同时迁移数" + +#: 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." @@ -2065,73 +2132,6 @@ msgstr "已关机虚拟机的 vCPU" msgid "%(stopped)s of the host's %(cpus)s CPUs" msgstr "占主机 %(cpus)s 个 CPU 中的 %(stopped)s" -#: computes/templates/computes/evacuate.html:5 -#: computes/templates/computes/evacuate.html:6 -#: computes/templates/computes/instances.html:15 -msgid "Evacuate" -msgstr "疏散" - -#: computes/templates/computes/evacuate.html:15 instances/views.py:379 -msgid "There is no other host to migrate to." -msgstr "没有其他可迁移到的主机。" - -#: computes/templates/computes/evacuate.html:17 -msgid "" -"Each chosen VM migrates in a job of its own: a running VM live, a shut-off " -"one offline. A VM that fails stays on this host." -msgstr "每台选中的虚拟机在各自的任务中迁移:运行中的虚拟机在线迁移,已关机的离线迁移。迁移失败的虚拟机留在此主机上。" - -#: computes/templates/computes/evacuate.html:20 -msgid "Destination" -msgstr "目标主机" - -#: computes/templates/computes/evacuate.html:25 -msgid "Check" -msgstr "检查" - -#: computes/templates/computes/evacuate.html:28 -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/evacuate.html:30 -msgid "The host has no VMs." -msgstr "此主机没有虚拟机。" - -#: computes/templates/computes/evacuate.html:36 -msgid "Also migrate the shut-off VMs" -msgstr "同时迁移已关机的虚拟机" - -#: computes/templates/computes/evacuate.html:42 -#: computes/templates/computes/evacuate.html:74 -#: 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/evacuate.html:44 -#: computes/templates/computes/instances.html:48 -#: instances/templates/allinstances_index_grouped.html:12 -#: instances/templates/allinstances_index_nongrouped.html:10 -msgid "Status" -msgstr "状态" - -#: computes/templates/computes/evacuate.html:45 -#: computes/templates/computes/instances.html:49 -msgid "VCPU" -msgstr "VCPU" - -#: computes/templates/computes/evacuate.html:68 -msgid "Migrations at once" -msgstr "同时迁移数" - -#: computes/templates/computes/evacuate.html:73 -#, python-format -msgid "Migrate the chosen VMs from %(source)s to %(dest)s?" -msgstr "将选中的虚拟机从 %(source)s 迁移到 %(dest)s?" - #: computes/templates/computes/form.html:5 msgid "Edit host" msgstr "编辑主机" @@ -3242,74 +3242,74 @@ msgstr "虚拟机已迁移,但其 NVRAM 文件仍留在源主机上:%(error) msgid "Migrate VM" msgstr "迁移虚拟机" -#: instances/jobs.py:1212 +#: instances/jobs.py:1216 msgid "Migrating the VM" msgstr "正在迁移虚拟机" -#: instances/jobs.py:1261 +#: instances/jobs.py:1265 msgid "libvirt is still migrating the VM" msgstr "libvirt 仍在迁移虚拟机" -#: instances/jobs.py:1273 +#: instances/jobs.py:1277 msgid "The VM stayed on the source host" msgstr "虚拟机留在了源主机上" -#: instances/jobs.py:1275 +#: instances/jobs.py:1279 msgid "" "The VM is on both computes or on neither; check them, then resolve this job." msgstr "虚拟机同时位于两个计算节点上,或都不在;请检查后处理此任务。" -#: instances/jobs.py:1294 +#: instances/jobs.py:1298 msgid "Move disk" msgstr "移动磁盘" -#: instances/jobs.py:1301 +#: instances/jobs.py:1305 msgid "Choose a disk of the VM" msgstr "请选择虚拟机的一个磁盘" -#: instances/jobs.py:1325 +#: instances/jobs.py:1329 msgid "Copying the disk" msgstr "正在复制磁盘" -#: instances/jobs.py:1367 +#: instances/jobs.py:1371 #, python-format msgid "Another block job runs on %(dev)s; check the VM" msgstr "%(dev)s 上正在运行另一个块任务;请检查虚拟机" -#: instances/jobs.py:1373 +#: instances/jobs.py:1377 #, python-format msgid "The disk stayed in %(path)s; remove %(dest)s if it is there" msgstr "磁盘仍在 %(path)s;如果 %(dest)s 存在,请将其删除" -#: instances/jobs.py:1375 +#: instances/jobs.py:1379 #, python-format msgid "The definitions of %(dev)s name %(paths)s; check the VM" msgstr "%(dev)s 的定义指向 %(paths)s;请检查虚拟机" -#: instances/jobs.py:1382 +#: instances/jobs.py:1386 #, python-format msgid "Disk %(path)s was kept: a disk file that stays needs it" msgstr "磁盘 %(path)s 已保留:某个保留的磁盘文件依赖它" -#: instances/jobs.py:1383 +#: instances/jobs.py:1387 #, python-format msgid "The VM is removed, but disk %(path)s was not deleted: %(err)s" msgstr "虚拟机已删除,但磁盘 %(path)s 未被删除:%(err)s" -#: instances/jobs.py:1384 +#: instances/jobs.py:1388 #, python-format msgid "Disk %(path)s is used by another VM and was kept" msgstr "磁盘 %(path)s 正被另一台虚拟机使用,已保留" -#: instances/jobs.py:1438 +#: instances/jobs.py:1442 msgid "Delete VM" msgstr "删除虚拟机" -#: instances/jobs.py:1468 +#: instances/jobs.py:1472 msgid "Deleting the VM" msgstr "正在删除虚拟机" -#: instances/jobs.py:1480 +#: instances/jobs.py:1484 msgid "The VM was not deleted; it may have been shut off" msgstr "虚拟机未被删除;它可能已被关闭" @@ -8921,36 +8921,36 @@ msgid "" " for it" msgstr "连接失败:%(host)s 无响应:仍有 %(requests)s 个请求在等待它" -#: vrtManager/connection.py:243 +#: vrtManager/connection.py:248 #, python-format msgid "Connection Failed: %(host)s did not answer within %(seconds)s s" msgstr "连接失败:%(host)s 在 %(seconds)s 秒内未响应" -#: vrtManager/connection.py:254 +#: vrtManager/connection.py:259 msgid "the connection closed right after opening" msgstr "连接在打开后立即关闭" -#: vrtManager/connection.py:267 +#: vrtManager/connection.py:272 #, python-format msgid "Connection Failed: %(error)s" msgstr "连接失败:%(error)s" -#: vrtManager/connection.py:336 +#: vrtManager/connection.py:341 #, python-format msgid "Connection closed (%(reason)s)" msgstr "连接已关闭(%(reason)s)" -#: vrtManager/connection.py:488 +#: vrtManager/connection.py:493 #, python-format msgid "Connection Failed: %(host)s is not connected" msgstr "连接失败:%(host)s 未连接" -#: vrtManager/connection.py:540 +#: vrtManager/connection.py:545 #, python-format msgid "This host has no architecture %(arch)s" msgstr "此主机没有 %(arch)s 架构" -#: vrtManager/connection.py:1203 +#: vrtManager/connection.py:1214 #, python-format msgid "" "Pool %(pool)s is not active: the files the disks of the VMs in it are made " diff --git a/operations/claims.py b/operations/claims.py index 806261c6..883285fd 100644 --- a/operations/claims.py +++ b/operations/claims.py @@ -41,10 +41,10 @@ def reconcile_key(compute_id): return f"reconcile:{compute_id}" -def evacuate_key(): - """The evacuations: one at a time. One waits in a worker slot for its +def bulk_migrate_key(): + """The bulk migrations: one at a time. One waits in a worker slot for its migrations; several could take every slot and leave none for them.""" - return "evacuate" + return "bulk_migrate" def instance_key(uuid): diff --git a/static/js/bulk_migrate.js b/static/js/bulk_migrate.js new file mode 100644 index 00000000..3067c8c5 --- /dev/null +++ b/static/js/bulk_migrate.js @@ -0,0 +1,17 @@ +// The Bulk Migrate page: another destination reloads the list; the header +// box ticks or unticks every VM that can migrate, "Also migrate the +// shut-off VMs" the shut-off ones. +function tick(selector, checked) { + document.querySelectorAll(selector).forEach(function (box) { + box.checked = checked; + }); +} +document.getElementById("bulk-migrate-target")?.addEventListener("change", function (event) { + event.target.form.submit(); +}); +document.getElementById("bulk-migrate-all")?.addEventListener("change", function (event) { + tick("input[name=instance]:not(:disabled)", event.target.checked); +}); +document.getElementById("bulk-migrate-shut-off")?.addEventListener("change", function (event) { + tick("input[data-shut-off]:not(:disabled)", event.target.checked); +}); diff --git a/static/js/evacuate.js b/static/js/evacuate.js deleted file mode 100644 index 97ea3756..00000000 --- a/static/js/evacuate.js +++ /dev/null @@ -1,6 +0,0 @@ -// The evacuate page: "Also migrate the shut-off VMs" ticks or unticks them. -document.getElementById("evacuate-shut-off")?.addEventListener("change", function (event) { - document.querySelectorAll("input[data-shut-off]:not(:disabled)").forEach(function (box) { - box.checked = event.target.checked; - }); -});