diff --git a/appsettings/tests/test_appsettings.py b/appsettings/tests/test_appsettings.py index c2006e48..f1c5eb9f 100644 --- a/appsettings/tests/test_appsettings.py +++ b/appsettings/tests/test_appsettings.py @@ -1,4 +1,5 @@ import re +from unittest.mock import patch from django.contrib.auth import get_user_model from django.contrib.messages import get_messages @@ -125,6 +126,31 @@ class AppSettingsTestCase(TestCase): self.post("LOGS_PER_PAGE", "50") self.assertEqual(AppSettings.objects.get(key="LOGS_PER_PAGE").value, "50") + def test_the_pair_is_checked_again_as_saved_when_it_is_saved(self): + # another administrator saved the cache after this page read the settings: the first + # check saw the pair as it was, the second, under the rows' lock, sees it as it is + from appsettings import views + + AppSettings.objects.filter(key="INSTANCE_VOLUME_DEFAULT_CACHE").update(value="writeback") + real = views.combined_refusal + calls = [] + + def stale_first(values): + calls.append(values) + return None if len(calls) == 1 else real(values) + + with patch.object(views, "combined_refusal", side_effect=stale_first): + response = self.client.post(reverse("appsettings"), {"INSTANCE_VOLUME_DEFAULT_IO": "native"}, + HTTP_ACCEPT_LANGUAGE="tr") + self.assertEqual(len(calls), 2) + self.assertEqual([str(m) for m in get_messages(response.wsgi_request)], + ["Disk G/Ç native, disk önbelleği none veya directsync olmasını gerektirir"]) + self.assertEqual(AppSettings.objects.get(key="INSTANCE_VOLUME_DEFAULT_IO").value, "default") + # the log row keeps the reason in English, which each reader sees in their language + from logs.models import Logs + + self.assertIn("Disk I/O native needs disk cache none or directsync", Logs.objects.latest("id").message) + def page(self): from lxml import html diff --git a/appsettings/views.py b/appsettings/views.py index ba253418..dabf62d5 100644 --- a/appsettings/views.py +++ b/appsettings/views.py @@ -11,6 +11,7 @@ from django.utils.translation import gettext as _ from django.utils.translation import gettext_noop from logs.audit import audit from operations.utils import BOUNDS +from vrtManager.util import OperationError from appsettings.models import AppSettings @@ -75,10 +76,10 @@ def refusal(setting, value): def combined_refusal(values): """Why settings that work only together cannot be saved as values - (key: value, saved or new), or None.""" + (key: value, saved or new), untranslated, or None.""" # libvirt refuses such a disk: every new VM would fail if values["INSTANCE_VOLUME_DEFAULT_IO"] == "native" and values["INSTANCE_VOLUME_DEFAULT_CACHE"] not in ("none", "directsync"): - return _("Disk I/O native needs disk cache none or directsync") + return gettext_noop("Disk I/O native needs disk cache none or directsync") return None @@ -113,9 +114,10 @@ def appsettings(request): refusals = [refused for refused in (refusal(s, value) for s, value in changed) if refused] # checked only when the pair changes: a pair saved before does not block other settings pair = {"INSTANCE_VOLUME_DEFAULT_IO", "INSTANCE_VOLUME_DEFAULT_CACHE"} - if not refusals and pair & {s.key for s, _v in changed} and (refused := combined_refusal( + pair_changed = bool(pair & {s.key for s, _v in changed}) + if not refusals and pair_changed and (refused := combined_refusal( {key: s.value for key, s in settings_by_key.items()} | {s.key: value for s, value in changed})): - refusals = [refused] + refusals = [_(refused)] for refused in refusals: messages.error(request, refused) if changed and not refusals: @@ -123,10 +125,16 @@ def appsettings(request): try: # one row, and all of the group or none of it with audit(request, None, "Settings", action), transaction.atomic(): + # the pair as saved now, locked: another administrator's save of its other half + # since this page was read must not make it one libvirt refuses + if pair_changed: + saved = AppSettings.objects.select_for_update().filter(key__in=pair).values_list("key", "value") + if refused := combined_refusal(dict(saved) | {s.key: value for s, value in changed}): + raise OperationError(refused) for setting, value in changed: setting.value = value setting.save() - except DatabaseError as err: # the audit row records it as failed + except (DatabaseError, OperationError) as err: # the audit row records it as failed messages.error(request, err) else: messages.success(request, _("Saved: %(settings)s") % {"settings": ", ".join(s.name for s, _v in changed)}) diff --git a/instances/jobs.py b/instances/jobs.py index 277e186d..097aab7e 100644 --- a/instances/jobs.py +++ b/instances/jobs.py @@ -870,6 +870,16 @@ def _check_macs(conn, data): mac=", ".join(sorted(used & macs))) +def _disk_io(params): + """The disk I/O of Settings for the new VM's disks, refused with a cache + libvirt does not take with it, before any disk is made.""" + io_mode = app_settings.INSTANCE_VOLUME_DEFAULT_IO + if io_mode == "native" and params["cache_mode"] not in ("none", "directsync"): + raise util.OperationError(_("Disk cache %(cache)s does not go with disk I/O native, which Settings set: " + "choose none or directsync"), cache=params["cache_mode"]) + return io_mode + + @register class CreateInstance(Kind): name = "instance.create" @@ -908,6 +918,7 @@ class CreateInstance(Kind): _check_disk_name(conn, data) if data["cache_mode"] not in conn.get_cache_modes(): raise util.OperationError(_("Invalid cache mode")) + _disk_io(data) if data["vcpu_mode"] not in cpu_choices(conn.get_dom_capabilities(data["arch"], data["machine"])): raise util.OperationError(_("This host offers no CPU mode or model %(mode)s"), mode=data["vcpu_mode"]) if data["net_model"] and data["net_model"] not in conn.get_network_models(data["arch"]): @@ -949,6 +960,7 @@ class CreateInstance(Kind): def run(self, op, ctx): data = op.params + io_mode = _disk_io(data) # Settings may have changed since the job was asked for c = Compute.objects.get(pk=data["compute"]) conn = wvmCreate(c.hostname, c.login, c.password, c.type) meta_prealloc = bool(data["meta_prealloc"]) @@ -967,7 +979,7 @@ class CreateInstance(Kind): "cache_mode": data["cache_mode"], "discard_mode": app_settings.INSTANCE_VOLUME_DEFAULT_DISCARD, "detect_zeroes_mode": app_settings.INSTANCE_VOLUME_DEFAULT_DETECT_ZEROES, - "io_mode": app_settings.INSTANCE_VOLUME_DEFAULT_IO, + "io_mode": io_mode, } ctx.record_intent() diff --git a/instances/tests/test_create_job.py b/instances/tests/test_create_job.py index ed461aa8..b77f25b0 100644 --- a/instances/tests/test_create_job.py +++ b/instances/tests/test_create_job.py @@ -80,6 +80,29 @@ class CreateJobTestCase(TransactionTestCase): self.assertEqual(response.status_code, 400) self.assertFalse(Operation.objects.exists()) + def test_a_cache_that_does_not_go_with_the_settings_io_is_refused_and_the_io_kept(self): + # libvirt refuses native I/O with a cache other than none or directsync, after the disks are made + from appsettings.models import AppSettings + + self.conn.get_cache_modes.return_value = {"none": "Disable cache", "writeback": "Write back"} + # a TransactionTestCase run before may have emptied the table + AppSettings.objects.update_or_create(key="INSTANCE_VOLUME_DEFAULT_IO", defaults={ + "name": "Disk IO Type", "value": "native", "choices": "default,native,threads"}) + url = f"/api/v1/computes/{self.compute.pk}/instances/create/x86_64/q35/" + response = self.client.post(url, {**BODY, "cache_mode": "writeback"}, content_type="application/json") + self.assertEqual(response.status_code, 400) + self.assertIn("does not go with disk I/O native", str(response.json())) + self.assertEqual(self.client.post(url, BODY, content_type="application/json").status_code, 202) + # a pair Settings made one libvirt refuses after the job was asked for: refused before a disk is made + op = Operation.objects.get() + Operation.objects.filter(pk=op.pk).update(params={**op.params, "cache_mode": "writeback"}) + acquire("wvc-test:1:a", "wvc-test") + Operation.objects.filter(pk=op.pk).update(state=Operation.RUNNING, worker="wvc-test:1:a") + op.refresh_from_db() + with self.assertRaisesRegex(OperationError, "does not go with disk I/O native"): + CreateInstance().run(op, Context(op, SimpleNamespace(identity="wvc-test:1:a"))) + self.conn.create_volume.assert_not_called() + def test_the_cpu_is_a_mode_or_a_model_the_host_offers(self): url = f"/api/v1/computes/{self.compute.pk}/instances/create/x86_64/q35/" # a model name longer than 20 characters is taken; none, or one the host lacks, is refused diff --git a/locale/tr/LC_MESSAGES/django.mo b/locale/tr/LC_MESSAGES/django.mo index 632b397d..e87b97b0 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 4b1aea20..155fedb2 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-13 08:46+0000\n" +"POT-Creation-Date: 2026-11-13 09:45+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" @@ -1736,89 +1736,89 @@ msgstr "Temayı değiştir" msgid "Save %(group_title)s" msgstr "%(group_title)s kaydet" -#: appsettings/views.py:38 +#: appsettings/views.py:39 msgid "New VM defaults" msgstr "Yeni sanal makine varsayılanları" -#: appsettings/views.py:41 instances/templates/instance.html:70 +#: appsettings/views.py:42 instances/templates/instance.html:70 #: instances/templates/instances/destroy_instance_form.html:33 #: instances/templates/instances/resize_tab.html:21 #: instances/templates/instances/settings_tab.html:197 msgid "Disks" msgstr "Diskler" -#: appsettings/views.py:45 +#: appsettings/views.py:46 msgid "Clones" msgstr "Klonlar" -#: appsettings/views.py:46 console/templates/console-base.html:10 +#: appsettings/views.py:47 console/templates/console-base.html:10 #: console/templates/console-base.html:23 #: instances/templates/instance_actions.html:11 #: instances/templates/instances/settings_tab.html:32 msgid "Console" msgstr "Konsol" -#: appsettings/views.py:47 +#: appsettings/views.py:48 msgid "VM access and owners" msgstr "Sanal makine erişimi ve sahipleri" -#: appsettings/views.py:49 +#: appsettings/views.py:50 msgid "Snapshots and jobs" msgstr "Anlık görüntüler ve işler" -#: appsettings/views.py:51 +#: appsettings/views.py:52 msgid "Login" msgstr "Oturum açma" -#: appsettings/views.py:52 +#: appsettings/views.py:53 msgid "Lists and pages" msgstr "Listeler ve sayfalar" -#: appsettings/views.py:60 +#: appsettings/views.py:61 #, python-format msgid "%(setting)s takes at most %(length)s characters" msgstr "%(setting)s en fazla %(length)s karakter alır" -#: appsettings/views.py:65 +#: appsettings/views.py:66 #, python-format msgid "%(setting)s must be a whole number between %(low)s and %(high)s" msgstr "%(setting)s, %(low)s ile %(high)s arasında bir tam sayı olmalıdır" -#: appsettings/views.py:68 +#: appsettings/views.py:69 #, python-format msgid "%(setting)s must be one of %(choices)s" msgstr "%(setting)s şunlardan biri olmalıdır: %(choices)s" -#: appsettings/views.py:72 +#: appsettings/views.py:73 #, python-format msgid "%(setting)s takes letters, digits and '-' only" msgstr "%(setting)s yalnızca harf, rakam ve '-' alır" -#: appsettings/views.py:81 +#: appsettings/views.py:82 msgid "Disk I/O native needs disk cache none or directsync" msgstr "" "Disk G/Ç native, disk önbelleği none veya directsync olmasını gerektirir" -#: appsettings/views.py:98 +#: appsettings/views.py:99 #, python-format msgid "Unknown theme: %(theme)s" msgstr "Bilinmeyen tema: %(theme)s" -#: appsettings/views.py:104 +#: appsettings/views.py:105 #, python-format msgid "Theme is changed. Now: %(theme)s" msgstr "Tema değiştirildi. Şimdi: %(theme)s" -#: appsettings/views.py:132 +#: appsettings/views.py:140 #, python-format msgid "Saved: %(settings)s" msgstr "Kaydedildi: %(settings)s" -#: appsettings/views.py:134 +#: appsettings/views.py:142 msgid "Nothing changed" msgstr "Hiçbir şey değişmedi" -#: appsettings/views.py:141 vrtManager/nodedevs.py:294 +#: appsettings/views.py:149 vrtManager/nodedevs.py:294 #: vrtManager/nodedevs.py:333 msgid "Other" msgstr "Diğer" @@ -2994,7 +2994,7 @@ msgstr "" msgid "Clone VM" msgstr "Sanal makineyi klonla" -#: instances/jobs.py:639 instances/jobs.py:646 instances/jobs.py:974 +#: instances/jobs.py:639 instances/jobs.py:646 instances/jobs.py:980 msgid "Copying disks" msgstr "Diskler kopyalanıyor" @@ -3099,68 +3099,77 @@ msgstr "" msgid "Create VM" msgstr "Sanal makine oluştur" -#: instances/jobs.py:900 instances/jobs.py:945 instances/views.py:2542 +#: instances/jobs.py:903 instances/jobs.py:951 instances/views.py:2542 msgid "A virtual machine with this name already exists" msgstr "Bu isimde bir sanal makine mevcut" -#: instances/jobs.py:902 instances/jobs.py:941 +#: instances/jobs.py:905 instances/jobs.py:947 msgid "There is an instance with same name. Remove it and try again!" msgstr "Aynı isimde başka bir sanal makine var. Onu silip yeniden deneyin!" -#: instances/jobs.py:905 +#: instances/jobs.py:908 msgid "First you need to create or select an image" msgstr "Öncelikle bir imaj oluşturun ya da mevcut bir imajı seçin" -#: instances/jobs.py:907 +#: instances/jobs.py:910 msgid "Choose one disk source: a new disk, existing volumes or a template" msgstr "" "Tek bir disk kaynağı seçin: yeni bir disk, mevcut birimler ya da bir şablon" -#: instances/jobs.py:910 +#: instances/jobs.py:913 msgid "Invalid cache mode" msgstr "Geçersiz önbellek modu" -#: instances/jobs.py:912 +#: instances/jobs.py:915 +#, python-format +msgid "" +"Disk cache %(cache)s does not go with disk I/O native, which Settings set: " +"choose none or directsync" +msgstr "" +"%(cache)s disk önbelleği, Ayarlar'daki native disk G/Ç ile kullanılamaz: none" +" ya da directsync seçin" + +#: instances/jobs.py:918 #, python-format msgid "This host offers no CPU mode or model %(mode)s" msgstr "Bu sunucu %(mode)s CPU modunu veya modelini sunmuyor" -#: instances/jobs.py:914 +#: instances/jobs.py:920 #, python-format msgid "A %(arch)s VM cannot have a %(model)s network card" msgstr "Bir %(arch)s VM'inde %(model)s ağ kartı olamaz" -#: instances/jobs.py:916 +#: instances/jobs.py:922 #, python-format msgid "A CD-ROM cannot use the %(bus)s bus" msgstr "CD-ROM %(bus)s veri yolunu kullanamaz" -#: instances/jobs.py:919 +#: instances/jobs.py:925 msgid "The cloud-init seed is read from a CD-ROM: choose its bus" msgstr "cloud-init tohumu bir CD-ROM'dan okunur: veri yolunu seçin" -#: instances/jobs.py:922 +#: instances/jobs.py:928 msgid "The cloud-init seed needs a directory storage pool for the disk" msgstr "cloud-init tohumu, disk için bir dizin depolama havuzu gerektirir" -#: instances/jobs.py:926 +#: instances/jobs.py:932 #, python-format msgid "This host offers no firmware %(firmware)s" msgstr "Bu sunucu %(firmware)s firmware'ini sunmuyor" -#: instances/jobs.py:928 vrtManager/instance.py:3195 +#: instances/jobs.py:934 vrtManager/instance.py:3195 msgid "This host offers no TPM 2.0: install swtpm on it" msgstr "Bu sunucu TPM 2.0 sunmuyor: üzerine swtpm kurun" -#: instances/jobs.py:994 +#: instances/jobs.py:1000 msgid "Writing the cloud-init seed" msgstr "cloud-init tohumu yazılıyor" -#: instances/jobs.py:1001 +#: instances/jobs.py:1007 msgid "Defining the VM" msgstr "Sanal makine tanımlanıyor" -#: instances/jobs.py:1043 +#: instances/jobs.py:1049 #, python-format msgid "" "The panel failed unexpectedly; its log has the details. Remove these volumes " @@ -3169,114 +3178,114 @@ msgstr "" "Panel beklenmedik bir hatayla karşılaştı; ayrıntılar panelin günlüğünde. Bu " "birimleri elle kaldırın: %(volumes)s" -#: instances/jobs.py:1047 +#: instances/jobs.py:1053 #, python-format msgid "%(error)s. Remove these volumes by hand: %(volumes)s" msgstr "%(error)s. Şu birimleri elle silin: %(volumes)s" -#: instances/jobs.py:1074 +#: instances/jobs.py:1080 #, python-format msgid "The instance is already on %(compute)s" msgstr "Sanal makine zaten %(compute)s üzerinde" -#: instances/jobs.py:1076 +#: instances/jobs.py:1082 #, python-format msgid "%(compute)s is not reachable" msgstr "%(compute)s sunucusuna ulaşılamıyor" -#: instances/jobs.py:1078 +#: instances/jobs.py:1084 #, python-format msgid "%(compute)s is the VM's own host under another name" msgstr "%(compute)s, sanal makinenin kendi sunucusunun başka bir adı" -#: instances/jobs.py:1135 +#: instances/jobs.py:1141 #, python-format msgid "" "The VM migrated, but autostart could not be set on the destination: %(error)s" msgstr "" "Sanal makine taşındı, ancak hedefte otomatik başlatma ayarlanamadı: %(error)s" -#: instances/jobs.py:1142 +#: instances/jobs.py:1148 #, python-format msgid "The VM migrated, but its NVRAM file stays on the source: %(error)s" msgstr "Sanal makine taşındı, ancak NVRAM dosyası kaynakta kaldı: %(error)s" -#: instances/jobs.py:1150 +#: instances/jobs.py:1156 msgid "Migrate VM" msgstr "Sanal makineyi taşı" -#: instances/jobs.py:1197 +#: instances/jobs.py:1203 msgid "Migrating the VM" msgstr "Sanal makine taşınıyor" -#: instances/jobs.py:1246 +#: instances/jobs.py:1252 msgid "libvirt is still migrating the VM" msgstr "libvirt sanal makineyi hâlâ taşıyor" -#: instances/jobs.py:1258 +#: instances/jobs.py:1264 msgid "The VM stayed on the source host" msgstr "Sanal makine kaynak sunucuda kaldı" -#: instances/jobs.py:1260 +#: instances/jobs.py:1266 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:1279 +#: instances/jobs.py:1285 msgid "Move disk" msgstr "Diski taşı" -#: instances/jobs.py:1286 +#: instances/jobs.py:1292 msgid "Choose a disk of the VM" msgstr "Sanal makinenin bir diskini seçin" -#: instances/jobs.py:1310 +#: instances/jobs.py:1316 msgid "Copying the disk" msgstr "Disk kopyalanıyor" -#: instances/jobs.py:1352 +#: instances/jobs.py:1358 #, 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:1358 +#: instances/jobs.py:1364 #, 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:1360 +#: instances/jobs.py:1366 #, 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:1367 +#: instances/jobs.py:1373 #, 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:1368 +#: instances/jobs.py:1374 #, 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:1369 +#: instances/jobs.py:1375 #, 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:1423 +#: instances/jobs.py:1429 msgid "Delete VM" msgstr "Sanal makineyi sil" -#: instances/jobs.py:1453 +#: instances/jobs.py:1459 msgid "Deleting the VM" msgstr "Sanal makine siliniyor" -#: instances/jobs.py:1465 +#: instances/jobs.py:1471 msgid "The VM was not deleted; it may have been shut off" msgstr "Sanal makine silinmedi; kapatılmış olabilir" diff --git a/locale/zh/LC_MESSAGES/django.mo b/locale/zh/LC_MESSAGES/django.mo index b781d7a1..fde75c31 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 a0d45435..5fe7a345 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-13 08:46+0000\n" +"POT-Creation-Date: 2026-11-13 09:45+0000\n" "PO-Revision-Date: \n" "Last-Translator: \n" "Language-Team: \n" @@ -1679,88 +1679,88 @@ msgstr "更改主题" msgid "Save %(group_title)s" msgstr "保存%(group_title)s" -#: appsettings/views.py:38 +#: appsettings/views.py:39 msgid "New VM defaults" msgstr "新建虚拟机默认值" -#: appsettings/views.py:41 instances/templates/instance.html:70 +#: appsettings/views.py:42 instances/templates/instance.html:70 #: instances/templates/instances/destroy_instance_form.html:33 #: instances/templates/instances/resize_tab.html:21 #: instances/templates/instances/settings_tab.html:197 msgid "Disks" msgstr "磁盘" -#: appsettings/views.py:45 +#: appsettings/views.py:46 msgid "Clones" msgstr "克隆" -#: appsettings/views.py:46 console/templates/console-base.html:10 +#: appsettings/views.py:47 console/templates/console-base.html:10 #: console/templates/console-base.html:23 #: instances/templates/instance_actions.html:11 #: instances/templates/instances/settings_tab.html:32 msgid "Console" msgstr "控制台" -#: appsettings/views.py:47 +#: appsettings/views.py:48 msgid "VM access and owners" msgstr "虚拟机访问与所有者" -#: appsettings/views.py:49 +#: appsettings/views.py:50 msgid "Snapshots and jobs" msgstr "快照与任务" -#: appsettings/views.py:51 +#: appsettings/views.py:52 msgid "Login" msgstr "登录" -#: appsettings/views.py:52 +#: appsettings/views.py:53 msgid "Lists and pages" msgstr "列表与页面" -#: appsettings/views.py:60 +#: appsettings/views.py:61 #, python-format msgid "%(setting)s takes at most %(length)s characters" msgstr "%(setting)s 最多 %(length)s 个字符" -#: appsettings/views.py:65 +#: appsettings/views.py:66 #, python-format msgid "%(setting)s must be a whole number between %(low)s and %(high)s" msgstr "%(setting)s 必须是 %(low)s 到 %(high)s 之间的整数" -#: appsettings/views.py:68 +#: appsettings/views.py:69 #, python-format msgid "%(setting)s must be one of %(choices)s" msgstr "%(setting)s 必须是以下之一:%(choices)s" -#: appsettings/views.py:72 +#: appsettings/views.py:73 #, python-format msgid "%(setting)s takes letters, digits and '-' only" msgstr "%(setting)s 只能包含字母、数字和 '-'" -#: appsettings/views.py:81 +#: appsettings/views.py:82 msgid "Disk I/O native needs disk cache none or directsync" msgstr "磁盘 I/O native 需要磁盘缓存为 none 或 directsync" -#: appsettings/views.py:98 +#: appsettings/views.py:99 #, python-format msgid "Unknown theme: %(theme)s" msgstr "未知主题:%(theme)s" -#: appsettings/views.py:104 +#: appsettings/views.py:105 #, python-format msgid "Theme is changed. Now: %(theme)s" msgstr "主题已更改。当前:%(theme)s" -#: appsettings/views.py:132 +#: appsettings/views.py:140 #, python-format msgid "Saved: %(settings)s" msgstr "已保存:%(settings)s" -#: appsettings/views.py:134 +#: appsettings/views.py:142 msgid "Nothing changed" msgstr "没有任何更改" -#: appsettings/views.py:141 vrtManager/nodedevs.py:294 +#: appsettings/views.py:149 vrtManager/nodedevs.py:294 #: vrtManager/nodedevs.py:333 msgid "Other" msgstr "其他" @@ -2872,7 +2872,7 @@ msgstr "%(vm)s 已暂停,其文件系统可能仍处于冻结状态:请先 msgid "Clone VM" msgstr "克隆虚拟机" -#: instances/jobs.py:639 instances/jobs.py:646 instances/jobs.py:974 +#: instances/jobs.py:639 instances/jobs.py:646 instances/jobs.py:980 msgid "Copying disks" msgstr "正在复制磁盘" @@ -2962,176 +2962,183 @@ msgstr "MAC 地址 %(mac)s 已属于此主机上另一台虚拟机的网卡" msgid "Create VM" msgstr "创建虚拟机" -#: instances/jobs.py:900 instances/jobs.py:945 instances/views.py:2542 +#: instances/jobs.py:903 instances/jobs.py:951 instances/views.py:2542 msgid "A virtual machine with this name already exists" msgstr "同名虚拟机已存在" -#: instances/jobs.py:902 instances/jobs.py:941 +#: instances/jobs.py:905 instances/jobs.py:947 msgid "There is an instance with same name. Remove it and try again!" msgstr "已存在同名虚拟机。请删除后重试!" -#: instances/jobs.py:905 +#: instances/jobs.py:908 msgid "First you need to create or select an image" msgstr "请先创建或选择一个镜像" -#: instances/jobs.py:907 +#: instances/jobs.py:910 msgid "Choose one disk source: a new disk, existing volumes or a template" msgstr "请选择一种磁盘来源:新磁盘、现有卷或模板" -#: instances/jobs.py:910 +#: instances/jobs.py:913 msgid "Invalid cache mode" msgstr "无效的缓存模式" -#: instances/jobs.py:912 +#: instances/jobs.py:915 +#, python-format +msgid "" +"Disk cache %(cache)s does not go with disk I/O native, which Settings set: " +"choose none or directsync" +msgstr "磁盘缓存 %(cache)s 与设置中的原生 (native) 磁盘 I/O 不兼容:请选择 none 或 directsync" + +#: instances/jobs.py:918 #, python-format msgid "This host offers no CPU mode or model %(mode)s" msgstr "此主机不提供 CPU 模式或型号 %(mode)s" -#: instances/jobs.py:914 +#: instances/jobs.py:920 #, python-format msgid "A %(arch)s VM cannot have a %(model)s network card" msgstr "%(arch)s 虚拟机不能使用 %(model)s 网卡" -#: instances/jobs.py:916 +#: instances/jobs.py:922 #, python-format msgid "A CD-ROM cannot use the %(bus)s bus" msgstr "CD-ROM 不能使用 %(bus)s 总线" -#: instances/jobs.py:919 +#: instances/jobs.py:925 msgid "The cloud-init seed is read from a CD-ROM: choose its bus" msgstr "cloud-init 种子从 CD-ROM 读取:请选择其总线" -#: instances/jobs.py:922 +#: instances/jobs.py:928 msgid "The cloud-init seed needs a directory storage pool for the disk" msgstr "cloud-init 种子需要为磁盘使用目录类型的存储池" -#: instances/jobs.py:926 +#: instances/jobs.py:932 #, python-format msgid "This host offers no firmware %(firmware)s" msgstr "此主机不提供固件 %(firmware)s" -#: instances/jobs.py:928 vrtManager/instance.py:3195 +#: instances/jobs.py:934 vrtManager/instance.py:3195 msgid "This host offers no TPM 2.0: install swtpm on it" msgstr "此主机不提供 TPM 2.0:请在主机上安装 swtpm" -#: instances/jobs.py:994 +#: instances/jobs.py:1000 msgid "Writing the cloud-init seed" msgstr "正在写入 cloud-init 种子" -#: instances/jobs.py:1001 +#: instances/jobs.py:1007 msgid "Defining the VM" msgstr "正在定义虚拟机" -#: instances/jobs.py:1043 +#: instances/jobs.py:1049 #, python-format msgid "" "The panel failed unexpectedly; its log has the details. Remove these volumes " "by hand: %(volumes)s" msgstr "面板发生意外错误;详细信息见面板日志。请手动删除这些卷:%(volumes)s" -#: instances/jobs.py:1047 +#: instances/jobs.py:1053 #, python-format msgid "%(error)s. Remove these volumes by hand: %(volumes)s" msgstr "%(error)s。请手动删除这些卷:%(volumes)s" -#: instances/jobs.py:1074 +#: instances/jobs.py:1080 #, python-format msgid "The instance is already on %(compute)s" msgstr "虚拟机已在 %(compute)s 上" -#: instances/jobs.py:1076 +#: instances/jobs.py:1082 #, python-format msgid "%(compute)s is not reachable" msgstr "无法连接 %(compute)s" -#: instances/jobs.py:1078 +#: instances/jobs.py:1084 #, python-format msgid "%(compute)s is the VM's own host under another name" msgstr "%(compute)s 是该虚拟机所在主机的另一个名称" -#: instances/jobs.py:1135 +#: instances/jobs.py:1141 #, python-format msgid "" "The VM migrated, but autostart could not be set on the destination: %(error)s" msgstr "虚拟机已迁移,但无法在目标主机上设置自动启动:%(error)s" -#: instances/jobs.py:1142 +#: instances/jobs.py:1148 #, python-format msgid "The VM migrated, but its NVRAM file stays on the source: %(error)s" msgstr "虚拟机已迁移,但其 NVRAM 文件仍留在源主机上:%(error)s" -#: instances/jobs.py:1150 +#: instances/jobs.py:1156 msgid "Migrate VM" msgstr "迁移虚拟机" -#: instances/jobs.py:1197 +#: instances/jobs.py:1203 msgid "Migrating the VM" msgstr "正在迁移虚拟机" -#: instances/jobs.py:1246 +#: instances/jobs.py:1252 msgid "libvirt is still migrating the VM" msgstr "libvirt 仍在迁移虚拟机" -#: instances/jobs.py:1258 +#: instances/jobs.py:1264 msgid "The VM stayed on the source host" msgstr "虚拟机留在了源主机上" -#: instances/jobs.py:1260 +#: instances/jobs.py:1266 msgid "" "The VM is on both computes or on neither; check them, then resolve this job." msgstr "虚拟机同时位于两个计算节点上,或都不在;请检查后处理此任务。" -#: instances/jobs.py:1279 +#: instances/jobs.py:1285 msgid "Move disk" msgstr "移动磁盘" -#: instances/jobs.py:1286 +#: instances/jobs.py:1292 msgid "Choose a disk of the VM" msgstr "请选择虚拟机的一个磁盘" -#: instances/jobs.py:1310 +#: instances/jobs.py:1316 msgid "Copying the disk" msgstr "正在复制磁盘" -#: instances/jobs.py:1352 +#: instances/jobs.py:1358 #, python-format msgid "Another block job runs on %(dev)s; check the VM" msgstr "%(dev)s 上正在运行另一个块任务;请检查虚拟机" -#: instances/jobs.py:1358 +#: instances/jobs.py:1364 #, python-format msgid "The disk stayed in %(path)s; remove %(dest)s if it is there" msgstr "磁盘仍在 %(path)s;如果 %(dest)s 存在,请将其删除" -#: instances/jobs.py:1360 +#: instances/jobs.py:1366 #, python-format msgid "The definitions of %(dev)s name %(paths)s; check the VM" msgstr "%(dev)s 的定义指向 %(paths)s;请检查虚拟机" -#: instances/jobs.py:1367 +#: instances/jobs.py:1373 #, python-format msgid "Disk %(path)s was kept: a disk file that stays needs it" msgstr "磁盘 %(path)s 已保留:某个保留的磁盘文件依赖它" -#: instances/jobs.py:1368 +#: instances/jobs.py:1374 #, python-format msgid "The VM is removed, but disk %(path)s was not deleted: %(err)s" msgstr "虚拟机已删除,但磁盘 %(path)s 未被删除:%(err)s" -#: instances/jobs.py:1369 +#: instances/jobs.py:1375 #, python-format msgid "Disk %(path)s is used by another VM and was kept" msgstr "磁盘 %(path)s 正被另一台虚拟机使用,已保留" -#: instances/jobs.py:1423 +#: instances/jobs.py:1429 msgid "Delete VM" msgstr "删除虚拟机" -#: instances/jobs.py:1453 +#: instances/jobs.py:1459 msgid "Deleting the VM" msgstr "正在删除虚拟机" -#: instances/jobs.py:1465 +#: instances/jobs.py:1471 msgid "The VM was not deleted; it may have been shut off" msgstr "虚拟机未被删除;它可能已被关闭"