diff --git a/instances/tests/test_create_instance.py b/instances/tests/test_create_instance.py index d0bcf1c4..d3582036 100644 --- a/instances/tests/test_create_instance.py +++ b/instances/tests/test_create_instance.py @@ -4,7 +4,9 @@ from types import SimpleNamespace from unittest.mock import MagicMock, patch from computes.models import Compute +from django.conf import settings from django.contrib.auth import get_user_model +from django.contrib.messages import get_messages from django.test import SimpleTestCase, TestCase from django.urls import reverse from instances.api.serializers import CreateInstanceSerializer @@ -73,6 +75,14 @@ class CreateInstanceViewTests(TestCase): self.assertEqual((kwargs["firmware"], kwargs["machine"], kwargs["tpm_model"]), ("UEFI Secure Boot", "q35", "tpm-crb")) + @patch("instances.views.wvmCreate", new=wvm_create) + @patch("instances.views.NewVMForm") + def test_secure_boot_on_another_machine_type_says_so_in_the_users_language(self, form_class): + self.client.cookies[settings.LANGUAGE_COOKIE_NAME] = "tr" + response, _ = self.create(form_class, machine="pc", firmware="UEFI Secure Boot") + self.assertEqual([str(m) for m in get_messages(response.wsgi_request)], + ["Makine türü pc değil q35: UEFI Secure Boot bunu gerektiriyor"]) + @patch("instances.views.wvmCreate", new=wvm_create) @patch("instances.views.NewVMForm") def test_a_firmware_or_a_tpm_the_host_does_not_offer_is_refused(self, form_class): @@ -103,7 +113,7 @@ class CreateInstanceViewTests(TestCase): conn.create_volume.assert_not_called() conn.create_instance.assert_not_called() - def create(self, form_class, host=None, **data): + def create(self, form_class, host=None, machine="q35", **data): """POST the create form with data over the form's defaults; host: what the mocked host answers, over its defaults.""" user = get_user_model().objects.filter(username="create-test-admin").first() or ( @@ -150,7 +160,7 @@ class CreateInstanceViewTests(TestCase): } response = self.client.post( - reverse("instances:create_instance", args=[compute.id, "x86_64", "q35"]), + reverse("instances:create_instance", args=[compute.id, "x86_64", machine]), {"create": "1", "device0": "disk", "bus0": "virtio", "submission_key": "key-create01"}, ) return response, conn diff --git a/instances/views.py b/instances/views.py index 759cb58a..155e8b12 100755 --- a/instances/views.py +++ b/instances/views.py @@ -2589,11 +2589,8 @@ def create_instance(request, compute_id, arch, machine): messages.error(request, str(err)) else: if op.params["machine"] != machine: - messages.warning( - request, - "Changing machine type from '%s' to 'q35' " - "which is required for UEFI secure boot." % machine, - ) + messages.warning(request, _("The machine type is q35, not %(machine)s: " + "UEFI Secure Boot needs it") % {"machine": machine}) jobs.remember_job(request, op) return redirect(reverse("instances", args=[compute.id])) except libvirtError as lib_err: diff --git a/locale/tr/LC_MESSAGES/django.mo b/locale/tr/LC_MESSAGES/django.mo index 448cd1d6..46a0c6e3 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 78dbfdd7..7b2a1f66 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-10 17:47+0000\n" +"POT-Creation-Date: 2026-11-10 17:48+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" @@ -6484,19 +6484,24 @@ msgid "This host has no network for the VM: add one on its Networks page." msgstr "" "Bu sunucuda sanal makine için ağ yok: Ağlar sayfasından bir tane ekleyin." -#: instances/views.py:2622 +#: instances/views.py:2592 +#, python-format +msgid "The machine type is q35, not %(machine)s: UEFI Secure Boot needs it" +msgstr "Makine türü %(machine)s değil q35: UEFI Secure Boot bunu gerektiriyor" + +#: instances/views.py:2619 msgid "Flavor Created" msgstr "Flavor Oluşturuldu" -#: instances/views.py:2630 +#: instances/views.py:2627 msgid "Create Flavor" msgstr "Kullanıcı Oluştur" -#: instances/views.py:2642 +#: instances/views.py:2639 msgid "Flavor Deleted" msgstr "Flavor Silindi" -#: instances/views.py:2648 +#: instances/views.py:2645 msgid "Only the size template goes; VMs made from it keep their size." msgstr "" "Yalnızca boyut şablonu silinir; ondan oluşturulan sanal makineler boyutlarını" diff --git a/locale/zh/LC_MESSAGES/django.mo b/locale/zh/LC_MESSAGES/django.mo index 62563d3c..46f1fa06 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 0d19b077..e74fca64 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-10 17:47+0000\n" +"POT-Creation-Date: 2026-11-10 17:48+0000\n" "PO-Revision-Date: \n" "Last-Translator: \n" "Language-Team: \n" @@ -6130,19 +6130,24 @@ msgstr "此主机没有可用于虚拟机磁盘的运行中存储池:请在其 msgid "This host has no network for the VM: add one on its Networks page." msgstr "此主机没有可供虚拟机使用的网络:请在其“网络”页面添加一个。" -#: instances/views.py:2622 +#: instances/views.py:2592 +#, python-format +msgid "The machine type is q35, not %(machine)s: UEFI Secure Boot needs it" +msgstr "机器类型为 q35,而不是 %(machine)s:UEFI 安全启动需要它" + +#: instances/views.py:2619 msgid "Flavor Created" msgstr "规格已创建" -#: instances/views.py:2630 +#: instances/views.py:2627 msgid "Create Flavor" msgstr "创建规格" -#: instances/views.py:2642 +#: instances/views.py:2639 msgid "Flavor Deleted" msgstr "规格已删除" -#: instances/views.py:2648 +#: instances/views.py:2645 msgid "Only the size template goes; VMs made from it keep their size." msgstr "仅删除此规格;由它创建的虚拟机保持其大小。"