diff --git a/accounts/migrations/0014_backup_quota.py b/accounts/migrations/0014_backup_quota.py new file mode 100644 index 00000000..03099e76 --- /dev/null +++ b/accounts/migrations/0014_backup_quota.py @@ -0,0 +1,19 @@ +# Generated by Django 5.2.18 on 2026-11-17 16:04 + +import django.core.validators +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('accounts', '0013_default_admin_password'), + ] + + operations = [ + migrations.AddField( + model_name='userattributes', + name='max_backup_size', + field=models.IntegerField(default=0, help_text='-1: no limit; 0: none allowed', validators=[django.core.validators.MinValueValidator(-1)], verbose_name='max backup size (GiB)'), + ), + ] diff --git a/accounts/models.py b/accounts/models.py index 07e65862..6770720a 100644 --- a/accounts/models.py +++ b/accounts/models.py @@ -67,6 +67,12 @@ class UserAttributes(models.Model): help_text=_("-1: no limit; 0: none allowed"), validators=[MinValueValidator(-1)], ) + max_backup_size = models.IntegerField( + _("max backup size (GiB)"), + default=0, + help_text=_("-1: no limit; 0: none allowed"), + validators=[MinValueValidator(-1)], + ) def __str__(self): return self.user.username diff --git a/admin/forms.py b/admin/forms.py index a428b8e7..a504f485 100644 --- a/admin/forms.py +++ b/admin/forms.py @@ -19,6 +19,7 @@ from .models import Permission # each permission's name in the user's language: the database keeps the English one PERMISSION_NAMES = { + "backup_instances": _("Can back up instances"), "change_password": _("Can change password"), "clone_instances": _("Can clone instances"), "passwordless_console": _("Can access console without password"), @@ -28,6 +29,8 @@ PERMISSION_NAMES = { # what each permission lets a user do, shown beside its switch PERMISSION_HELP = { + "backup_instances": _("Back up the VMs they may change into targets open to VM owners, restore those backups over " + "the VM or as a new VM, and delete the backups they took, within their quotas"), "change_password": _("Change their own password on their profile page"), "clone_instances": _("Clone the VMs they may change and the templates they may view, within their quota"), "passwordless_console": _("Open a console without the VM's console password"), @@ -197,7 +200,7 @@ class UserCreateForm(UserForm): # the quota's limits, with the unit each is entered in (memory in GiB, kept in MiB) -QUOTA_UNITS = {"max_instances": "", "max_cpus": "", "max_memory": "GiB", "max_disk_size": "GiB"} +QUOTA_UNITS = {"max_instances": "", "max_cpus": "", "max_memory": "GiB", "max_disk_size": "GiB", "max_backup_size": "GiB"} class UserAttributesForm(forms.ModelForm): @@ -208,6 +211,7 @@ class UserAttributesForm(forms.ModelForm): max_cpus = forms.IntegerField(label=_("vCPUs"), min_value=0, required=False) max_memory = forms.DecimalField(label=_("Memory"), min_value=0, required=False) max_disk_size = forms.IntegerField(label=_("Disk"), min_value=0, required=False) + max_backup_size = forms.IntegerField(label=_("Backups"), min_value=0, required=False) class Meta: model = UserAttributes diff --git a/admin/tests/test_audit_rows.py b/admin/tests/test_audit_rows.py index 190d704a..91cc2e23 100644 --- a/admin/tests/test_audit_rows.py +++ b/admin/tests/test_audit_rows.py @@ -7,7 +7,7 @@ from django.urls import reverse from logs.models import Logs from admin.tests.edits import group_seen, user_seen -ATTRIBUTES = {"role": "user", "max_instances": 2, "max_cpus": 2, "max_memory": 2, "max_disk_size": 20} +ATTRIBUTES = {"role": "user", "max_instances": 2, "max_cpus": 2, "max_memory": 2, "max_disk_size": 20, "max_backup_size": 0} def rows(): diff --git a/admin/tests/test_user_create.py b/admin/tests/test_user_create.py index d6258d3b..91db210d 100644 --- a/admin/tests/test_user_create.py +++ b/admin/tests/test_user_create.py @@ -13,7 +13,7 @@ from computes.models import Compute from instances.models import Instance RAW = "Raw-Passw0rd-in-the-form" -LIMITS = {"role": "user", "max_instances": 1, "max_cpus": 1, "max_memory": 1, "max_disk_size": 4} +LIMITS = {"role": "user", "max_instances": 1, "max_cpus": 1, "max_memory": 1, "max_disk_size": 4, "max_backup_size": 0} class UserCreateTests(TestCase): diff --git a/admin/tests/test_user_pages.py b/admin/tests/test_user_pages.py index f59609ea..bbf69991 100644 --- a/admin/tests/test_user_pages.py +++ b/admin/tests/test_user_pages.py @@ -28,7 +28,7 @@ class UserPagesTests(TestCase): def form_data(self, user, **changes): data = {"username": user.username, "is_active": "on", "role": "superuser" if user.is_superuser else "user", - "max_instances": "2", "max_cpus": "2", "max_memory": "2", "max_disk_size": "20", "seen": user_seen(user), + "max_instances": "2", "max_cpus": "2", "max_memory": "2", "max_disk_size": "20", "max_backup_size": 0, "seen": user_seen(user), **changes} return {key: value for key, value in data.items() if value != ""} @@ -77,7 +77,7 @@ class UserPagesTests(TestCase): def test_a_refused_choice_is_said_beside_its_field(self): url = reverse("admin:user_update", args=[self.alice.pk]) response = self.client.post(url, {"username": "up-alice", "is_active": "on", "groups": "99999", "user_permissions": "99999", - "role": "user", "max_instances": 1, "max_cpus": 1, "max_memory": 1, "max_disk_size": 1, + "role": "user", "max_instances": 1, "max_cpus": 1, "max_memory": 1, "max_disk_size": 1, "max_backup_size": 0, "seen": user_seen(self.alice)}) page = html.fromstring(response.content) self.assertEqual(len(page.xpath("//fieldset//div[contains(@class, 'invalid-feedback')]")), 2) @@ -99,13 +99,13 @@ class UserPagesTests(TestCase): page = html.fromstring(self.client.get(reverse("admin:user_update", args=[self.alice.pk])).content) shown = {box.get("name"): (box.get("value"), box.get("disabled") is not None) for box in page.xpath("//input[@type='number']")} self.assertEqual(shown, {"max_instances": ("", True), "max_cpus": ("1", False), "max_memory": ("1.5", False), - "max_disk_size": ("", True)}) + "max_disk_size": ("", True), "max_backup_size": ("0", False)}) self.assertEqual(page.xpath("//input[@checked][@data-no-limit]/@name"), ["max_instances_unlimited", "max_disk_size_unlimited"]) def test_a_new_user_starts_with_the_default_quota(self): page = html.fromstring(self.client.get(reverse("admin:user_create")).content) shown = {box.get("name"): box.get("value") for box in page.xpath("//input[@type='number']")} - self.assertEqual(shown, {"max_instances": "2", "max_cpus": "2", "max_memory": "2", "max_disk_size": "20"}) + self.assertEqual(shown, {"max_instances": "2", "max_cpus": "2", "max_memory": "2", "max_disk_size": "20", "max_backup_size": "0"}) self.assertEqual(page.xpath("//input[@name='role'][@checked]/@value"), ["user"]) def test_no_limit_is_kept_as_minus_one_and_gib_as_mib(self): @@ -222,7 +222,7 @@ class SavedAsCheckedTests(TestCase): with self.meanwhile(take): response = self.client.post(reverse("admin:user_create"), { "username": "sc-bob", "email": "bob@example.com", "password": "Wvc-bob-pass-9", "role": "user", - "max_instances": 1, "max_cpus": 1, "max_memory": 1, "max_disk_size": 1}) + "max_instances": 1, "max_cpus": 1, "max_memory": 1, "max_disk_size": 1, "max_backup_size": 0}) self.assertEqual(response.status_code, 200) self.assertFalse(get_user_model().objects.filter(username="sc-bob").exists()) @@ -231,7 +231,7 @@ class SavedAsCheckedTests(TestCase): alice = get_user_model().objects.create_user("sc-alice") url = reverse("admin:user_update", args=[alice.pk]) data = {"username": "sc-alice", "is_active": "on", "role": "user", "max_instances": 1, "max_cpus": 1, - "max_memory": 1, "max_disk_size": 1, "seen": user_seen(alice)} + "max_memory": 1, "max_disk_size": 1, "max_backup_size": 0, "seen": user_seen(alice)} with self.meanwhile(lambda: get_user_model().objects.filter(pk=alice.pk).update(is_active=False)): response = self.client.post(url, data) self.assertRedirects(response, url, fetch_redirect_response=False) @@ -244,7 +244,7 @@ class SavedAsCheckedTests(TestCase): with patch("admin.views.users_lock", side_effect=claims.Busy("users")): response = self.client.post(reverse("admin:user_create"), { "username": "sc-carl", "password": "Wvc-carl-pass-9", "role": "user", - "max_instances": 1, "max_cpus": 1, "max_memory": 1, "max_disk_size": 1}) + "max_instances": 1, "max_cpus": 1, "max_memory": 1, "max_disk_size": 1, "max_backup_size": 0}) self.assertContains(response, "short operation") self.assertFalse(get_user_model().objects.filter(username="sc-carl").exists()) diff --git a/admin/tests/test_user_update_next.py b/admin/tests/test_user_update_next.py index d6d25033..8480a35d 100644 --- a/admin/tests/test_user_update_next.py +++ b/admin/tests/test_user_update_next.py @@ -5,7 +5,7 @@ from django.test import TestCase from django.urls import reverse from admin.tests.edits import user_seen -LIMITS = {"role": "user", "max_instances": 1, "max_cpus": 1, "max_memory": 1, "max_disk_size": 4} +LIMITS = {"role": "user", "max_instances": 1, "max_cpus": 1, "max_memory": 1, "max_disk_size": 4, "max_backup_size": 0} class UserUpdateNextTests(TestCase): diff --git a/admin/tests/test_views.py b/admin/tests/test_views.py index 4fdec63f..2bc11652 100644 --- a/admin/tests/test_views.py +++ b/admin/tests/test_views.py @@ -106,7 +106,7 @@ class AdminTestCase(TestCase): for block in (lambda: self.client.post(reverse("admin:user_block", args=[user.id])), lambda: self.client.post(reverse("admin:user_update", args=[user.id]), {"username": "taken", "role": "user", "max_instances": 1, "max_cpus": 1, - "max_memory": 1, "max_disk_size": 1, "seen": user_seen(user)})): + "max_memory": 1, "max_disk_size": 1, "max_backup_size": 0, "seen": user_seen(user)})): _, token = ApiToken.objects.create(user) self.assertEqual(block().status_code, 302) self.client.post(reverse("admin:user_unblock", args=[user.id])) @@ -126,7 +126,7 @@ class AdminTestCase(TestCase): "max_instances": 1, "max_cpus": 1, "max_memory": 1, # GiB - "max_disk_size": 4, + "max_disk_size": 4, "max_backup_size": 0, }, ) self.assertRedirects(response, reverse("admin:user_list")) @@ -153,7 +153,7 @@ class AdminTestCase(TestCase): "max_instances": 2, "max_cpus": 2, "max_memory": 2, # GiB - "max_disk_size": 8, + "max_disk_size": 8, "max_backup_size": 0, }, ) self.assertRedirects(response, reverse("admin:user_list")) diff --git a/instances/migrations/0017_backup_permission.py b/instances/migrations/0017_backup_permission.py new file mode 100644 index 00000000..c582abfa --- /dev/null +++ b/instances/migrations/0017_backup_permission.py @@ -0,0 +1,17 @@ +# Generated by Django 5.2.18 on 2026-11-17 16:04 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('instances', '0016_vm_name_length'), + ] + + operations = [ + migrations.AlterModelOptions( + name='permissionset', + options={'default_permissions': (), 'managed': False, 'permissions': [('clone_instances', 'Can clone instances'), ('passwordless_console', 'Can access console without password'), ('view_instances', 'Can view instances'), ('snapshot_instances', 'Can snapshot instances'), ('backup_instances', 'Can back up instances')]}, + ), + ] diff --git a/instances/models.py b/instances/models.py index f2dcb38b..b51bbc52 100644 --- a/instances/models.py +++ b/instances/models.py @@ -436,6 +436,7 @@ class PermissionSet(models.Model): ("passwordless_console", _("Can access console without password")), ("view_instances", "Can view instances"), ("snapshot_instances", "Can snapshot instances"), + ("backup_instances", "Can back up instances"), ] managed = False diff --git a/instances/utils.py b/instances/utils.py index cff6525a..fb0fd6b9 100644 --- a/instances/utils.py +++ b/instances/utils.py @@ -218,10 +218,10 @@ def check_user_quota(user, instance, cpu, memory, disk_size): user_instances = UserInstance.objects.filter(user=user, instance__is_template=False).select_related( "instance__compute" ) - # a clone counts from its job's admission until its VM is recorded + # a clone, or a restore of a backup as a new VM, counts from its job's admission until its VM is recorded clones = [ op.intent["quota"] for op in Operation.objects.filter( - user=user, kind="instance.clone", state__in=Operation.ACTIVE + (Operation.UNCERTAIN,)) + user=user, kind__in=("instance.clone", "backup.restore"), state__in=Operation.ACTIVE + (Operation.UNCERTAIN,)) if "quota" in op.intent and not Instance.objects.filter(uuid=op.intent["uuid"]).exists() ] instance += user_instances.count() + len(clones) diff --git a/locale/tr/LC_MESSAGES/django.mo b/locale/tr/LC_MESSAGES/django.mo index 8e008b5e..4d2d909d 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 c5eeb6a5..e7200fc9 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-17 14:05+0000\n" +"POT-Creation-Date: 2026-11-17 16:40+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" @@ -133,7 +133,7 @@ msgid "max instances" msgstr "en fazla sanal makine" #: accounts/models.py:49 accounts/models.py:55 accounts/models.py:61 -#: accounts/models.py:67 +#: accounts/models.py:67 accounts/models.py:73 msgid "-1: no limit; 0: none allowed" msgstr "-1: sınır yok; 0: hiç izin yok" @@ -149,16 +149,20 @@ msgstr "en fazla bellek (MiB)" msgid "max disk size (GiB)" msgstr "en fazla disk boyutu (GiB)" -#: accounts/models.py:82 admin/forms.py:22 +#: accounts/models.py:71 +msgid "max backup size (GiB)" +msgstr "en fazla yedek boyutu (GiB)" + +#: accounts/models.py:88 admin/forms.py:23 msgid "Can change password" msgstr "Parola değiştirebilir" -#: accounts/models.py:92 appsettings/models.py:9 computes/models.py:22 +#: accounts/models.py:98 appsettings/models.py:9 computes/models.py:22 #: instances/models.py:33 msgid "name" msgstr "ad" -#: accounts/models.py:93 +#: accounts/models.py:99 msgid "last used" msgstr "son kullanım" @@ -167,13 +171,13 @@ msgid "User Profile" msgstr "Kullanıcı Profili" #: accounts/templates/account.html:17 accounts/templates/profile.html:18 -#: admin/forms.py:89 admin/templates/admin/user_list.html:24 +#: admin/forms.py:92 admin/templates/admin/user_list.html:24 #: admin/templates/admin/user_list.html:30 msgid "Superuser" msgstr "Süperkullanıcı" #: accounts/templates/account.html:19 accounts/templates/profile.html:20 -#: admin/forms.py:89 admin/templates/admin/user_list.html:24 +#: admin/forms.py:92 admin/templates/admin/user_list.html:24 #: admin/templates/admin/user_list.html:32 msgid "Template editor" msgstr "Şablon düzenleyici" @@ -219,7 +223,7 @@ msgid "User sections" msgstr "Kullanıcı bölümleri" #: accounts/templates/account.html:50 accounts/templates/account.html:58 -#: admin/forms.py:207 computes/templates/computes/list.html:33 +#: admin/forms.py:210 computes/templates/computes/list.html:33 #: computes/templates/computes/list.html:60 computes/templates/overview.html:90 #: instances/views.py:263 vmbackups/templates/vmbackups/policies.html:16 msgid "VMs" @@ -687,27 +691,41 @@ msgid "OTP of %(user)s was reset: a new QR code can be mailed." msgstr "" "%(user)s kullanıcısının OTP'si sıfırlandı: yeni bir QR kodu gönderilebilir." -#: admin/forms.py:23 +#: admin/forms.py:22 +msgid "Can back up instances" +msgstr "Sanal makineleri yedekleyebilir" + +#: admin/forms.py:24 msgid "Can clone instances" msgstr "Sanal makineleri klonlayabilir" -#: admin/forms.py:24 instances/models.py:436 +#: admin/forms.py:25 instances/models.py:436 msgid "Can access console without password" msgstr "Parolasız konsol erişimi yapabilir" -#: admin/forms.py:25 +#: admin/forms.py:26 msgid "Can snapshot instances" msgstr "Sanal makinelerin anlık görüntüsünü alabilir" -#: admin/forms.py:26 +#: admin/forms.py:27 msgid "Can view instances" msgstr "Sanal makineleri görebilir" -#: admin/forms.py:31 +#: admin/forms.py:32 +msgid "" +"Back up the VMs they may change into targets open to VM owners, restore those" +" backups over the VM or as a new VM, and delete the backups they took, within" +" their quotas" +msgstr "" +"Değiştirebildiği sanal makineleri VM sahiplerine açık hedeflere yedekleme, bu" +" yedekleri VM'in üzerine ya da yeni bir VM olarak geri yükleme ve kendi " +"aldığı yedekleri silme; kotaları içinde" + +#: admin/forms.py:34 msgid "Change their own password on their profile page" msgstr "Profil sayfasında kendi parolasını değiştirme" -#: admin/forms.py:32 +#: admin/forms.py:35 msgid "" "Clone the VMs they may change and the templates they may view, within their " "quota" @@ -715,21 +733,21 @@ msgstr "" "Kotası dahilinde, değiştirebildiği sanal makineleri ve görebildiği şablonları" " klonlama" -#: admin/forms.py:33 +#: admin/forms.py:36 msgid "Open a console without the VM's console password" msgstr "Sanal makinenin konsol parolası olmadan konsol aç" -#: admin/forms.py:34 +#: admin/forms.py:37 msgid "Take, revert and delete snapshots of the VMs they may change" msgstr "" "Değiştirebildiği sanal makinelerin anlık görüntülerini alma, geri yükleme ve " "silme" -#: admin/forms.py:35 +#: admin/forms.py:38 msgid "See every VM and host in the lists, read-only" msgstr "Listelerde tüm sanal makineleri ve sunucuları salt okunur görme" -#: admin/forms.py:89 admin/templates/admin/logs.html:39 +#: admin/forms.py:92 admin/templates/admin/logs.html:39 #: admin/templates/admin/user_list.html:24 #: admin/templates/admin/user_list.html:34 #: computes/templates/computes/instances.html:47 @@ -741,24 +759,24 @@ msgstr "Listelerde tüm sanal makineleri ve sunucuları salt okunur görme" msgid "User" msgstr "Kullanıcı" -#: admin/forms.py:96 admin/templates/admin/group_form.html:31 +#: admin/forms.py:99 admin/templates/admin/group_form.html:31 msgid "Permissions" msgstr "İzinler" -#: admin/forms.py:103 admin/templates/admin/group_list.html:6 +#: admin/forms.py:106 admin/templates/admin/group_list.html:6 #: admin/templates/admin/group_list.html:8 #: admin/templates/admin/group_list.html:24 #: admin/templates/admin/user_form.html:124 templates/navbar.html:36 msgid "Groups" msgstr "Gruplar" -#: admin/forms.py:157 +#: admin/forms.py:160 #, python-format msgid "NEW_USER_DEFAULT_INSTANCES: %(name)s is not exactly one VM" msgstr "" "NEW_USER_DEFAULT_INSTANCES: %(name)s tam olarak tek bir sanal makine değil" -#: admin/forms.py:160 +#: admin/forms.py:163 #, python-format msgid "" "NEW_USER_DEFAULT_INSTANCES: %(name)s has an owner, and only one is allowed" @@ -766,7 +784,7 @@ msgstr "" "NEW_USER_DEFAULT_INSTANCES: %(name)s sanal makinesinin bir sahibi var ve " "yalnızca bir sahibe izin veriliyor" -#: admin/forms.py:208 computes/templates/computes/list.html:61 +#: admin/forms.py:211 computes/templates/computes/list.html:61 #: computes/templates/overview.html:102 instances/forms.py:15 #: instances/templates/allinstances_index_grouped.html:16 #: instances/templates/allinstances_index_nongrouped.html:14 @@ -776,7 +794,7 @@ msgstr "" msgid "vCPUs" msgstr "vCPU" -#: admin/forms.py:209 computes/templates/computes/balance.html:62 +#: admin/forms.py:212 computes/templates/computes/balance.html:62 #: computes/templates/computes/bulk_migrate.html:67 #: computes/templates/computes/instances.html:50 #: computes/templates/computes/list.html:62 @@ -790,7 +808,7 @@ msgstr "vCPU" msgid "Memory" msgstr "Bellek" -#: admin/forms.py:210 instances/models.py:240 +#: admin/forms.py:213 instances/models.py:240 #: instances/templates/create_instance_w2.html:118 #: instances/templates/instances/settings_tab.html:25 #: instances/templates/instances/stats_tab.html:53 vmbackups/forms.py:53 @@ -798,27 +816,38 @@ msgstr "Bellek" msgid "Disk" msgstr "Disk" -#: admin/forms.py:220 +#: admin/forms.py:214 instances/templates/instance.html:112 +#: templates/navbar.html:21 vmbackups/templates/vmbackups/index.html:6 +#: vmbackups/templates/vmbackups/index.html:8 +#: vmbackups/templates/vmbackups/policies.html:9 +#: vmbackups/templates/vmbackups/restore.html:9 +#: vmbackups/templates/vmbackups/restore_disk.html:9 +#: vmbackups/templates/vmbackups/restore_over.html:8 +#: vmbackups/templates/vmbackups/targets.html:17 +msgid "Backups" +msgstr "Yedekler" + +#: admin/forms.py:224 msgid "No limit" msgstr "Sınır yok" -#: admin/forms.py:236 +#: admin/forms.py:240 msgid "Enter a limit or choose No limit." msgstr "Bir sınır girin ya da Sınır yok'u seçin." -#: admin/forms.py:248 +#: admin/forms.py:252 msgid "The user must change it at their next login" msgstr "Kullanıcı bir sonraki girişinde onu değiştirmek zorundadır" -#: admin/forms.py:254 +#: admin/forms.py:258 msgid "With a password" msgstr "Parolayla" -#: admin/forms.py:254 +#: admin/forms.py:258 msgid "Without a password" msgstr "Parolasız" -#: admin/forms.py:260 +#: admin/forms.py:264 msgid "A user without a password cannot be made to change it" msgstr "Parolası olmayan bir kullanıcıya parola değiştirme zorunluluğu konamaz" @@ -3252,7 +3281,7 @@ msgstr "" msgid "A password takes no line breaks or other control characters." msgstr "Parola satır sonu ya da başka denetim karakteri içeremez." -#: instances/forms.py:114 vrtManager/instance.py:1721 +#: instances/forms.py:114 vrtManager/instance.py:1722 msgid "" "The console listens on no address (on a network, a socket or nowhere); change" " it in the XML editor" @@ -3272,7 +3301,7 @@ msgstr "" msgid "The name of the virtual machine must not contain any special characters" msgstr "Sanal makine adı özel karakterler içeremez" -#: instances/jobs.py:73 vmbackups/jobs.py:85 +#: instances/jobs.py:73 vmbackups/jobs.py:134 msgid "The VM moved to another compute after the job was queued" msgstr "İş kuyruğa alındıktan sonra sanal makine başka bir sunucuya taşındı" @@ -3293,17 +3322,17 @@ msgstr "Klonun adını boş adlar listesinden seçin" msgid "%(quota)s: cannot create '%(clone_name)s'." msgstr "%(quota)s: '%(clone_name)s' oluşturulamıyor." -#: instances/jobs.py:206 instances/jobs.py:646 vmbackups/jobs.py:602 +#: instances/jobs.py:206 instances/jobs.py:646 vmbackups/jobs.py:675 #, python-format msgid "Instance '%(clone_name)s' already exists!" msgstr "'%(clone_name)s' sanal makinesi zaten mevcut!" -#: instances/jobs.py:208 vmbackups/jobs.py:604 +#: instances/jobs.py:208 vmbackups/jobs.py:677 #, python-format msgid "Instance name '%(clone_name)s' is longer than 64 characters" msgstr "'%(clone_name)s' sanal makine adı 64 karakterden uzun" -#: instances/jobs.py:211 vmbackups/jobs.py:606 +#: instances/jobs.py:211 vmbackups/jobs.py:679 #, python-format msgid "Instance name '%(clone_name)s' contains invalid characters!" msgstr "Sanal makine adı '%(clone_name)s' geçersiz karakterler içermektedir!" @@ -3346,7 +3375,7 @@ msgstr "" msgid "Delete snapshot" msgstr "Anlık görüntüyü sil" -#: instances/jobs.py:357 vrtManager/instance.py:2480 +#: instances/jobs.py:357 vrtManager/instance.py:2483 #, python-format msgid "The VM has no external snapshot named %(name)s" msgstr "Sanal makinede %(name)s adında harici anlık görüntü yok" @@ -3381,7 +3410,7 @@ msgstr "Sanal makine artık işin çalıştığı sunucuda değil" msgid "Take snapshot" msgstr "Anlık görüntü al" -#: instances/jobs.py:425 instances/jobs.py:434 vrtManager/instance.py:2071 +#: instances/jobs.py:425 instances/jobs.py:434 vrtManager/instance.py:2072 #, python-format msgid "A snapshot named %(name)s already exists" msgstr "%(name)s adında bir anlık görüntü zaten var" @@ -3460,12 +3489,12 @@ msgid "Clone VM" msgstr "Sanal makineyi klonla" #: instances/jobs.py:656 instances/jobs.py:663 instances/jobs.py:1005 -#: vmbackups/jobs.py:291 vmbackups/jobs.py:734 vmbackups/jobs.py:899 -#: vmbackups/jobs.py:1055 +#: vmbackups/jobs.py:351 vmbackups/jobs.py:842 vmbackups/jobs.py:1012 +#: vmbackups/jobs.py:1187 msgid "Copying disks" msgstr "Diskler kopyalanıyor" -#: instances/jobs.py:715 vmbackups/jobs.py:371 +#: instances/jobs.py:715 vmbackups/jobs.py:431 msgid "libvirt has no result of the copy" msgstr "libvirt'te kopyanın sonucu yok" @@ -3478,7 +3507,7 @@ msgstr "" "Kopyalama başarısız oldu: %(error)s. Konuğun dosya sistemleri çözülemedi " "(%(thaw)s); şununla çözün: virsh domfsthaw %(vm)s" -#: instances/jobs.py:729 instances/jobs.py:821 vmbackups/jobs.py:377 +#: instances/jobs.py:729 instances/jobs.py:821 vmbackups/jobs.py:437 msgid "The copy failed" msgstr "Kopyalama başarısız oldu" @@ -3500,11 +3529,11 @@ msgstr "" "Klonun bir birimi oluşturuluyordu; şu birimleri kontrol edin, sonra bu işi " "çözün: %(volumes)s" -#: instances/jobs.py:801 vmbackups/jobs.py:414 +#: instances/jobs.py:801 vmbackups/jobs.py:474 msgid "The job stopped before the copy started" msgstr "İş, kopyalama başlamadan durdu" -#: instances/jobs.py:808 vmbackups/jobs.py:462 +#: instances/jobs.py:808 vmbackups/jobs.py:522 msgid "libvirt is still copying the disks" msgstr "libvirt diskleri hâlâ kopyalıyor" @@ -3545,12 +3574,12 @@ msgstr "" msgid "Each network card needs a network" msgstr "Her ağ kartının bir ağı olmalı" -#: instances/jobs.py:868 vrtManager/backup.py:342 vrtManager/instance.py:2888 +#: instances/jobs.py:868 vrtManager/backup.py:351 vrtManager/instance.py:2899 #, python-format msgid "This host has no network %(name)s" msgstr "Bu sunucuda %(name)s ağı yok" -#: instances/jobs.py:870 vrtManager/backup.py:346 vrtManager/instance.py:2890 +#: instances/jobs.py:870 vrtManager/backup.py:355 vrtManager/instance.py:2901 #, python-format msgid "This host has no network filter %(name)s" msgstr "Bu sunucuda %(name)s ağ filtresi yok" @@ -3624,7 +3653,7 @@ msgstr "cloud-init tohumu, disk için bir dizin depolama havuzu gerektirir" msgid "This host offers no firmware %(firmware)s" msgstr "Bu sunucu %(firmware)s firmware'ini sunmuyor" -#: instances/jobs.py:957 vrtManager/instance.py:3238 +#: instances/jobs.py:957 vrtManager/instance.py:3249 msgid "This host offers no TPM 2.0: install swtpm on it" msgstr "Bu sunucu TPM 2.0 sunmuyor: üzerine swtpm kurun" @@ -4563,17 +4592,6 @@ msgstr "Ayarlar" msgid "Stats" msgstr "İstatistikler" -#: instances/templates/instance.html:112 templates/navbar.html:21 -#: vmbackups/templates/vmbackups/index.html:6 -#: vmbackups/templates/vmbackups/index.html:8 -#: vmbackups/templates/vmbackups/policies.html:9 -#: vmbackups/templates/vmbackups/restore.html:9 -#: vmbackups/templates/vmbackups/restore_disk.html:9 -#: vmbackups/templates/vmbackups/restore_over.html:8 -#: vmbackups/templates/vmbackups/targets.html:17 -msgid "Backups" -msgstr "Yedekler" - #: instances/templates/instance.html:116 #: instances/templates/instances/destroy_tab.html:7 msgid "Destroy" @@ -4940,7 +4958,7 @@ msgid "Add USB device" msgstr "USB aygıtı ekle" #: instances/templates/instances/host_devices_form.html:18 -#: vrtManager/instance.py:3141 +#: vrtManager/instance.py:3152 msgid "" "A VM with a saved state does not change its USB devices: start it, or start " "it without its saved state" @@ -6959,7 +6977,7 @@ msgstr "Birim başarıyla değiştirildi." msgid "Disk %(dev)s is not a storage volume of this instance" msgstr "%(dev)s diski bu sanal makinenin bir depolama birimi değil" -#: instances/views.py:1603 vrtManager/instance.py:2490 +#: instances/views.py:1603 vrtManager/instance.py:2493 msgid "The VM has a saved state; start it or remove the saved state first" msgstr "" "Sanal makinenin kaydedilmiş durumu var; önce başlatın veya kaydedilmiş durumu" @@ -7021,7 +7039,7 @@ msgstr "Anlık görüntü silinmedi: %(err)s" msgid "Add at least one device to the boot order." msgstr "Ön yükleme sırasına en az bir aygıt ekleyin." -#: instances/views.py:1916 vrtManager/instance.py:1262 +#: instances/views.py:1916 vrtManager/instance.py:1263 msgid "Invalid Device Type for boot order" msgstr "Ön yükleme sırası için geçersiz aygıt türü" @@ -9817,7 +9835,7 @@ msgstr "" msgid "Choose a compute or VMs, not both" msgstr "Bir sunucu ya da sanal makineler seçin, ikisini birden değil" -#: vmbackups/forms.py:102 vmbackups/jobs.py:58 +#: vmbackups/forms.py:102 vmbackups/jobs.py:106 #, python-format msgid "Backup target %(target)s has no storage pool on %(compute)s" msgstr "%(target)s yedek hedefinin %(compute)s üzerinde depolama havuzu yok" @@ -9826,12 +9844,26 @@ msgstr "%(target)s yedek hedefinin %(compute)s üzerinde depolama havuzu yok" msgid "Keep one backup at least" msgstr "En az bir yedek tutun" -#: vmbackups/jobs.py:68 +#: vmbackups/jobs.py:72 +#, python-format +msgid "Backup target %(target)s is not open to VM owners" +msgstr "%(target)s yedek hedefi VM sahiplerine açık değil" + +#: vmbackups/jobs.py:86 +#, python-format +msgid "" +"The backup needs %(needed).1f GiB; %(used).1f GiB of your %(limit)d GiB " +"backup quota is used" +msgstr "" +"Yedek %(needed).1f GiB gerektiriyor; %(limit)d GiB yedek kotanızın %(used).1f" +" GiB'ı kullanılıyor" + +#: vmbackups/jobs.py:116 msgid "The VM must be running, paused or shut off to be backed up" msgstr "" "Yedeklenmek için sanal makine çalışıyor, duraklatılmış ya da kapalı olmalı" -#: vmbackups/jobs.py:72 +#: vmbackups/jobs.py:120 msgid "" "A running VM's backup needs libvirt 11.10 or later; shut the VM down to back " "it up" @@ -9839,45 +9871,45 @@ msgstr "" "Çalışan bir sanal makinenin yedeği libvirt 11.10 veya sonrasını gerektirir; " "yedeklemek için sanal makineyi kapatın" -#: vmbackups/jobs.py:74 +#: vmbackups/jobs.py:122 msgid "A paused VM's file systems cannot be frozen" msgstr "Duraklatılmış bir sanal makinenin dosya sistemleri dondurulamaz" -#: vmbackups/jobs.py:76 +#: vmbackups/jobs.py:124 msgid "The guest agent does not answer: the file systems cannot be frozen" msgstr "Konuk ajanı yanıt vermiyor: dosya sistemleri dondurulamaz" -#: vmbackups/jobs.py:126 +#: vmbackups/jobs.py:181 msgid "" "The VM's NVRAM file changed while it was backed up; back the VM up again" msgstr "" "Sanal makinenin NVRAM dosyası yedeklenirken değişti; sanal makineyi yeniden " "yedekleyin" -#: vmbackups/jobs.py:236 +#: vmbackups/jobs.py:291 msgid "Back up VM" msgstr "Sanal makineyi yedekle" -#: vmbackups/jobs.py:271 +#: vmbackups/jobs.py:330 msgid "The schedule's window ended before the backup could start" msgstr "Yedek başlayamadan zamanlamanın penceresi bitti" -#: vmbackups/jobs.py:273 +#: vmbackups/jobs.py:332 #, python-format msgid "" "%(compute)s went into maintenance before the scheduled backup could start" msgstr "Zamanlanmış yedek başlayamadan %(compute)s bakıma alındı" -#: vmbackups/jobs.py:307 vmbackups/jobs.py:378 +#: vmbackups/jobs.py:367 vmbackups/jobs.py:438 msgid "Writing the backup's files" msgstr "Yedeğin dosyaları yazılıyor" -#: vmbackups/jobs.py:390 +#: vmbackups/jobs.py:450 msgid "The guest's file systems could not be thawed; trying again" msgstr "" "Konuğun dosya sistemlerinin dondurulması kaldırılamadı; yeniden deneniyor" -#: vmbackups/jobs.py:439 +#: vmbackups/jobs.py:499 #, python-format msgid "" "The VM is no longer on the compute the job ran on; check these volumes of the" @@ -9886,7 +9918,7 @@ msgstr "" "Sanal makine artık işin çalıştığı sunucuda değil; yedek hedefindeki şu " "birimleri kontrol edin, sonra bu işi çözün: %(volumes)s" -#: vmbackups/jobs.py:456 +#: vmbackups/jobs.py:516 #, python-format msgid "" "A disk was being copied when the job stopped; check these volumes of the " @@ -9895,7 +9927,7 @@ msgstr "" "İş durduğunda bir disk kopyalanıyordu; yedek hedefindeki şu birimleri kontrol" " edin, sonra bu işi çözün: %(volumes)s" -#: vmbackups/jobs.py:466 +#: vmbackups/jobs.py:526 #, python-format msgid "" "Another backup runs on the VM; check these volumes of the backup target, then" @@ -9904,7 +9936,7 @@ msgstr "" "Sanal makinede başka bir yedekleme çalışıyor; yedek hedefindeki şu birimleri " "kontrol edin, sonra bu işi çözün: %(volumes)s" -#: vmbackups/jobs.py:472 +#: vmbackups/jobs.py:532 #, python-format msgid "" "libvirt has no result of the copy; check these volumes of the backup target, " @@ -9913,86 +9945,95 @@ msgstr "" "libvirt'te kopyanın sonucu yok; yedek hedefindeki şu birimleri kontrol edin, " "sonra bu işi çözün: %(volumes)s" -#: vmbackups/jobs.py:480 +#: vmbackups/jobs.py:540 msgid "The job stopped before the copy ended" msgstr "İş, kopyalama bitmeden durdu" -#: vmbackups/jobs.py:487 +#: vmbackups/jobs.py:547 #, python-format msgid "The backup's files could not be written: %(error)s" msgstr "Yedeğin dosyaları yazılamadı: %(error)s" -#: vmbackups/jobs.py:507 +#: vmbackups/jobs.py:567 #, python-format msgid "No compute of backup target %(target)s reaches its storage pool" msgstr "" "%(target)s yedek hedefinin hiçbir sunucusu depolama havuzuna erişemiyor" -#: vmbackups/jobs.py:541 +#: vmbackups/jobs.py:601 msgid "Delete backup" msgstr "Yedeği sil" -#: vmbackups/jobs.py:552 +#: vmbackups/jobs.py:621 msgid "This backup is being made; cancel its job to stop it" msgstr "Bu yedek alınıyor; durdurmak için işini iptal edin" -#: vmbackups/jobs.py:554 +#: vmbackups/jobs.py:623 vmbackups/jobs.py:638 msgid "Later backups depend on this one; delete them first" msgstr "Sonraki yedekler buna dayanıyor; önce onları silin" -#: vmbackups/jobs.py:567 +#: vmbackups/jobs.py:636 msgid "The backup is no longer beyond what its schedule keeps; it is kept" msgstr "Yedek artık zamanlamasının tuttuğu sayının dışında değil; tutuluyor" -#: vmbackups/jobs.py:619 +#: vmbackups/jobs.py:656 +msgid "The job stopped before the deletion began" +msgstr "İş, silme başlamadan durdu" + +#: vmbackups/jobs.py:692 #, python-format msgid "The backup's file %(name)s is missing from the target" msgstr "Yedeğin %(name)s dosyası hedefte yok" -#: vmbackups/jobs.py:622 vmbackups/jobs.py:624 +#: vmbackups/jobs.py:695 vmbackups/jobs.py:697 #, python-format msgid "The backup's file %(name)s differs from the one written" msgstr "Yedeğin %(name)s dosyası yazılandan farklı" -#: vmbackups/jobs.py:635 +#: vmbackups/jobs.py:708 #, python-format msgid "The backup taken %(time)s builds on a backup that is gone" msgstr "%(time)s tarihli yedek artık olmayan bir yedeğe dayanıyor" -#: vmbackups/jobs.py:649 +#: vmbackups/jobs.py:722 #, python-format msgid "The backup's TPM state file %(name)s is not a plain file name" msgstr "Yedeğin TPM durum dosyası %(name)s düz bir dosya adı değil" -#: vmbackups/jobs.py:661 vmbackups/templates/vmbackups/restore.html:7 +#: vmbackups/jobs.py:734 vmbackups/templates/vmbackups/restore.html:7 msgid "Restore backup" msgstr "Yedeği geri yükle" -#: vmbackups/jobs.py:674 vmbackups/jobs.py:858 vmbackups/jobs.py:1021 +#: vmbackups/jobs.py:768 +#, python-format +msgid "%(quota)s: cannot restore %(name)s" +msgstr "%(quota)s: %(name)s geri yüklenemiyor" + +#: vmbackups/jobs.py:775 vmbackups/jobs.py:969 vmbackups/jobs.py:1153 msgid "Only a ready backup is restored" msgstr "Yalnızca hazır bir yedek geri yüklenir" -#: vmbackups/jobs.py:704 +#: vmbackups/jobs.py:812 #, python-format msgid "A VM named %(name)s exists on %(compute)s" msgstr "%(compute)s üzerinde %(name)s adlı bir sanal makine var" -#: vmbackups/jobs.py:712 vmbackups/jobs.py:893 vmbackups/jobs.py:1051 +#: vmbackups/jobs.py:820 vmbackups/jobs.py:1006 vmbackups/jobs.py:1183 #, python-format msgid "This host has no active directory storage pool %(pool)s" msgstr "Bu sunucuda %(pool)s adlı etkin bir dizin depolama havuzu yok" -#: vmbackups/jobs.py:730 +#: vmbackups/jobs.py:838 #, python-format msgid "The NVRAM file %(path)s exists already" msgstr "%(path)s NVRAM dosyası zaten var" -#: vmbackups/jobs.py:766 +#: vmbackups/jobs.py:874 #, python-format msgid "The VM was restored; it did not start: %(error)s" msgstr "Sanal makine geri yüklendi; başlamadı: %(error)s" -#: vmbackups/jobs.py:788 vmbackups/jobs.py:980 +#: vmbackups/jobs.py:896 vmbackups/jobs.py:1112 #, python-format msgid "" "A disk was being copied when the job stopped; check this volume, then resolve" @@ -10001,7 +10042,7 @@ msgstr "" "İş durduğunda bir disk kopyalanıyordu; bu birimi kontrol edin, sonra bu işi " "çözün: %(volumes)s" -#: vmbackups/jobs.py:793 vmbackups/jobs.py:986 +#: vmbackups/jobs.py:901 vmbackups/jobs.py:1118 #, python-format msgid "" "Storage pool %(pool)s is not active; the restore's copies in it are removed " @@ -10010,20 +10051,20 @@ msgstr "" "%(pool)s depolama havuzu etkin değil; geri yüklemenin içindeki kopyaları " "havuz etkin olunca kaldırılır" -#: vmbackups/jobs.py:807 +#: vmbackups/jobs.py:915 msgid "The VM was not defined; its copies were removed" msgstr "Sanal makine tanımlanmadı; kopyaları kaldırıldı" -#: vmbackups/jobs.py:820 +#: vmbackups/jobs.py:928 msgid "Shut the VM down to restore a backup over it" msgstr "Üzerine yedek geri yüklemek için VM'i kapatın" -#: vmbackups/jobs.py:823 +#: vmbackups/jobs.py:931 msgid "The VM has snapshots; delete them to restore a backup over it" msgstr "" "VM'in anlık görüntüleri var; üzerine yedek geri yüklemek için onları silin" -#: vmbackups/jobs.py:828 +#: vmbackups/jobs.py:936 #, python-format msgid "" "The VM's disks (%(now)s) are not the backup's (%(then)s); restore it as a new" @@ -10032,37 +10073,45 @@ msgstr "" "VM'in diskleri (%(now)s) yedeğinkiler (%(then)s) değil; yeni bir VM olarak ya" " da tek disk olarak geri yükleyin" -#: vmbackups/jobs.py:831 +#: vmbackups/jobs.py:940 +#, python-format +msgid "" +"The backup's disk %(dev)s is larger than the VM's now; restore it as a new VM" +msgstr "" +"Yedeğin %(dev)s diski VM'in şimdiki diskinden büyük; yeni bir VM olarak geri " +"yükleyin" + +#: vmbackups/jobs.py:943 msgid "The VM's UEFI firmware changed since the backup; restore it as a new VM" msgstr "" "VM'in UEFI donanım yazılımı yedekten sonra değişti; yeni bir VM olarak geri " "yükleyin" -#: vmbackups/jobs.py:833 +#: vmbackups/jobs.py:945 msgid "The VM's TPM changed since the backup; restore it as a new VM" msgstr "VM'in TPM'i yedekten sonra değişti; yeni bir VM olarak geri yükleyin" -#: vmbackups/jobs.py:848 +#: vmbackups/jobs.py:960 msgid "Restore backup over the VM" msgstr "Yedeği VM'in üzerine geri yükle" -#: vmbackups/jobs.py:861 +#: vmbackups/jobs.py:973 msgid "The backup's VM is no longer in the panel; restore it as a new VM" msgstr "Yedeğin VM'i artık panelde yok; yeni bir VM olarak geri yükleyin" -#: vmbackups/jobs.py:884 +#: vmbackups/jobs.py:997 msgid "The VM's disks changed after the job was queued" msgstr "İş kuyruğa alındıktan sonra VM'in diskleri değişti" -#: vmbackups/jobs.py:916 +#: vmbackups/jobs.py:1029 msgid "The VM changed while its backup was copied; it keeps its disks" msgstr "Yedeği kopyalanırken VM değişti; VM disklerini koruyor" -#: vmbackups/jobs.py:917 +#: vmbackups/jobs.py:1032 msgid "Replacing the VM's disks" msgstr "VM'in diskleri değiştiriliyor" -#: vmbackups/jobs.py:961 +#: vmbackups/jobs.py:1092 msgid "" "The VM moved to another compute; check its disks and the restore's copies, " "then resolve this job" @@ -10070,7 +10119,7 @@ msgstr "" "VM başka bir sunucuya taşındı; disklerini ve geri yüklemenin kopyalarını " "denetleyin, sonra bu işi çözümleyin" -#: vmbackups/jobs.py:973 +#: vmbackups/jobs.py:1105 msgid "" "The VM was started while its disks were being replaced; check its disks, then" " resolve this job" @@ -10078,25 +10127,25 @@ msgstr "" "VM'in diskleri değiştirilirken VM başlatıldı; disklerini denetleyin, sonra bu" " işi çözümleyin" -#: vmbackups/jobs.py:991 +#: vmbackups/jobs.py:1123 msgid "The VM keeps its disks; the restore's copies were removed" msgstr "VM disklerini koruyor; geri yüklemenin kopyaları silindi" -#: vmbackups/jobs.py:1003 +#: vmbackups/jobs.py:1135 msgid "Restore a disk of a backup" msgstr "Yedeğin bir diskini geri yükle" -#: vmbackups/jobs.py:1014 +#: vmbackups/jobs.py:1146 #, python-format msgid "The backup has no disk %(dev)s" msgstr "Yedekte %(dev)s diski yok" -#: vmbackups/jobs.py:1024 +#: vmbackups/jobs.py:1156 #, python-format msgid "%(name)s is not a volume name" msgstr "%(name)s bir birim adı değil" -#: vmbackups/jobs.py:1083 +#: vmbackups/jobs.py:1215 #, python-format msgid "" "The disk was being copied when the job stopped; check this volume, then " @@ -10105,15 +10154,15 @@ msgstr "" "İş durduğunda disk kopyalanıyordu; bu birimi denetleyin, sonra bu işi " "çözümleyin: %(volume)s" -#: vmbackups/jobs.py:1086 +#: vmbackups/jobs.py:1218 msgid "The disk was not restored" msgstr "Disk geri yüklenmedi" -#: vmbackups/jobs.py:1107 vmbackups/templates/vmbackups/target.html:18 +#: vmbackups/jobs.py:1239 vmbackups/templates/vmbackups/target.html:18 msgid "Read backups from target" msgstr "Yedekleri hedeften oku" -#: vmbackups/jobs.py:1168 +#: vmbackups/jobs.py:1300 #, python-format msgid "" "Not read, as a file of the backup is missing, changed or unreadable: " @@ -10122,11 +10171,11 @@ msgstr "" "Yedeğin bir dosyası eksik, değişmiş ya da okunamaz olduğu için okunmadı: " "%(names)s" -#: vmbackups/jobs.py:1184 +#: vmbackups/jobs.py:1316 msgid "Check backup target" msgstr "Yedek hedefini denetle" -#: vmbackups/jobs.py:1215 +#: vmbackups/jobs.py:1347 #, python-format msgid "Files of these backups are missing from the target: %(backups)s" msgstr "Şu yedeklerin dosyaları hedefte yok: %(backups)s" @@ -10633,7 +10682,7 @@ msgstr "" "%(dev)s diski (%(path)s) sunucunun hiçbir depolama havuzunda değil; " "yedeklenemez" -#: vrtManager/backup.py:113 +#: vrtManager/backup.py:115 #, python-format msgid "" "Disks %(devs)s change at the next start; back the VM up after it restarts" @@ -10641,7 +10690,7 @@ msgstr "" "%(devs)s diskleri sonraki başlatmada değişiyor; sanal makineyi yeniden " "başladıktan sonra yedekleyin" -#: vrtManager/backup.py:118 vrtManager/instance.py:495 +#: vrtManager/backup.py:120 vrtManager/instance.py:496 #, python-format msgid "" "The NVRAM file %(path)s is not in libvirt's NVRAM directory %(dir)s and " @@ -10650,7 +10699,7 @@ msgstr "" "%(path)s NVRAM dosyası libvirt'in NVRAM dizini %(dir)s içinde değil ve " "kopyalanamaz" -#: vrtManager/backup.py:222 +#: vrtManager/backup.py:231 #, python-format msgid "" "Storage pool %(pool)s has %(free).1f GiB free; the backup needs %(size).1f " @@ -10660,14 +10709,14 @@ msgstr "" " gerektiriyor (kopyalanan diskler, artı bunların %%%(percent)g kadarı, en az " "%(minimum)g GiB)" -#: vrtManager/backup.py:235 +#: vrtManager/backup.py:244 #, python-format msgid "" "The file %(name)s read back from the backup target differs from the one " "written" msgstr "Yedek hedefinden geri okunan %(name)s dosyası yazılandan farklı" -#: vrtManager/backup.py:329 +#: vrtManager/backup.py:338 #, python-format msgid "" "This host cannot run the VM's emulator %(emulator)s with machine type " @@ -10676,17 +10725,17 @@ msgstr "" "Bu sunucu sanal makinenin %(emulator)s öykünücüsünü %(machine)s makine " "türüyle çalıştıramıyor: %(error)s" -#: vrtManager/backup.py:333 +#: vrtManager/backup.py:342 #, python-format msgid "This host has no firmware %(loader)s" msgstr "Bu sunucuda %(loader)s firmware'i yok" -#: vrtManager/backup.py:339 +#: vrtManager/backup.py:348 #, python-format msgid "This host offers no TPM 2.0 %(model)s: install swtpm on it" msgstr "Bu ana makine TPM 2.0 %(model)s sunmuyor: üzerine swtpm kurun" -#: vrtManager/backup.py:344 +#: vrtManager/backup.py:353 #, python-format msgid "This host has no bridge %(name)s" msgstr "Bu sunucuda %(name)s köprüsü yok" @@ -10754,88 +10803,88 @@ msgstr "" "%(pool)s havuzu etkin değil: içindeki sanal makine disklerinin oluşturulduğu " "dosyalar denetlenemiyor; önce havuzu başlatın" -#: vrtManager/instance.py:179 +#: vrtManager/instance.py:180 msgid "The VM is not running" msgstr "Sanal makine çalışmıyor" -#: vrtManager/instance.py:184 +#: vrtManager/instance.py:185 msgid "A running or paused VM cannot be migrated offline" msgstr "Çalışan veya duraklatılmış bir sanal makine çevrimdışı taşınamaz" -#: vrtManager/instance.py:187 +#: vrtManager/instance.py:188 msgid "The VM can be migrated when it is running, paused or shut off" msgstr "Sanal makine çalışırken, duraklatılmışken veya kapalıyken taşınabilir" -#: vrtManager/instance.py:210 +#: vrtManager/instance.py:211 msgid "A VM with snapshots cannot be migrated" msgstr "Anlık görüntüleri olan bir sanal makine taşınamaz" -#: vrtManager/instance.py:213 +#: vrtManager/instance.py:214 msgid "A VM with a saved state cannot be migrated" msgstr "Kaydedilmiş durumu olan bir sanal makine taşınamaz" -#: vrtManager/instance.py:220 +#: vrtManager/instance.py:221 msgid "A VM with host devices cannot be migrated; remove them first" msgstr "Sunucu aygıtları olan bir sanal makine taşınamaz; önce onları kaldırın" -#: vrtManager/instance.py:224 +#: vrtManager/instance.py:225 #, python-format msgid "The destination host does not have these networks of the VM: %(names)s" msgstr "Hedef sunucuda VM'in şu ağları yok: %(names)s" -#: vrtManager/instance.py:228 +#: vrtManager/instance.py:229 #, python-format msgid "" "The destination host does not have these network filters of the VM: %(names)s" msgstr "Hedef sunucuda VM'in şu ağ filtreleri yok: %(names)s" -#: vrtManager/instance.py:231 +#: vrtManager/instance.py:232 #, python-format msgid "" "These network filters of the VM have other rules on the destination host: " "%(names)s" msgstr "VM'in şu ağ filtrelerinin hedef sunucudaki kuralları farklı: %(names)s" -#: vrtManager/instance.py:234 +#: vrtManager/instance.py:235 #, python-format msgid "The destination host does not have these secrets of the VM: %(names)s" msgstr "Hedef sunucuda VM'in şu parolaları yok: %(names)s" -#: vrtManager/instance.py:241 +#: vrtManager/instance.py:242 #, python-format msgid "The destination host does not have these disks of the VM: %(disks)s" msgstr "Hedef sunucuda sanal makinenin şu diskleri yok: %(disks)s" -#: vrtManager/instance.py:242 +#: vrtManager/instance.py:243 #, python-format msgid "%(target)s (%(source)s)" msgstr "%(target)s (%(source)s)" -#: vrtManager/instance.py:250 +#: vrtManager/instance.py:251 msgid "Destination host emulator is different. Cannot be migrated" msgstr "Hedef sunucunun emülatörü farklı. Taşınamaz" -#: vrtManager/instance.py:385 +#: vrtManager/instance.py:386 msgid "an image is not copied; eject it first" msgstr "bir imaj kopyalanmaz; önce onu çıkarın" -#: vrtManager/instance.py:388 +#: vrtManager/instance.py:389 msgid "a read-only or encrypted disk is not copied" msgstr "salt okunur veya şifreli bir disk kopyalanmaz" -#: vrtManager/instance.py:391 +#: vrtManager/instance.py:392 msgid "only raw and qcow2 disks are copied" msgstr "yalnızca raw ve qcow2 diskler kopyalanır" -#: vrtManager/instance.py:393 +#: vrtManager/instance.py:394 msgid "no storage pool of the source host has it" msgstr "kaynak sunucunun hiçbir depolama havuzunda yok" -#: vrtManager/instance.py:395 +#: vrtManager/instance.py:396 msgid "a disk with a backing file is not copied" msgstr "temel (backing) dosyası olan bir disk kopyalanmaz" -#: vrtManager/instance.py:415 +#: vrtManager/instance.py:416 #, python-format msgid "" "%(target)s (%(path)s): the destination host does not share it; choose a pool " @@ -10844,12 +10893,12 @@ msgstr "" "%(target)s (%(path)s): hedef sunucu bunu paylaşmıyor; kopyalanacağı bir havuz" " seçin" -#: vrtManager/instance.py:419 +#: vrtManager/instance.py:420 #, python-format msgid "%(target)s (%(path)s): %(refusal)s" msgstr "%(target)s (%(path)s): %(refusal)s" -#: vrtManager/instance.py:424 +#: vrtManager/instance.py:425 #, python-format msgid "" "%(target)s (%(path)s): the destination host has no pool %(pool)s for disk " @@ -10857,7 +10906,7 @@ msgid "" msgstr "" "%(target)s (%(path)s): hedef sunucuda disk dosyaları için %(pool)s havuzu yok" -#: vrtManager/instance.py:431 +#: vrtManager/instance.py:432 #, python-format msgid "" "%(target)s (%(path)s): pool %(pool)s of the destination host already has a " @@ -10866,17 +10915,17 @@ msgstr "" "%(target)s (%(path)s): hedef sunucunun %(pool)s havuzunda zaten %(file)s " "dosyası var" -#: vrtManager/instance.py:438 +#: vrtManager/instance.py:439 #, python-format msgid "%(target)s (%(path)s): another disk is copied to %(dest)s" msgstr "%(target)s (%(path)s): başka bir disk %(dest)s konumuna kopyalanıyor" -#: vrtManager/instance.py:443 +#: vrtManager/instance.py:444 #, python-format msgid "%(target)s: the VM has no disk file to copy" msgstr "%(target)s: sanal makinenin kopyalanacak disk dosyası yok" -#: vrtManager/instance.py:447 +#: vrtManager/instance.py:448 #, python-format msgid "" "%(target)s (%(path)s) of the next start: the destination host does not share " @@ -10885,12 +10934,12 @@ msgstr "" "Sonraki başlatmanın %(target)s (%(path)s) diski: hedef sunucu bunu " "paylaşmıyor" -#: vrtManager/instance.py:451 +#: vrtManager/instance.py:452 #, python-format msgid "The disks cannot be migrated: %(problems)s" msgstr "Diskler taşınamaz: %(problems)s" -#: vrtManager/instance.py:464 +#: vrtManager/instance.py:465 #, python-format msgid "" "%(error)s; remove the partial disk copies from the destination host: " @@ -10898,33 +10947,33 @@ msgid "" msgstr "" "%(error)s; yarım kalan disk kopyalarını hedef sunucudan kaldırın: %(copies)s" -#: vrtManager/instance.py:481 +#: vrtManager/instance.py:482 #, python-format msgid "" "%(error)s; remove the partial disk copies from the destination host: %(left)s" msgstr "" "%(error)s; yarım kalan disk kopyalarını hedef sunucudan kaldırın: %(left)s" -#: vrtManager/instance.py:504 +#: vrtManager/instance.py:505 #, python-format msgid "The destination host cannot see the NVRAM file %(path)s" msgstr "Hedef sunucu %(path)s NVRAM dosyasını göremiyor" -#: vrtManager/instance.py:585 +#: vrtManager/instance.py:586 #, python-format msgid "%(type)s disk, cannot be checked" msgstr "%(type)s disk, kontrol edilemiyor" -#: vrtManager/instance.py:625 +#: vrtManager/instance.py:626 #, python-format msgid "The destination host already has a VM %(key)s" msgstr "Hedef sunucuda zaten %(key)s sanal makinesi var" -#: vrtManager/instance.py:648 +#: vrtManager/instance.py:649 msgid "The VM was started on the source host during the migration" msgstr "Sanal makine taşıma sırasında kaynak sunucuda başlatıldı" -#: vrtManager/instance.py:664 +#: vrtManager/instance.py:665 #, python-format msgid "" "%(error)s; the VM may now be defined only on the destination host: check both" @@ -10933,7 +10982,7 @@ msgstr "" "%(error)s; sanal makine artık yalnızca hedef sunucuda tanımlı olabilir: iki " "sunucuyu da kontrol edin" -#: vrtManager/instance.py:670 +#: vrtManager/instance.py:671 #, python-format msgid "" "%(error)s; the VM is now defined on both hosts, remove it from the " @@ -10942,7 +10991,7 @@ msgstr "" "%(error)s; sanal makine artık iki sunucuda da tanımlı, hedeften kaldırın: " "%(undo_error)s" -#: vrtManager/instance.py:676 +#: vrtManager/instance.py:677 msgid "" "Snapshot names are 1-64 letters, digits, '.', '_' or '-' and do not start " "with '.'" @@ -10950,13 +10999,13 @@ msgstr "" "Anlık görüntü adları 1-64 harf, rakam, '.', '_' veya '-' karakterinden oluşur" " ve '.' ile başlamaz" -#: vrtManager/instance.py:734 +#: vrtManager/instance.py:735 msgid "A VM with a host's or an external TPM is not cloned; remove it first" msgstr "" "Ana makinenin ya da harici bir TPM'i olan sanal makine klonlanmaz; önce onu " "kaldırın" -#: vrtManager/instance.py:1250 +#: vrtManager/instance.py:1251 msgid "" "A device other than a disk or NIC is in the boot order: change it in the XML " "editor" @@ -10964,47 +11013,47 @@ msgstr "" "Önyükleme sırasında disk veya NIC dışında bir aygıt var: bunu XML " "düzenleyicide değiştirin" -#: vrtManager/instance.py:1265 +#: vrtManager/instance.py:1266 #, python-format msgid "Boot device %(dev)s is not in the definition" msgstr "Ön yükleme aygıtı %(dev)s tanımda yok" -#: vrtManager/instance.py:1285 +#: vrtManager/instance.py:1286 #, python-format msgid "CD-ROM %(dev)s is not in the running definition" msgstr "CD-ROM %(dev)s çalışan tanımda yok" -#: vrtManager/instance.py:1286 +#: vrtManager/instance.py:1287 #, python-format msgid "CD-ROM %(dev)s is not in the persistent definition" msgstr "CD-ROM %(dev)s kalıcı tanımda yok" -#: vrtManager/instance.py:1299 +#: vrtManager/instance.py:1300 #, python-format msgid "Media of %(dev)s changed in the running VM only: %(err)s" msgstr "%(dev)s ortamı yalnızca çalışan sanal makinede değişti: %(err)s" -#: vrtManager/instance.py:1310 +#: vrtManager/instance.py:1311 #, python-format msgid "ISO image %(image)s was not found" msgstr "ISO imajı %(image)s bulunamadı" -#: vrtManager/instance.py:1312 +#: vrtManager/instance.py:1313 #, python-format msgid "ISO image %(image)s is in more than one storage pool" msgstr "ISO imajı %(image)s birden fazla depolama havuzunda var" -#: vrtManager/instance.py:1407 +#: vrtManager/instance.py:1408 #, python-format msgid "Disk %(target_dev)s is not in the VM's definition" msgstr "Disk %(target_dev)s sanal makinenin tanımında yok" -#: vrtManager/instance.py:1539 +#: vrtManager/instance.py:1540 msgid "Please shutdown the instance then try to enable vCPU hotplug" msgstr "" "vCPU hotplug özelliğini etkinleştirmek için önce sanal makineyi kapatın" -#: vrtManager/instance.py:1742 +#: vrtManager/instance.py:1743 #, python-format msgid "" "The serial console is a %(type)s one, the browser opens only a pty one; " @@ -11013,11 +11062,11 @@ msgstr "" "Seri konsol %(type)s türünde, tarayıcı yalnızca pty türünü açar; bunu XML " "düzenleyicide değiştirin" -#: vrtManager/instance.py:1853 +#: vrtManager/instance.py:1854 msgid "The VM has no video card" msgstr "Sanal makinede ekran kartı yok" -#: vrtManager/instance.py:1863 +#: vrtManager/instance.py:1864 #, python-format msgid "" "The VM's CPU topology has %(count)s vCPUs: change it in the XML editor to set" @@ -11026,62 +11075,62 @@ msgstr "" "VM'nin CPU topolojisi %(count)s vCPU içeriyor: başka bir en fazla değer için " "onu XML düzenleyicide değiştirin" -#: vrtManager/instance.py:1889 +#: vrtManager/instance.py:1890 #, python-format msgid "The VM's next start has a maximum memory of %(max)s MiB" msgstr "" "Sanal makinenin bir sonraki başlangıcındaki en yüksek bellek %(max)s MiB" -#: vrtManager/instance.py:2030 +#: vrtManager/instance.py:2031 msgid "" "The VM has external snapshots; internal snapshots cannot be mixed with them" msgstr "" "Sanal makinenin harici anlık görüntüleri var; dahili anlık görüntüler " "bunlarla karıştırılamaz" -#: vrtManager/instance.py:2062 +#: vrtManager/instance.py:2063 msgid "A snapshot with memory is not quiesced; it keeps the whole guest state" msgstr "" "Bellekli bir anlık görüntüde dosya sistemleri dondurulmaz; tüm konuk durumunu" " saklar" -#: vrtManager/instance.py:2064 +#: vrtManager/instance.py:2065 msgid "Only a running VM's file systems can be frozen" msgstr "Yalnızca çalışan bir sanal makinenin dosya sistemleri dondurulabilir" -#: vrtManager/instance.py:2066 +#: vrtManager/instance.py:2067 msgid "The QEMU guest agent is not connected; it freezes the file systems" msgstr "QEMU konuk aracısı bağlı değil; dosya sistemlerini o dondurur" -#: vrtManager/instance.py:2069 +#: vrtManager/instance.py:2070 msgid "" "The VM has internal snapshots; external snapshots cannot be mixed with them" msgstr "" "Sanal makinenin dahili anlık görüntüleri var; harici anlık görüntüler " "bunlarla karıştırılamaz" -#: vrtManager/instance.py:2074 +#: vrtManager/instance.py:2075 msgid "Newer snapshots exist after the last revert; delete them first" msgstr "" "Son geri dönüşten sonra daha yeni anlık görüntüler var; önce onları silin" -#: vrtManager/instance.py:2077 +#: vrtManager/instance.py:2078 msgid "No snapshot is current; revert to a snapshot first" msgstr "Geçerli anlık görüntü yok; önce bir anlık görüntüye geri dönün" -#: vrtManager/instance.py:2083 +#: vrtManager/instance.py:2084 #, python-format msgid "Eject the media from %(dev)s first" msgstr "Önce %(dev)s içindeki ortamı çıkarın" -#: vrtManager/instance.py:2085 +#: vrtManager/instance.py:2086 #, python-format msgid "Disk %(dev)s is not a file; external snapshots need file disks" msgstr "" "Disk %(dev)s bir dosya değil; harici anlık görüntüler dosya diskleri " "gerektirir" -#: vrtManager/instance.py:2093 +#: vrtManager/instance.py:2094 #, python-format msgid "" "The storage pools could not be refreshed, so their free space is unknown: " @@ -11089,21 +11138,21 @@ msgid "" msgstr "" "Depolama havuzları yenilenemedi, bu yüzden boş alanları bilinmiyor: %(err)s" -#: vrtManager/instance.py:2114 +#: vrtManager/instance.py:2117 msgid "Memory is saved only from a running VM" msgstr "Bellek yalnızca çalışan bir sanal makineden kaydedilir" -#: vrtManager/instance.py:2116 +#: vrtManager/instance.py:2119 msgid "The VM has no disk to keep its memory next to" msgstr "Sanal makinenin, belleğinin yanına kaydedileceği bir diski yok" -#: vrtManager/instance.py:2120 +#: vrtManager/instance.py:2123 #, python-format msgid "%(disk)s is not in a storage pool; memory is saved only into one" msgstr "" "%(disk)s bir depolama havuzunda değil; bellek yalnızca bir havuza kaydedilir" -#: vrtManager/instance.py:2151 +#: vrtManager/instance.py:2154 #, python-format msgid "" "Storage pool %(pool)s has %(free).1f GiB free; the snapshot needs %(size).1f " @@ -11114,7 +11163,7 @@ msgstr "" "%(size).1f GiB gerektiriyor (sanal makinenin oradaki disklerinin " "%%%(percent)g kadarı, en az %(minimum)g GiB, ve kaydediliyorsa bellek)" -#: vrtManager/instance.py:2169 +#: vrtManager/instance.py:2172 msgid "" "This snapshot was taken by an older version on a UEFI VM and cannot be " "reverted; delete it instead" @@ -11122,7 +11171,7 @@ msgstr "" "Bu anlık görüntü UEFI bir sanal makinede eski bir sürümle alındı ve geri " "dönülemez; bunun yerine silin" -#: vrtManager/instance.py:2199 +#: vrtManager/instance.py:2202 #, python-format msgid "" "The revert failed twice; try again in a moment (%(error)s). The VM is " @@ -11131,7 +11180,7 @@ msgstr "" "Geri dönüş iki kez başarısız oldu; biraz sonra tekrar deneyin (%(error)s). " "Sanal makine çalışıyor." -#: vrtManager/instance.py:2201 +#: vrtManager/instance.py:2204 #, python-format msgid "" "The revert failed twice; try again in a moment (%(error)s). The VM is shut " @@ -11140,13 +11189,13 @@ msgstr "" "Geri dönüş iki kez başarısız oldu; biraz sonra tekrar deneyin (%(error)s). " "Sanal makine kapalı." -#: vrtManager/instance.py:2369 +#: vrtManager/instance.py:2372 msgid "A disk moves when its VM is defined and running, paused or shut off" msgstr "" "Bir disk, sanal makinesi tanımlıyken ve çalışırken, duraklatılmışken veya " "kapalıyken taşınır" -#: vrtManager/instance.py:2371 +#: vrtManager/instance.py:2374 msgid "" "A disk of a VM with snapshots, a saved state or a running block job does not " "move" @@ -11154,7 +11203,7 @@ msgstr "" "Anlık görüntüleri, kaydedilmiş durumu veya çalışan bir blok işi olan sanal " "makinenin diski taşınmaz" -#: vrtManager/instance.py:2379 +#: vrtManager/instance.py:2382 #, python-format msgid "" "%(dev)s is not a disk file of the VM, the same in its running and next " @@ -11163,121 +11212,121 @@ msgstr "" "%(dev)s, sanal makinenin çalışan ve sonraki başlatma tanımlarında aynı olan " "bir disk dosyası değil" -#: vrtManager/instance.py:2384 +#: vrtManager/instance.py:2387 #, python-format msgid "%(dev)s does not move: only writable raw and qcow2 disks do" msgstr "%(dev)s taşınmaz: yalnızca yazılabilir raw ve qcow2 diskler taşınır" -#: vrtManager/instance.py:2391 +#: vrtManager/instance.py:2394 #, python-format msgid "%(dev)s does not move: no storage pool has %(path)s" msgstr "%(dev)s taşınmaz: hiçbir depolama havuzunda %(path)s yok" -#: vrtManager/instance.py:2393 +#: vrtManager/instance.py:2396 #, python-format msgid "%(dev)s does not move: it has a backing file" msgstr "%(dev)s taşınmaz: temel (backing) dosyası var" -#: vrtManager/instance.py:2396 +#: vrtManager/instance.py:2399 #, python-format msgid "%(pool_name)s is not an active pool of disk files of this host" msgstr "%(pool_name)s bu sunucunun etkin bir disk dosyası havuzu değil" -#: vrtManager/instance.py:2399 +#: vrtManager/instance.py:2402 #, python-format msgid "%(dev)s is in pool %(pool_name)s already" msgstr "%(dev)s zaten %(pool_name)s havuzunda" -#: vrtManager/instance.py:2403 +#: vrtManager/instance.py:2406 #, python-format msgid "Pool %(pool_name)s already has a file %(name)s" msgstr "%(pool_name)s havuzunda zaten %(name)s dosyası var" -#: vrtManager/instance.py:2427 +#: vrtManager/instance.py:2430 #, python-format msgid "The copy of %(dev)s ended before it was complete" msgstr "%(dev)s kopyası tamamlanmadan sona erdi" -#: vrtManager/instance.py:2472 +#: vrtManager/instance.py:2475 #, python-format msgid "%(error)s; remove %(dest)s if it is there: %(cleanup_error)s" msgstr "%(error)s; varsa %(dest)s dosyasını kaldırın: %(cleanup_error)s" -#: vrtManager/instance.py:2474 +#: vrtManager/instance.py:2477 #, python-format msgid "%(error)s; the VM may use %(dest)s now: check its disk %(dev)s" msgstr "" "%(error)s; sanal makine şu anda %(dest)s dosyasını kullanıyor olabilir: " "%(dev)s diskini kontrol edin" -#: vrtManager/instance.py:2481 +#: vrtManager/instance.py:2484 #, python-format msgid "The VM has no internal snapshot named %(name)s" msgstr "Sanal makinenin %(name)s adlı dahili anlık görüntüsü yok" -#: vrtManager/instance.py:2492 +#: vrtManager/instance.py:2495 msgid "A snapshot job is still running on this VM; try again when it ends" msgstr "" "Bu sanal makinede hâlâ bir anlık görüntü işi çalışıyor; bittiğinde tekrar " "deneyin" -#: vrtManager/instance.py:2502 +#: vrtManager/instance.py:2505 msgid "Shut the VM down to revert to an internal snapshot" msgstr "Dahili bir anlık görüntüye geri dönmek için sanal makineyi kapatın" -#: vrtManager/instance.py:2569 +#: vrtManager/instance.py:2572 msgid "Cannot clone a VM whose NVRAM is not a file" msgstr "NVRAM'i dosya olmayan bir sanal makine klonlanamaz" -#: vrtManager/instance.py:2640 +#: vrtManager/instance.py:2643 #, python-format msgid "Clone failed (%(err)s); remove these copies by hand: %(path)s" msgstr "" "Klonlama başarısız oldu (%(err)s); bu kopyaları elle kaldırın: %(path)s" -#: vrtManager/instance.py:2651 +#: vrtManager/instance.py:2654 msgid "Shut the VM down before cloning it" msgstr "Klonlamadan önce sanal makineyi kapatın" -#: vrtManager/instance.py:2678 +#: vrtManager/instance.py:2681 #, python-format msgid "Clone failed (%(err)s); remove these copies by hand: %(leftovers)s" msgstr "" "Klonlama başarısız oldu (%(err)s); bu kopyaları elle kaldırın: %(leftovers)s" -#: vrtManager/instance.py:2689 +#: vrtManager/instance.py:2692 msgid "Live clone needs libvirt 11.10 or later; shut the VM down to clone it" msgstr "" "Canlı klonlama libvirt 11.10 veya sonrasını gerektirir; klonlamak için sanal " "makineyi kapatın" -#: vrtManager/instance.py:2692 +#: vrtManager/instance.py:2695 msgid "A VM with a TPM is cloned only shut down" msgstr "TPM'i olan bir sanal makine yalnızca kapalıyken klonlanır" -#: vrtManager/instance.py:2695 +#: vrtManager/instance.py:2698 #, python-format msgid "Disk %(dev)s is not a local file; shut the VM down to clone it" msgstr "" "Disk %(dev)s yerel bir dosya değil; klonlamak için sanal makineyi kapatın" -#: vrtManager/instance.py:2697 +#: vrtManager/instance.py:2700 #, python-format msgid "Disk %(dev)s is shareable; shut the VM down to clone it" msgstr "Disk %(dev)s paylaşılabilir; klonlamak için sanal makineyi kapatın" -#: vrtManager/instance.py:2702 +#: vrtManager/instance.py:2705 #, python-format msgid "Disk %(dev)s changes at the next start; shut the VM down to clone it" msgstr "" "Disk %(dev)s sonraki başlatmada değişiyor; klonlamak için sanal makineyi " "kapatın" -#: vrtManager/instance.py:2704 +#: vrtManager/instance.py:2707 msgid "Another job is running on the VM; clone it when that ends" msgstr "Sanal makinede başka bir iş çalışıyor; o bittiğinde klonlayın" -#: vrtManager/instance.py:2730 +#: vrtManager/instance.py:2733 #, python-format msgid "" "Storage pool %(pool)s has %(free).1f GiB free; the clone needs %(size).1f GiB" @@ -11287,25 +11336,25 @@ msgstr "" "gerektiriyor (kopyalanan diskler, artı bunların %%%(percent)g kadarı, en az " "%(minimum)g GiB)" -#: vrtManager/instance.py:2747 +#: vrtManager/instance.py:2750 #, python-format msgid "Volume %(name)s already exists in storage pool %(pool)s" msgstr "%(name)s birimi %(pool)s depolama havuzunda zaten var" -#: vrtManager/instance.py:2927 +#: vrtManager/instance.py:2938 msgid "A network interface that is a host device is removed in the XML editor" msgstr "Sunucu aygıtı olan bir ağ arabirimi XML düzenleyicide kaldırılır" -#: vrtManager/instance.py:2943 +#: vrtManager/instance.py:2954 #, python-format msgid "No network interface with MAC %(old_mac)s" msgstr "MAC adresi %(old_mac)s olan ağ arabirimi yok" -#: vrtManager/instance.py:2946 +#: vrtManager/instance.py:2957 msgid "A network interface that is a host device is changed in the XML editor" msgstr "Sunucu aygıtı olan bir ağ arabirimi XML düzenleyicide değiştirilir" -#: vrtManager/instance.py:3040 +#: vrtManager/instance.py:3051 msgid "" "A VM changes its PCI devices while it runs, or is shut off without a saved " "state" @@ -11313,43 +11362,43 @@ msgstr "" "Sanal makine PCI aygıtlarını çalışırken veya kaydedilmiş durumu olmadan " "kapalıyken değiştirir" -#: vrtManager/instance.py:3061 +#: vrtManager/instance.py:3072 #, python-format msgid "%(err)s; whether the VM has %(device)s now is not known" msgstr "%(err)s; sanal makinede şu anda %(device)s olup olmadığı bilinmiyor" -#: vrtManager/instance.py:3063 +#: vrtManager/instance.py:3074 #, python-format msgid "%(err)s; %(device)s: the VM is not running, its next start has it" msgstr "%(err)s; %(device)s: sanal makine çalışmıyor, sonraki başlatmada var" -#: vrtManager/instance.py:3064 +#: vrtManager/instance.py:3075 #, python-format msgid "" "%(err)s; %(device)s: the VM is not running, its next start does not have it" msgstr "%(err)s; %(device)s: sanal makine çalışmıyor, sonraki başlatmada yok" -#: vrtManager/instance.py:3065 +#: vrtManager/instance.py:3076 #, python-format msgid "%(err)s; %(device)s: the running VM has it, its next start has it" msgstr "" "%(err)s; %(device)s: çalışan sanal makinede var, sonraki başlatmada var" -#: vrtManager/instance.py:3066 +#: vrtManager/instance.py:3077 #, python-format msgid "" "%(err)s; %(device)s: the running VM has it, its next start does not have it" msgstr "" "%(err)s; %(device)s: çalışan sanal makinede var, sonraki başlatmada yok" -#: vrtManager/instance.py:3067 +#: vrtManager/instance.py:3078 #, python-format msgid "" "%(err)s; %(device)s: the running VM does not have it, its next start has it" msgstr "" "%(err)s; %(device)s: çalışan sanal makinede yok, sonraki başlatmada var" -#: vrtManager/instance.py:3069 +#: vrtManager/instance.py:3080 #, python-format msgid "" "%(err)s; %(device)s: the running VM does not have it, its next start does not" @@ -11357,48 +11406,48 @@ msgid "" msgstr "" "%(err)s; %(device)s: çalışan sanal makinede yok, sonraki başlatmada yok" -#: vrtManager/instance.py:3103 +#: vrtManager/instance.py:3114 #, python-format msgid "The VM has no PCI device %(address)s" msgstr "Sanal makinede %(address)s PCI aygıtı yok" -#: vrtManager/instance.py:3124 +#: vrtManager/instance.py:3135 msgid "The VM has no USB controller" msgstr "Sanal makinede USB denetleyicisi yok" -#: vrtManager/instance.py:3158 +#: vrtManager/instance.py:3169 msgid "The VM has no such USB device" msgstr "Sanal makinede böyle bir USB aygıtı yok" -#: vrtManager/instance.py:3172 +#: vrtManager/instance.py:3183 #, python-format msgid "The VM has no network interface %(mac)s" msgstr "Sanal makinede %(mac)s ağ arabirimi yok" -#: vrtManager/instance.py:3204 +#: vrtManager/instance.py:3215 msgid "The VM has its own RNG device: change it in the XML editor" msgstr "" "Sanal makinenin kendi RNG aygıtı var: bunu XML düzenleyicide değiştirin" -#: vrtManager/instance.py:3231 +#: vrtManager/instance.py:3242 msgid "The VM has its own TPM: change it in the XML editor" msgstr "Sanal makinenin kendi TPM'i var: bunu XML düzenleyicide değiştirin" -#: vrtManager/instance.py:3250 +#: vrtManager/instance.py:3261 #, python-format msgid "Unknown crash action %(action)s" msgstr "Bilinmeyen çökme eylemi %(action)s" -#: vrtManager/instance.py:3277 +#: vrtManager/instance.py:3288 #, python-format msgid "Network interface %(mac)s is not in the definition" msgstr "%(mac)s ağ arayüzü tanımda yok" -#: vrtManager/instance.py:3368 +#: vrtManager/instance.py:3379 msgid "The guest agent did not answer in time; nothing was changed" msgstr "Konuk ajanı zamanında yanıt vermedi; hiçbir şey değiştirilmedi" -#: vrtManager/instance.py:3371 +#: vrtManager/instance.py:3382 msgid "The VM runs Windows: its guest agent sets no root password or SSH key" msgstr "" "Sanal makinede Windows çalışıyor: konuk ajanı root parolası ya da SSH " diff --git a/locale/zh/LC_MESSAGES/django.mo b/locale/zh/LC_MESSAGES/django.mo index 4ad30756..95c4e527 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 8e71a30b..b13639f3 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-17 14:05+0000\n" +"POT-Creation-Date: 2026-11-17 16:40+0000\n" "PO-Revision-Date: \n" "Last-Translator: \n" "Language-Team: \n" @@ -130,7 +130,7 @@ msgid "max instances" msgstr "最大虚拟机数" #: accounts/models.py:49 accounts/models.py:55 accounts/models.py:61 -#: accounts/models.py:67 +#: accounts/models.py:67 accounts/models.py:73 msgid "-1: no limit; 0: none allowed" msgstr "-1:不限;0:不允许" @@ -146,16 +146,20 @@ msgstr "最大内存(MiB)" msgid "max disk size (GiB)" msgstr "最大磁盘大小(GiB)" -#: accounts/models.py:82 admin/forms.py:22 +#: accounts/models.py:71 +msgid "max backup size (GiB)" +msgstr "最大备份大小 (GiB)" + +#: accounts/models.py:88 admin/forms.py:23 msgid "Can change password" msgstr "可修改密码" -#: accounts/models.py:92 appsettings/models.py:9 computes/models.py:22 +#: accounts/models.py:98 appsettings/models.py:9 computes/models.py:22 #: instances/models.py:33 msgid "name" msgstr "名称" -#: accounts/models.py:93 +#: accounts/models.py:99 msgid "last used" msgstr "上次使用" @@ -164,13 +168,13 @@ msgid "User Profile" msgstr "用户资料" #: accounts/templates/account.html:17 accounts/templates/profile.html:18 -#: admin/forms.py:89 admin/templates/admin/user_list.html:24 +#: admin/forms.py:92 admin/templates/admin/user_list.html:24 #: admin/templates/admin/user_list.html:30 msgid "Superuser" msgstr "超级用户" #: accounts/templates/account.html:19 accounts/templates/profile.html:20 -#: admin/forms.py:89 admin/templates/admin/user_list.html:24 +#: admin/forms.py:92 admin/templates/admin/user_list.html:24 #: admin/templates/admin/user_list.html:32 msgid "Template editor" msgstr "模板编辑者" @@ -214,7 +218,7 @@ msgid "User sections" msgstr "用户页面导航" #: accounts/templates/account.html:50 accounts/templates/account.html:58 -#: admin/forms.py:207 computes/templates/computes/list.html:33 +#: admin/forms.py:210 computes/templates/computes/list.html:33 #: computes/templates/computes/list.html:60 computes/templates/overview.html:90 #: instances/views.py:263 vmbackups/templates/vmbackups/policies.html:16 msgid "VMs" @@ -671,45 +675,56 @@ msgstr "未设置用户邮箱,无法发送二维码" msgid "OTP of %(user)s was reset: a new QR code can be mailed." msgstr "%(user)s 的 OTP 已重置:可以邮寄新的二维码。" -#: admin/forms.py:23 +#: admin/forms.py:22 +msgid "Can back up instances" +msgstr "可以备份虚拟机" + +#: admin/forms.py:24 msgid "Can clone instances" msgstr "可克隆虚拟机" -#: admin/forms.py:24 instances/models.py:436 +#: admin/forms.py:25 instances/models.py:436 msgid "Can access console without password" msgstr "可无密码访问控制台" -#: admin/forms.py:25 +#: admin/forms.py:26 msgid "Can snapshot instances" msgstr "可为虚拟机创建快照" -#: admin/forms.py:26 +#: admin/forms.py:27 msgid "Can view instances" msgstr "可查看虚拟机" -#: admin/forms.py:31 +#: admin/forms.py:32 +msgid "" +"Back up the VMs they may change into targets open to VM owners, restore those" +" backups over the VM or as a new VM, and delete the backups they took, within" +" their quotas" +msgstr "将其可修改的虚拟机备份到向虚拟机所有者开放的目标,将这些备份恢复到虚拟机上或恢复为新虚拟机,并删除自己创建的备份;均在其配额之内" + +#: admin/forms.py:34 msgid "Change their own password on their profile page" msgstr "在个人资料页修改自己的密码" -#: admin/forms.py:32 +#: admin/forms.py:35 msgid "" "Clone the VMs they may change and the templates they may view, within their " "quota" msgstr "在配额范围内克隆其可修改的虚拟机和可查看的模板" -#: admin/forms.py:33 +#: admin/forms.py:36 msgid "Open a console without the VM's console password" msgstr "无需虚拟机的控制台密码即可打开控制台" -#: admin/forms.py:34 +#: admin/forms.py:37 msgid "Take, revert and delete snapshots of the VMs they may change" msgstr "为其可修改的虚拟机创建、恢复和删除快照" -#: admin/forms.py:35 +#: admin/forms.py:38 msgid "See every VM and host in the lists, read-only" msgstr "在列表中查看所有虚拟机和主机(只读)" -#: admin/forms.py:89 admin/templates/admin/logs.html:39 +#: admin/forms.py:92 admin/templates/admin/logs.html:39 #: admin/templates/admin/user_list.html:24 #: admin/templates/admin/user_list.html:34 #: computes/templates/computes/instances.html:47 @@ -721,29 +736,29 @@ msgstr "在列表中查看所有虚拟机和主机(只读)" msgid "User" msgstr "用户" -#: admin/forms.py:96 admin/templates/admin/group_form.html:31 +#: admin/forms.py:99 admin/templates/admin/group_form.html:31 msgid "Permissions" msgstr "权限" -#: admin/forms.py:103 admin/templates/admin/group_list.html:6 +#: admin/forms.py:106 admin/templates/admin/group_list.html:6 #: admin/templates/admin/group_list.html:8 #: admin/templates/admin/group_list.html:24 #: admin/templates/admin/user_form.html:124 templates/navbar.html:36 msgid "Groups" msgstr "用户组" -#: admin/forms.py:157 +#: admin/forms.py:160 #, python-format msgid "NEW_USER_DEFAULT_INSTANCES: %(name)s is not exactly one VM" msgstr "NEW_USER_DEFAULT_INSTANCES:%(name)s 不是唯一的一台虚拟机" -#: admin/forms.py:160 +#: admin/forms.py:163 #, python-format msgid "" "NEW_USER_DEFAULT_INSTANCES: %(name)s has an owner, and only one is allowed" msgstr "NEW_USER_DEFAULT_INSTANCES:%(name)s 已有所有者,且只允许一个所有者" -#: admin/forms.py:208 computes/templates/computes/list.html:61 +#: admin/forms.py:211 computes/templates/computes/list.html:61 #: computes/templates/overview.html:102 instances/forms.py:15 #: instances/templates/allinstances_index_grouped.html:16 #: instances/templates/allinstances_index_nongrouped.html:14 @@ -753,7 +768,7 @@ msgstr "NEW_USER_DEFAULT_INSTANCES:%(name)s 已有所有者,且只允许一 msgid "vCPUs" msgstr "vCPU" -#: admin/forms.py:209 computes/templates/computes/balance.html:62 +#: admin/forms.py:212 computes/templates/computes/balance.html:62 #: computes/templates/computes/bulk_migrate.html:67 #: computes/templates/computes/instances.html:50 #: computes/templates/computes/list.html:62 @@ -767,7 +782,7 @@ msgstr "vCPU" msgid "Memory" msgstr "内存" -#: admin/forms.py:210 instances/models.py:240 +#: admin/forms.py:213 instances/models.py:240 #: instances/templates/create_instance_w2.html:118 #: instances/templates/instances/settings_tab.html:25 #: instances/templates/instances/stats_tab.html:53 vmbackups/forms.py:53 @@ -775,27 +790,38 @@ msgstr "内存" msgid "Disk" msgstr "磁盘" -#: admin/forms.py:220 +#: admin/forms.py:214 instances/templates/instance.html:112 +#: templates/navbar.html:21 vmbackups/templates/vmbackups/index.html:6 +#: vmbackups/templates/vmbackups/index.html:8 +#: vmbackups/templates/vmbackups/policies.html:9 +#: vmbackups/templates/vmbackups/restore.html:9 +#: vmbackups/templates/vmbackups/restore_disk.html:9 +#: vmbackups/templates/vmbackups/restore_over.html:8 +#: vmbackups/templates/vmbackups/targets.html:17 +msgid "Backups" +msgstr "备份" + +#: admin/forms.py:224 msgid "No limit" msgstr "不限" -#: admin/forms.py:236 +#: admin/forms.py:240 msgid "Enter a limit or choose No limit." msgstr "请输入限制值,或选择“不限”。" -#: admin/forms.py:248 +#: admin/forms.py:252 msgid "The user must change it at their next login" msgstr "用户必须在下次登录时修改密码" -#: admin/forms.py:254 +#: admin/forms.py:258 msgid "With a password" msgstr "使用密码" -#: admin/forms.py:254 +#: admin/forms.py:258 msgid "Without a password" msgstr "不使用密码" -#: admin/forms.py:260 +#: admin/forms.py:264 msgid "A user without a password cannot be made to change it" msgstr "没有密码的用户无法被要求修改密码" @@ -3101,7 +3127,7 @@ msgstr "VNC 密码最多 8 个字母、数字或符号,不能有带重音的 msgid "A password takes no line breaks or other control characters." msgstr "密码不能包含换行或其他控制字符。" -#: instances/forms.py:114 vrtManager/instance.py:1721 +#: instances/forms.py:114 vrtManager/instance.py:1722 msgid "" "The console listens on no address (on a network, a socket or nowhere); change" " it in the XML editor" @@ -3117,7 +3143,7 @@ msgstr "控制台监听的不只是 localhost;只有管理员可以移除其 msgid "The name of the virtual machine must not contain any special characters" msgstr "虚拟机名称不能包含任何特殊字符" -#: instances/jobs.py:73 vmbackups/jobs.py:85 +#: instances/jobs.py:73 vmbackups/jobs.py:134 msgid "The VM moved to another compute after the job was queued" msgstr "任务排队后,虚拟机已移到另一个计算节点" @@ -3138,17 +3164,17 @@ msgstr "请从可用名称列表中选择克隆的名称" msgid "%(quota)s: cannot create '%(clone_name)s'." msgstr "%(quota)s:无法创建“%(clone_name)s”。" -#: instances/jobs.py:206 instances/jobs.py:646 vmbackups/jobs.py:602 +#: instances/jobs.py:206 instances/jobs.py:646 vmbackups/jobs.py:675 #, python-format msgid "Instance '%(clone_name)s' already exists!" msgstr "虚拟机 '%(clone_name)s' 已存在!" -#: instances/jobs.py:208 vmbackups/jobs.py:604 +#: instances/jobs.py:208 vmbackups/jobs.py:677 #, python-format msgid "Instance name '%(clone_name)s' is longer than 64 characters" msgstr "虚拟机名称“%(clone_name)s”超过 64 个字符" -#: instances/jobs.py:211 vmbackups/jobs.py:606 +#: instances/jobs.py:211 vmbackups/jobs.py:679 #, python-format msgid "Instance name '%(clone_name)s' contains invalid characters!" msgstr "虚拟机名称 '%(clone_name)s' 包含无效字符!" @@ -3188,7 +3214,7 @@ msgstr "虚拟机未定义;请检查这些卷,然后处理此任务:%(volu msgid "Delete snapshot" msgstr "删除快照" -#: instances/jobs.py:357 vrtManager/instance.py:2480 +#: instances/jobs.py:357 vrtManager/instance.py:2483 #, python-format msgid "The VM has no external snapshot named %(name)s" msgstr "虚拟机没有名为 %(name)s 的外部快照" @@ -3220,7 +3246,7 @@ msgstr "虚拟机已不在运行该任务的计算节点上" msgid "Take snapshot" msgstr "创建快照" -#: instances/jobs.py:425 instances/jobs.py:434 vrtManager/instance.py:2071 +#: instances/jobs.py:425 instances/jobs.py:434 vrtManager/instance.py:2072 #, python-format msgid "A snapshot named %(name)s already exists" msgstr "名为 %(name)s 的快照已存在" @@ -3290,12 +3316,12 @@ msgid "Clone VM" msgstr "克隆虚拟机" #: instances/jobs.py:656 instances/jobs.py:663 instances/jobs.py:1005 -#: vmbackups/jobs.py:291 vmbackups/jobs.py:734 vmbackups/jobs.py:899 -#: vmbackups/jobs.py:1055 +#: vmbackups/jobs.py:351 vmbackups/jobs.py:842 vmbackups/jobs.py:1012 +#: vmbackups/jobs.py:1187 msgid "Copying disks" msgstr "正在复制磁盘" -#: instances/jobs.py:715 vmbackups/jobs.py:371 +#: instances/jobs.py:715 vmbackups/jobs.py:431 msgid "libvirt has no result of the copy" msgstr "libvirt 没有复制的结果" @@ -3306,7 +3332,7 @@ msgid "" "(%(thaw)s); thaw them with: virsh domfsthaw %(vm)s" msgstr "复制失败:%(error)s。无法解冻客户机的文件系统(%(thaw)s);请用以下命令解冻:virsh domfsthaw %(vm)s" -#: instances/jobs.py:729 instances/jobs.py:821 vmbackups/jobs.py:377 +#: instances/jobs.py:729 instances/jobs.py:821 vmbackups/jobs.py:437 msgid "The copy failed" msgstr "复制失败" @@ -3324,11 +3350,11 @@ msgid "" "this job: %(volumes)s" msgstr "克隆的一个卷正在创建中;请检查这些卷,然后处理此任务:%(volumes)s" -#: instances/jobs.py:801 vmbackups/jobs.py:414 +#: instances/jobs.py:801 vmbackups/jobs.py:474 msgid "The job stopped before the copy started" msgstr "任务在复制开始前停止" -#: instances/jobs.py:808 vmbackups/jobs.py:462 +#: instances/jobs.py:808 vmbackups/jobs.py:522 msgid "libvirt is still copying the disks" msgstr "libvirt 仍在复制磁盘" @@ -3361,12 +3387,12 @@ msgstr "镜像已存在。请检查卷或更改虚拟机名称" msgid "Each network card needs a network" msgstr "每个网卡都需要一个网络" -#: instances/jobs.py:868 vrtManager/backup.py:342 vrtManager/instance.py:2888 +#: instances/jobs.py:868 vrtManager/backup.py:351 vrtManager/instance.py:2899 #, python-format msgid "This host has no network %(name)s" msgstr "此主机没有网络 %(name)s" -#: instances/jobs.py:870 vrtManager/backup.py:346 vrtManager/instance.py:2890 +#: instances/jobs.py:870 vrtManager/backup.py:355 vrtManager/instance.py:2901 #, python-format msgid "This host has no network filter %(name)s" msgstr "此主机没有网络过滤器 %(name)s" @@ -3436,7 +3462,7 @@ msgstr "cloud-init 种子需要为磁盘使用目录类型的存储池" msgid "This host offers no firmware %(firmware)s" msgstr "此主机不提供固件 %(firmware)s" -#: instances/jobs.py:957 vrtManager/instance.py:3238 +#: instances/jobs.py:957 vrtManager/instance.py:3249 msgid "This host offers no TPM 2.0: install swtpm on it" msgstr "此主机不提供 TPM 2.0:请在主机上安装 swtpm" @@ -4348,17 +4374,6 @@ msgstr "设置" msgid "Stats" msgstr "统计" -#: instances/templates/instance.html:112 templates/navbar.html:21 -#: vmbackups/templates/vmbackups/index.html:6 -#: vmbackups/templates/vmbackups/index.html:8 -#: vmbackups/templates/vmbackups/policies.html:9 -#: vmbackups/templates/vmbackups/restore.html:9 -#: vmbackups/templates/vmbackups/restore_disk.html:9 -#: vmbackups/templates/vmbackups/restore_over.html:8 -#: vmbackups/templates/vmbackups/targets.html:17 -msgid "Backups" -msgstr "备份" - #: instances/templates/instance.html:116 #: instances/templates/instances/destroy_tab.html:7 msgid "Destroy" @@ -4697,7 +4712,7 @@ msgid "Add USB device" msgstr "添加 USB 设备" #: instances/templates/instances/host_devices_form.html:18 -#: vrtManager/instance.py:3141 +#: vrtManager/instance.py:3152 msgid "" "A VM with a saved state does not change its USB devices: start it, or start " "it without its saved state" @@ -6559,7 +6574,7 @@ msgstr "卷已成功更改。" msgid "Disk %(dev)s is not a storage volume of this instance" msgstr "磁盘 %(dev)s 不是此虚拟机的存储卷" -#: instances/views.py:1603 vrtManager/instance.py:2490 +#: instances/views.py:1603 vrtManager/instance.py:2493 msgid "The VM has a saved state; start it or remove the saved state first" msgstr "虚拟机有保存的状态;请先启动它或删除保存的状态" @@ -6613,7 +6628,7 @@ msgstr "快照未删除:%(err)s" msgid "Add at least one device to the boot order." msgstr "请至少向启动顺序中添加一个设备。" -#: instances/views.py:1916 vrtManager/instance.py:1262 +#: instances/views.py:1916 vrtManager/instance.py:1263 msgid "Invalid Device Type for boot order" msgstr "启动顺序的设备类型无效" @@ -9258,7 +9273,7 @@ msgstr "1:每次备份都是完整备份。大于 1 时,中间的备份只 msgid "Choose a compute or VMs, not both" msgstr "请选择一个计算节点或若干虚拟机,不能同时选择" -#: vmbackups/forms.py:102 vmbackups/jobs.py:58 +#: vmbackups/forms.py:102 vmbackups/jobs.py:106 #, python-format msgid "Backup target %(target)s has no storage pool on %(compute)s" msgstr "备份目标 %(target)s 在 %(compute)s 上没有存储池" @@ -9267,275 +9282,302 @@ msgstr "备份目标 %(target)s 在 %(compute)s 上没有存储池" msgid "Keep one backup at least" msgstr "至少保留一个备份" -#: vmbackups/jobs.py:68 +#: vmbackups/jobs.py:72 +#, python-format +msgid "Backup target %(target)s is not open to VM owners" +msgstr "备份目标 %(target)s 未向虚拟机所有者开放" + +#: vmbackups/jobs.py:86 +#, python-format +msgid "" +"The backup needs %(needed).1f GiB; %(used).1f GiB of your %(limit)d GiB " +"backup quota is used" +msgstr "备份需要 %(needed).1f GiB;您的 %(limit)d GiB 备份配额已使用 %(used).1f GiB" + +#: vmbackups/jobs.py:116 msgid "The VM must be running, paused or shut off to be backed up" msgstr "虚拟机必须处于运行、暂停或关闭状态才能备份" -#: vmbackups/jobs.py:72 +#: vmbackups/jobs.py:120 msgid "" "A running VM's backup needs libvirt 11.10 or later; shut the VM down to back " "it up" msgstr "运行中虚拟机的备份需要 libvirt 11.10 或更高版本;请关闭虚拟机后再备份" -#: vmbackups/jobs.py:74 +#: vmbackups/jobs.py:122 msgid "A paused VM's file systems cannot be frozen" msgstr "无法冻结已暂停虚拟机的文件系统" -#: vmbackups/jobs.py:76 +#: vmbackups/jobs.py:124 msgid "The guest agent does not answer: the file systems cannot be frozen" msgstr "客户机代理没有响应:无法冻结文件系统" -#: vmbackups/jobs.py:126 +#: vmbackups/jobs.py:181 msgid "" "The VM's NVRAM file changed while it was backed up; back the VM up again" msgstr "虚拟机的 NVRAM 文件在备份期间发生了变化;请重新备份该虚拟机" -#: vmbackups/jobs.py:236 +#: vmbackups/jobs.py:291 msgid "Back up VM" msgstr "备份虚拟机" -#: vmbackups/jobs.py:271 +#: vmbackups/jobs.py:330 msgid "The schedule's window ended before the backup could start" msgstr "备份开始前计划的时间窗口已结束" -#: vmbackups/jobs.py:273 +#: vmbackups/jobs.py:332 #, python-format msgid "" "%(compute)s went into maintenance before the scheduled backup could start" msgstr "计划的备份开始前 %(compute)s 已进入维护" -#: vmbackups/jobs.py:307 vmbackups/jobs.py:378 +#: vmbackups/jobs.py:367 vmbackups/jobs.py:438 msgid "Writing the backup's files" msgstr "正在写入备份文件" -#: vmbackups/jobs.py:390 +#: vmbackups/jobs.py:450 msgid "The guest's file systems could not be thawed; trying again" msgstr "无法解冻客户机的文件系统;正在重试" -#: vmbackups/jobs.py:439 +#: vmbackups/jobs.py:499 #, python-format msgid "" "The VM is no longer on the compute the job ran on; check these volumes of the" " backup target, then resolve this job: %(volumes)s" msgstr "虚拟机已不在作业运行的计算节点上;请检查备份目标中的这些卷,然后解决此作业:%(volumes)s" -#: vmbackups/jobs.py:456 +#: vmbackups/jobs.py:516 #, python-format msgid "" "A disk was being copied when the job stopped; check these volumes of the " "backup target, then resolve this job: %(volumes)s" msgstr "作业停止时正在复制磁盘;请检查备份目标中的这些卷,然后解决此作业:%(volumes)s" -#: vmbackups/jobs.py:466 +#: vmbackups/jobs.py:526 #, python-format msgid "" "Another backup runs on the VM; check these volumes of the backup target, then" " resolve this job: %(volumes)s" msgstr "虚拟机上正在运行另一个备份;请检查备份目标中的这些卷,然后解决此作业:%(volumes)s" -#: vmbackups/jobs.py:472 +#: vmbackups/jobs.py:532 #, python-format msgid "" "libvirt has no result of the copy; check these volumes of the backup target, " "then resolve this job: %(volumes)s" msgstr "libvirt 没有复制的结果;请检查备份目标中的这些卷,然后解决此作业:%(volumes)s" -#: vmbackups/jobs.py:480 +#: vmbackups/jobs.py:540 msgid "The job stopped before the copy ended" msgstr "作业在复制结束前停止" -#: vmbackups/jobs.py:487 +#: vmbackups/jobs.py:547 #, python-format msgid "The backup's files could not be written: %(error)s" msgstr "无法写入备份文件:%(error)s" -#: vmbackups/jobs.py:507 +#: vmbackups/jobs.py:567 #, python-format msgid "No compute of backup target %(target)s reaches its storage pool" msgstr "备份目标 %(target)s 的计算节点都无法访问其存储池" -#: vmbackups/jobs.py:541 +#: vmbackups/jobs.py:601 msgid "Delete backup" msgstr "删除备份" -#: vmbackups/jobs.py:552 +#: vmbackups/jobs.py:621 msgid "This backup is being made; cancel its job to stop it" msgstr "此备份正在创建;要停止它,请取消其作业" -#: vmbackups/jobs.py:554 +#: vmbackups/jobs.py:623 vmbackups/jobs.py:638 msgid "Later backups depend on this one; delete them first" msgstr "后续备份依赖于此备份;请先删除它们" -#: vmbackups/jobs.py:567 +#: vmbackups/jobs.py:636 msgid "The backup is no longer beyond what its schedule keeps; it is kept" msgstr "该备份已不再超出其计划保留的数量;予以保留" -#: vmbackups/jobs.py:619 +#: vmbackups/jobs.py:656 +msgid "The job stopped before the deletion began" +msgstr "任务在删除开始前已停止" + +#: vmbackups/jobs.py:692 #, python-format msgid "The backup's file %(name)s is missing from the target" msgstr "目标中缺少备份文件 %(name)s" -#: vmbackups/jobs.py:622 vmbackups/jobs.py:624 +#: vmbackups/jobs.py:695 vmbackups/jobs.py:697 #, python-format msgid "The backup's file %(name)s differs from the one written" msgstr "备份文件 %(name)s 与写入的不同" -#: vmbackups/jobs.py:635 +#: vmbackups/jobs.py:708 #, python-format msgid "The backup taken %(time)s builds on a backup that is gone" msgstr "%(time)s 的备份所依赖的备份已不存在" -#: vmbackups/jobs.py:649 +#: vmbackups/jobs.py:722 #, python-format msgid "The backup's TPM state file %(name)s is not a plain file name" msgstr "备份的 TPM 状态文件 %(name)s 不是普通文件名" -#: vmbackups/jobs.py:661 vmbackups/templates/vmbackups/restore.html:7 +#: vmbackups/jobs.py:734 vmbackups/templates/vmbackups/restore.html:7 msgid "Restore backup" msgstr "恢复备份" -#: vmbackups/jobs.py:674 vmbackups/jobs.py:858 vmbackups/jobs.py:1021 +#: vmbackups/jobs.py:768 +#, python-format +msgid "%(quota)s: cannot restore %(name)s" +msgstr "%(quota)s:无法恢复 %(name)s" + +#: vmbackups/jobs.py:775 vmbackups/jobs.py:969 vmbackups/jobs.py:1153 msgid "Only a ready backup is restored" msgstr "只能恢复就绪的备份" -#: vmbackups/jobs.py:704 +#: vmbackups/jobs.py:812 #, python-format msgid "A VM named %(name)s exists on %(compute)s" msgstr "%(compute)s 上已存在名为 %(name)s 的虚拟机" -#: vmbackups/jobs.py:712 vmbackups/jobs.py:893 vmbackups/jobs.py:1051 +#: vmbackups/jobs.py:820 vmbackups/jobs.py:1006 vmbackups/jobs.py:1183 #, python-format msgid "This host has no active directory storage pool %(pool)s" msgstr "此主机没有名为 %(pool)s 的活动目录存储池" -#: vmbackups/jobs.py:730 +#: vmbackups/jobs.py:838 #, python-format msgid "The NVRAM file %(path)s exists already" msgstr "NVRAM 文件 %(path)s 已存在" -#: vmbackups/jobs.py:766 +#: vmbackups/jobs.py:874 #, python-format msgid "The VM was restored; it did not start: %(error)s" msgstr "虚拟机已恢复;但未能启动:%(error)s" -#: vmbackups/jobs.py:788 vmbackups/jobs.py:980 +#: vmbackups/jobs.py:896 vmbackups/jobs.py:1112 #, python-format msgid "" "A disk was being copied when the job stopped; check this volume, then resolve" " this job: %(volumes)s" msgstr "作业停止时正在复制磁盘;请检查此卷,然后解决此作业:%(volumes)s" -#: vmbackups/jobs.py:793 vmbackups/jobs.py:986 +#: vmbackups/jobs.py:901 vmbackups/jobs.py:1118 #, python-format msgid "" "Storage pool %(pool)s is not active; the restore's copies in it are removed " "when it is" msgstr "存储池 %(pool)s 未激活;其中恢复的副本将在其激活后删除" -#: vmbackups/jobs.py:807 +#: vmbackups/jobs.py:915 msgid "The VM was not defined; its copies were removed" msgstr "虚拟机未定义;其副本已删除" -#: vmbackups/jobs.py:820 +#: vmbackups/jobs.py:928 msgid "Shut the VM down to restore a backup over it" msgstr "请先将虚拟机关机,再将备份恢复到其上" -#: vmbackups/jobs.py:823 +#: vmbackups/jobs.py:931 msgid "The VM has snapshots; delete them to restore a backup over it" msgstr "虚拟机有快照;请删除它们后再将备份恢复到其上" -#: vmbackups/jobs.py:828 +#: vmbackups/jobs.py:936 #, python-format msgid "" "The VM's disks (%(now)s) are not the backup's (%(then)s); restore it as a new" " VM or one disk" msgstr "虚拟机的磁盘(%(now)s)与备份的(%(then)s)不同;请恢复为新虚拟机或恢复单个磁盘" -#: vmbackups/jobs.py:831 +#: vmbackups/jobs.py:940 +#, python-format +msgid "" +"The backup's disk %(dev)s is larger than the VM's now; restore it as a new VM" +msgstr "备份的磁盘 %(dev)s 比虚拟机当前的磁盘大;请恢复为新虚拟机" + +#: vmbackups/jobs.py:943 msgid "The VM's UEFI firmware changed since the backup; restore it as a new VM" msgstr "备份之后虚拟机的 UEFI 固件已更改;请恢复为新虚拟机" -#: vmbackups/jobs.py:833 +#: vmbackups/jobs.py:945 msgid "The VM's TPM changed since the backup; restore it as a new VM" msgstr "备份之后虚拟机的 TPM 已更改;请恢复为新虚拟机" -#: vmbackups/jobs.py:848 +#: vmbackups/jobs.py:960 msgid "Restore backup over the VM" msgstr "将备份恢复到虚拟机上" -#: vmbackups/jobs.py:861 +#: vmbackups/jobs.py:973 msgid "The backup's VM is no longer in the panel; restore it as a new VM" msgstr "备份的虚拟机已不在面板中;请恢复为新虚拟机" -#: vmbackups/jobs.py:884 +#: vmbackups/jobs.py:997 msgid "The VM's disks changed after the job was queued" msgstr "任务排队后虚拟机的磁盘已更改" -#: vmbackups/jobs.py:916 +#: vmbackups/jobs.py:1029 msgid "The VM changed while its backup was copied; it keeps its disks" msgstr "复制备份期间虚拟机发生了变化;虚拟机保留其磁盘" -#: vmbackups/jobs.py:917 +#: vmbackups/jobs.py:1032 msgid "Replacing the VM's disks" msgstr "正在替换虚拟机的磁盘" -#: vmbackups/jobs.py:961 +#: vmbackups/jobs.py:1092 msgid "" "The VM moved to another compute; check its disks and the restore's copies, " "then resolve this job" msgstr "虚拟机已迁移到另一台计算节点;请检查其磁盘和恢复的副本,然后处理此任务" -#: vmbackups/jobs.py:973 +#: vmbackups/jobs.py:1105 msgid "" "The VM was started while its disks were being replaced; check its disks, then" " resolve this job" msgstr "替换磁盘期间虚拟机被启动;请检查其磁盘,然后处理此任务" -#: vmbackups/jobs.py:991 +#: vmbackups/jobs.py:1123 msgid "The VM keeps its disks; the restore's copies were removed" msgstr "虚拟机保留其磁盘;恢复的副本已删除" -#: vmbackups/jobs.py:1003 +#: vmbackups/jobs.py:1135 msgid "Restore a disk of a backup" msgstr "恢复备份的一个磁盘" -#: vmbackups/jobs.py:1014 +#: vmbackups/jobs.py:1146 #, python-format msgid "The backup has no disk %(dev)s" msgstr "备份中没有磁盘 %(dev)s" -#: vmbackups/jobs.py:1024 +#: vmbackups/jobs.py:1156 #, python-format msgid "%(name)s is not a volume name" msgstr "%(name)s 不是有效的卷名" -#: vmbackups/jobs.py:1083 +#: vmbackups/jobs.py:1215 #, python-format msgid "" "The disk was being copied when the job stopped; check this volume, then " "resolve this job: %(volume)s" msgstr "任务停止时磁盘正在复制;请检查此卷,然后处理此任务:%(volume)s" -#: vmbackups/jobs.py:1086 +#: vmbackups/jobs.py:1218 msgid "The disk was not restored" msgstr "磁盘未恢复" -#: vmbackups/jobs.py:1107 vmbackups/templates/vmbackups/target.html:18 +#: vmbackups/jobs.py:1239 vmbackups/templates/vmbackups/target.html:18 msgid "Read backups from target" msgstr "从目标读取备份" -#: vmbackups/jobs.py:1168 +#: vmbackups/jobs.py:1300 #, python-format msgid "" "Not read, as a file of the backup is missing, changed or unreadable: " "%(names)s" msgstr "由于备份的某个文件缺失、已更改或无法读取,未读取:%(names)s" -#: vmbackups/jobs.py:1184 +#: vmbackups/jobs.py:1316 msgid "Check backup target" msgstr "检查备份目标" -#: vmbackups/jobs.py:1215 +#: vmbackups/jobs.py:1347 #, python-format msgid "Files of these backups are missing from the target: %(backups)s" msgstr "以下备份的文件在目标中缺失:%(backups)s" @@ -10004,20 +10046,20 @@ msgid "" "backed up" msgstr "磁盘 %(dev)s(%(path)s)不在主机的任何存储池中;无法备份" -#: vrtManager/backup.py:113 +#: vrtManager/backup.py:115 #, python-format msgid "" "Disks %(devs)s change at the next start; back the VM up after it restarts" msgstr "磁盘 %(devs)s 将在下次启动时更改;请在虚拟机重启后再备份" -#: vrtManager/backup.py:118 vrtManager/instance.py:495 +#: vrtManager/backup.py:120 vrtManager/instance.py:496 #, python-format msgid "" "The NVRAM file %(path)s is not in libvirt's NVRAM directory %(dir)s and " "cannot be copied" msgstr "NVRAM 文件 %(path)s 不在 libvirt 的 NVRAM 目录 %(dir)s 中,无法复制" -#: vrtManager/backup.py:222 +#: vrtManager/backup.py:231 #, python-format msgid "" "Storage pool %(pool)s has %(free).1f GiB free; the backup needs %(size).1f " @@ -10026,31 +10068,31 @@ msgstr "" "存储池 %(pool)s 有 %(free).1f GiB 可用空间;备份需要 %(size).1f GiB(复制的磁盘,加上其 " "%(percent)g%%,至少 %(minimum)g GiB)" -#: vrtManager/backup.py:235 +#: vrtManager/backup.py:244 #, python-format msgid "" "The file %(name)s read back from the backup target differs from the one " "written" msgstr "从备份目标读回的文件 %(name)s 与写入的不同" -#: vrtManager/backup.py:329 +#: vrtManager/backup.py:338 #, python-format msgid "" "This host cannot run the VM's emulator %(emulator)s with machine type " "%(machine)s: %(error)s" msgstr "此主机无法以机器类型 %(machine)s 运行虚拟机的模拟器 %(emulator)s:%(error)s" -#: vrtManager/backup.py:333 +#: vrtManager/backup.py:342 #, python-format msgid "This host has no firmware %(loader)s" msgstr "此主机没有固件 %(loader)s" -#: vrtManager/backup.py:339 +#: vrtManager/backup.py:348 #, python-format msgid "This host offers no TPM 2.0 %(model)s: install swtpm on it" msgstr "此主机不提供 TPM 2.0 %(model)s:请在其上安装 swtpm" -#: vrtManager/backup.py:344 +#: vrtManager/backup.py:353 #, python-format msgid "This host has no bridge %(name)s" msgstr "此主机没有网桥 %(name)s" @@ -10114,320 +10156,320 @@ msgid "" "from cannot be checked; start the pool first" msgstr "存储池 %(pool)s 未激活:无法检查其中虚拟机磁盘所基于的文件;请先启动该存储池" -#: vrtManager/instance.py:179 +#: vrtManager/instance.py:180 msgid "The VM is not running" msgstr "虚拟机未在运行" -#: vrtManager/instance.py:184 +#: vrtManager/instance.py:185 msgid "A running or paused VM cannot be migrated offline" msgstr "运行中或已暂停的虚拟机不能离线迁移" -#: vrtManager/instance.py:187 +#: vrtManager/instance.py:188 msgid "The VM can be migrated when it is running, paused or shut off" msgstr "虚拟机在运行、暂停或关机时可以迁移" -#: vrtManager/instance.py:210 +#: vrtManager/instance.py:211 msgid "A VM with snapshots cannot be migrated" msgstr "有快照的虚拟机不能迁移" -#: vrtManager/instance.py:213 +#: vrtManager/instance.py:214 msgid "A VM with a saved state cannot be migrated" msgstr "有保存的状态的虚拟机不能迁移" -#: vrtManager/instance.py:220 +#: vrtManager/instance.py:221 msgid "A VM with host devices cannot be migrated; remove them first" msgstr "有主机设备的虚拟机不能迁移;请先移除它们" -#: vrtManager/instance.py:224 +#: vrtManager/instance.py:225 #, python-format msgid "The destination host does not have these networks of the VM: %(names)s" msgstr "目标主机没有该虚拟机的这些网络:%(names)s" -#: vrtManager/instance.py:228 +#: vrtManager/instance.py:229 #, python-format msgid "" "The destination host does not have these network filters of the VM: %(names)s" msgstr "目标主机没有该虚拟机的这些网络过滤器:%(names)s" -#: vrtManager/instance.py:231 +#: vrtManager/instance.py:232 #, python-format msgid "" "These network filters of the VM have other rules on the destination host: " "%(names)s" msgstr "该虚拟机的这些网络过滤器在目标主机上的规则不同:%(names)s" -#: vrtManager/instance.py:234 +#: vrtManager/instance.py:235 #, python-format msgid "The destination host does not have these secrets of the VM: %(names)s" msgstr "目标主机没有该虚拟机的这些机密:%(names)s" -#: vrtManager/instance.py:241 +#: vrtManager/instance.py:242 #, python-format msgid "The destination host does not have these disks of the VM: %(disks)s" msgstr "目标主机没有该虚拟机的这些磁盘:%(disks)s" -#: vrtManager/instance.py:242 +#: vrtManager/instance.py:243 #, python-format msgid "%(target)s (%(source)s)" msgstr "%(target)s(%(source)s)" -#: vrtManager/instance.py:250 +#: vrtManager/instance.py:251 msgid "Destination host emulator is different. Cannot be migrated" msgstr "目标主机的模拟器不同,无法迁移" -#: vrtManager/instance.py:385 +#: vrtManager/instance.py:386 msgid "an image is not copied; eject it first" msgstr "镜像不会被复制;请先弹出它" -#: vrtManager/instance.py:388 +#: vrtManager/instance.py:389 msgid "a read-only or encrypted disk is not copied" msgstr "只读或加密的磁盘不会被复制" -#: vrtManager/instance.py:391 +#: vrtManager/instance.py:392 msgid "only raw and qcow2 disks are copied" msgstr "只复制 raw 和 qcow2 磁盘" -#: vrtManager/instance.py:393 +#: vrtManager/instance.py:394 msgid "no storage pool of the source host has it" msgstr "源主机的任何存储池中都没有它" -#: vrtManager/instance.py:395 +#: vrtManager/instance.py:396 msgid "a disk with a backing file is not copied" msgstr "有后备文件的磁盘不会被复制" -#: vrtManager/instance.py:415 +#: vrtManager/instance.py:416 #, python-format msgid "" "%(target)s (%(path)s): the destination host does not share it; choose a pool " "to copy it to" msgstr "%(target)s (%(path)s):目标主机不共享它;请选择要复制到的存储池" -#: vrtManager/instance.py:419 +#: vrtManager/instance.py:420 #, python-format msgid "%(target)s (%(path)s): %(refusal)s" msgstr "%(target)s (%(path)s):%(refusal)s" -#: vrtManager/instance.py:424 +#: vrtManager/instance.py:425 #, python-format msgid "" "%(target)s (%(path)s): the destination host has no pool %(pool)s for disk " "files" msgstr "%(target)s (%(path)s):目标主机没有用于磁盘文件的存储池 %(pool)s" -#: vrtManager/instance.py:431 +#: vrtManager/instance.py:432 #, python-format msgid "" "%(target)s (%(path)s): pool %(pool)s of the destination host already has a " "file %(file)s" msgstr "%(target)s (%(path)s):目标主机的存储池 %(pool)s 中已有文件 %(file)s" -#: vrtManager/instance.py:438 +#: vrtManager/instance.py:439 #, python-format msgid "%(target)s (%(path)s): another disk is copied to %(dest)s" msgstr "%(target)s (%(path)s):另一个磁盘已复制到 %(dest)s" -#: vrtManager/instance.py:443 +#: vrtManager/instance.py:444 #, python-format msgid "%(target)s: the VM has no disk file to copy" msgstr "%(target)s:虚拟机没有可复制的磁盘文件" -#: vrtManager/instance.py:447 +#: vrtManager/instance.py:448 #, python-format msgid "" "%(target)s (%(path)s) of the next start: the destination host does not share " "it" msgstr "下次启动的 %(target)s (%(path)s):目标主机不共享它" -#: vrtManager/instance.py:451 +#: vrtManager/instance.py:452 #, python-format msgid "The disks cannot be migrated: %(problems)s" msgstr "磁盘无法迁移:%(problems)s" -#: vrtManager/instance.py:464 +#: vrtManager/instance.py:465 #, python-format msgid "" "%(error)s; remove the partial disk copies from the destination host: " "%(copies)s" msgstr "%(error)s;请从目标主机删除不完整的磁盘副本:%(copies)s" -#: vrtManager/instance.py:481 +#: vrtManager/instance.py:482 #, python-format msgid "" "%(error)s; remove the partial disk copies from the destination host: %(left)s" msgstr "%(error)s;请从目标主机删除不完整的磁盘副本:%(left)s" -#: vrtManager/instance.py:504 +#: vrtManager/instance.py:505 #, python-format msgid "The destination host cannot see the NVRAM file %(path)s" msgstr "目标主机看不到 NVRAM 文件 %(path)s" -#: vrtManager/instance.py:585 +#: vrtManager/instance.py:586 #, python-format msgid "%(type)s disk, cannot be checked" msgstr "%(type)s 磁盘,无法检查" -#: vrtManager/instance.py:625 +#: vrtManager/instance.py:626 #, python-format msgid "The destination host already has a VM %(key)s" msgstr "目标主机上已有虚拟机 %(key)s" -#: vrtManager/instance.py:648 +#: vrtManager/instance.py:649 msgid "The VM was started on the source host during the migration" msgstr "迁移期间虚拟机在源主机上被启动" -#: vrtManager/instance.py:664 +#: vrtManager/instance.py:665 #, python-format msgid "" "%(error)s; the VM may now be defined only on the destination host: check both" " hosts" msgstr "%(error)s;虚拟机现在可能只在目标主机上定义:请检查两台主机" -#: vrtManager/instance.py:670 +#: vrtManager/instance.py:671 #, python-format msgid "" "%(error)s; the VM is now defined on both hosts, remove it from the " "destination: %(undo_error)s" msgstr "%(error)s;虚拟机现在在两台主机上都有定义,请从目标主机删除它:%(undo_error)s" -#: vrtManager/instance.py:676 +#: vrtManager/instance.py:677 msgid "" "Snapshot names are 1-64 letters, digits, '.', '_' or '-' and do not start " "with '.'" msgstr "快照名称为 1-64 个字母、数字、'.'、'_' 或 '-',且不能以 '.' 开头" -#: vrtManager/instance.py:734 +#: vrtManager/instance.py:735 msgid "A VM with a host's or an external TPM is not cloned; remove it first" msgstr "带有主机 TPM 或外部 TPM 的虚拟机无法克隆;请先将其移除" -#: vrtManager/instance.py:1250 +#: vrtManager/instance.py:1251 msgid "" "A device other than a disk or NIC is in the boot order: change it in the XML " "editor" msgstr "启动顺序中有磁盘或网卡以外的设备:请在 XML 编辑器中修改" -#: vrtManager/instance.py:1265 +#: vrtManager/instance.py:1266 #, python-format msgid "Boot device %(dev)s is not in the definition" msgstr "启动设备 %(dev)s 不在定义中" -#: vrtManager/instance.py:1285 +#: vrtManager/instance.py:1286 #, python-format msgid "CD-ROM %(dev)s is not in the running definition" msgstr "CD-ROM %(dev)s 不在运行中的定义中" -#: vrtManager/instance.py:1286 +#: vrtManager/instance.py:1287 #, python-format msgid "CD-ROM %(dev)s is not in the persistent definition" msgstr "CD-ROM %(dev)s 不在持久定义中" -#: vrtManager/instance.py:1299 +#: vrtManager/instance.py:1300 #, python-format msgid "Media of %(dev)s changed in the running VM only: %(err)s" msgstr "%(dev)s 的介质仅在运行中的虚拟机中更改:%(err)s" -#: vrtManager/instance.py:1310 +#: vrtManager/instance.py:1311 #, python-format msgid "ISO image %(image)s was not found" msgstr "未找到 ISO 镜像 %(image)s" -#: vrtManager/instance.py:1312 +#: vrtManager/instance.py:1313 #, python-format msgid "ISO image %(image)s is in more than one storage pool" msgstr "ISO 镜像 %(image)s 位于多个存储池中" -#: vrtManager/instance.py:1407 +#: vrtManager/instance.py:1408 #, python-format msgid "Disk %(target_dev)s is not in the VM's definition" msgstr "磁盘 %(target_dev)s 不在虚拟机的定义中" -#: vrtManager/instance.py:1539 +#: vrtManager/instance.py:1540 msgid "Please shutdown the instance then try to enable vCPU hotplug" msgstr "请先关闭虚拟机,再启用 vCPU 热插拔" -#: vrtManager/instance.py:1742 +#: vrtManager/instance.py:1743 #, python-format msgid "" "The serial console is a %(type)s one, the browser opens only a pty one; " "change it in the XML editor" msgstr "串行控制台的类型是 %(type)s,浏览器只能打开 pty 类型的;请在 XML 编辑器中更改" -#: vrtManager/instance.py:1853 +#: vrtManager/instance.py:1854 msgid "The VM has no video card" msgstr "虚拟机没有显卡" -#: vrtManager/instance.py:1863 +#: vrtManager/instance.py:1864 #, python-format msgid "" "The VM's CPU topology has %(count)s vCPUs: change it in the XML editor to set" " another maximum" msgstr "该虚拟机的 CPU 拓扑为 %(count)s 个 vCPU:要设置其他最大值,请在 XML 编辑器中修改拓扑" -#: vrtManager/instance.py:1889 +#: vrtManager/instance.py:1890 #, python-format msgid "The VM's next start has a maximum memory of %(max)s MiB" msgstr "虚拟机下次启动时的最大内存为 %(max)s MiB" -#: vrtManager/instance.py:2030 +#: vrtManager/instance.py:2031 msgid "" "The VM has external snapshots; internal snapshots cannot be mixed with them" msgstr "虚拟机有外部快照;内部快照不能与其混用" -#: vrtManager/instance.py:2062 +#: vrtManager/instance.py:2063 msgid "A snapshot with memory is not quiesced; it keeps the whole guest state" msgstr "含内存的快照不会静默文件系统;它保存整个客户机状态" -#: vrtManager/instance.py:2064 +#: vrtManager/instance.py:2065 msgid "Only a running VM's file systems can be frozen" msgstr "只有运行中的虚拟机的文件系统可以冻结" -#: vrtManager/instance.py:2066 +#: vrtManager/instance.py:2067 msgid "The QEMU guest agent is not connected; it freezes the file systems" msgstr "QEMU 客户机代理未连接;文件系统由它冻结" -#: vrtManager/instance.py:2069 +#: vrtManager/instance.py:2070 msgid "" "The VM has internal snapshots; external snapshots cannot be mixed with them" msgstr "虚拟机有内部快照;外部快照不能与其混用" -#: vrtManager/instance.py:2074 +#: vrtManager/instance.py:2075 msgid "Newer snapshots exist after the last revert; delete them first" msgstr "上次还原后存在更新的快照;请先删除它们" -#: vrtManager/instance.py:2077 +#: vrtManager/instance.py:2078 msgid "No snapshot is current; revert to a snapshot first" msgstr "没有当前快照;请先还原到某个快照" -#: vrtManager/instance.py:2083 +#: vrtManager/instance.py:2084 #, python-format msgid "Eject the media from %(dev)s first" msgstr "请先弹出 %(dev)s 中的介质" -#: vrtManager/instance.py:2085 +#: vrtManager/instance.py:2086 #, python-format msgid "Disk %(dev)s is not a file; external snapshots need file disks" msgstr "磁盘 %(dev)s 不是文件;外部快照需要文件磁盘" -#: vrtManager/instance.py:2093 +#: vrtManager/instance.py:2094 #, python-format msgid "" "The storage pools could not be refreshed, so their free space is unknown: " "%(err)s" msgstr "无法刷新存储池,其可用空间未知:%(err)s" -#: vrtManager/instance.py:2114 +#: vrtManager/instance.py:2117 msgid "Memory is saved only from a running VM" msgstr "只能保存运行中的虚拟机的内存" -#: vrtManager/instance.py:2116 +#: vrtManager/instance.py:2119 msgid "The VM has no disk to keep its memory next to" msgstr "虚拟机没有可存放其内存的磁盘" -#: vrtManager/instance.py:2120 +#: vrtManager/instance.py:2123 #, python-format msgid "%(disk)s is not in a storage pool; memory is saved only into one" msgstr "%(disk)s 不在存储池中;内存只能保存到存储池中" -#: vrtManager/instance.py:2151 +#: vrtManager/instance.py:2154 #, python-format msgid "" "Storage pool %(pool)s has %(free).1f GiB free; the snapshot needs %(size).1f " @@ -10437,147 +10479,147 @@ msgstr "" "存储池 %(pool)s 可用 %(free).1f GiB;快照需要 %(size).1f GiB(其中虚拟机磁盘的 %(percent)g%%,至少 " "%(minimum)g GiB,若保存内存则另加内存)" -#: vrtManager/instance.py:2169 +#: vrtManager/instance.py:2172 msgid "" "This snapshot was taken by an older version on a UEFI VM and cannot be " "reverted; delete it instead" msgstr "此快照由旧版本在 UEFI 虚拟机上创建,无法还原;请将其删除" -#: vrtManager/instance.py:2199 +#: vrtManager/instance.py:2202 #, python-format msgid "" "The revert failed twice; try again in a moment (%(error)s). The VM is " "running." msgstr "还原两次失败;请稍后重试(%(error)s)。虚拟机正在运行。" -#: vrtManager/instance.py:2201 +#: vrtManager/instance.py:2204 #, python-format msgid "" "The revert failed twice; try again in a moment (%(error)s). The VM is shut " "off." msgstr "还原两次失败;请稍后重试(%(error)s)。虚拟机已关机。" -#: vrtManager/instance.py:2369 +#: vrtManager/instance.py:2372 msgid "A disk moves when its VM is defined and running, paused or shut off" msgstr "仅当虚拟机已定义且处于运行、暂停或关机状态时才能移动磁盘" -#: vrtManager/instance.py:2371 +#: vrtManager/instance.py:2374 msgid "" "A disk of a VM with snapshots, a saved state or a running block job does not " "move" msgstr "有快照、保存的状态或正在运行块任务的虚拟机的磁盘不能移动" -#: vrtManager/instance.py:2379 +#: vrtManager/instance.py:2382 #, python-format msgid "" "%(dev)s is not a disk file of the VM, the same in its running and next " "start's definition" msgstr "%(dev)s 不是该虚拟机在运行中的定义和下次启动定义中相同的磁盘文件" -#: vrtManager/instance.py:2384 +#: vrtManager/instance.py:2387 #, python-format msgid "%(dev)s does not move: only writable raw and qcow2 disks do" msgstr "%(dev)s 不能移动:只能移动可写的 raw 和 qcow2 磁盘" -#: vrtManager/instance.py:2391 +#: vrtManager/instance.py:2394 #, python-format msgid "%(dev)s does not move: no storage pool has %(path)s" msgstr "%(dev)s 不能移动:没有存储池包含 %(path)s" -#: vrtManager/instance.py:2393 +#: vrtManager/instance.py:2396 #, python-format msgid "%(dev)s does not move: it has a backing file" msgstr "%(dev)s 不能移动:它有后备文件" -#: vrtManager/instance.py:2396 +#: vrtManager/instance.py:2399 #, python-format msgid "%(pool_name)s is not an active pool of disk files of this host" msgstr "%(pool_name)s 不是此主机上活动的磁盘文件存储池" -#: vrtManager/instance.py:2399 +#: vrtManager/instance.py:2402 #, python-format msgid "%(dev)s is in pool %(pool_name)s already" msgstr "%(dev)s 已在存储池 %(pool_name)s 中" -#: vrtManager/instance.py:2403 +#: vrtManager/instance.py:2406 #, python-format msgid "Pool %(pool_name)s already has a file %(name)s" msgstr "存储池 %(pool_name)s 中已有文件 %(name)s" -#: vrtManager/instance.py:2427 +#: vrtManager/instance.py:2430 #, python-format msgid "The copy of %(dev)s ended before it was complete" msgstr "%(dev)s 的复制在完成前结束" -#: vrtManager/instance.py:2472 +#: vrtManager/instance.py:2475 #, python-format msgid "%(error)s; remove %(dest)s if it is there: %(cleanup_error)s" msgstr "%(error)s;如果 %(dest)s 存在请将其删除:%(cleanup_error)s" -#: vrtManager/instance.py:2474 +#: vrtManager/instance.py:2477 #, python-format msgid "%(error)s; the VM may use %(dest)s now: check its disk %(dev)s" msgstr "%(error)s;虚拟机现在可能在使用 %(dest)s:请检查其磁盘 %(dev)s" -#: vrtManager/instance.py:2481 +#: vrtManager/instance.py:2484 #, python-format msgid "The VM has no internal snapshot named %(name)s" msgstr "虚拟机没有名为 %(name)s 的内部快照" -#: vrtManager/instance.py:2492 +#: vrtManager/instance.py:2495 msgid "A snapshot job is still running on this VM; try again when it ends" msgstr "此虚拟机上仍有快照任务在运行;请在其结束后重试" -#: vrtManager/instance.py:2502 +#: vrtManager/instance.py:2505 msgid "Shut the VM down to revert to an internal snapshot" msgstr "请关闭虚拟机后再还原到内部快照" -#: vrtManager/instance.py:2569 +#: vrtManager/instance.py:2572 msgid "Cannot clone a VM whose NVRAM is not a file" msgstr "NVRAM 不是文件的虚拟机无法克隆" -#: vrtManager/instance.py:2640 +#: vrtManager/instance.py:2643 #, python-format msgid "Clone failed (%(err)s); remove these copies by hand: %(path)s" msgstr "克隆失败(%(err)s);请手动删除这些副本:%(path)s" -#: vrtManager/instance.py:2651 +#: vrtManager/instance.py:2654 msgid "Shut the VM down before cloning it" msgstr "请先关闭虚拟机再克隆" -#: vrtManager/instance.py:2678 +#: vrtManager/instance.py:2681 #, python-format msgid "Clone failed (%(err)s); remove these copies by hand: %(leftovers)s" msgstr "克隆失败(%(err)s);请手动删除这些副本:%(leftovers)s" -#: vrtManager/instance.py:2689 +#: vrtManager/instance.py:2692 msgid "Live clone needs libvirt 11.10 or later; shut the VM down to clone it" msgstr "在线克隆需要 libvirt 11.10 或更高版本;请关闭虚拟机后再克隆" -#: vrtManager/instance.py:2692 +#: vrtManager/instance.py:2695 msgid "A VM with a TPM is cloned only shut down" msgstr "带 TPM 的虚拟机只能在关机时克隆" -#: vrtManager/instance.py:2695 +#: vrtManager/instance.py:2698 #, python-format msgid "Disk %(dev)s is not a local file; shut the VM down to clone it" msgstr "磁盘 %(dev)s 不是本地文件;请关闭虚拟机后再克隆" -#: vrtManager/instance.py:2697 +#: vrtManager/instance.py:2700 #, python-format msgid "Disk %(dev)s is shareable; shut the VM down to clone it" msgstr "磁盘 %(dev)s 是可共享的;请关闭虚拟机后再克隆" -#: vrtManager/instance.py:2702 +#: vrtManager/instance.py:2705 #, python-format msgid "Disk %(dev)s changes at the next start; shut the VM down to clone it" msgstr "磁盘 %(dev)s 在下次启动时会改变;请关闭虚拟机后再克隆" -#: vrtManager/instance.py:2704 +#: vrtManager/instance.py:2707 msgid "Another job is running on the VM; clone it when that ends" msgstr "虚拟机上有另一个任务正在运行;请在其结束后再克隆" -#: vrtManager/instance.py:2730 +#: vrtManager/instance.py:2733 #, python-format msgid "" "Storage pool %(pool)s has %(free).1f GiB free; the clone needs %(size).1f GiB" @@ -10586,111 +10628,111 @@ msgstr "" "存储池 %(pool)s 可用 %(free).1f GiB;克隆需要 %(size).1f GiB(复制的磁盘,再加其 %(percent)g%%,至少" " %(minimum)g GiB)" -#: vrtManager/instance.py:2747 +#: vrtManager/instance.py:2750 #, python-format msgid "Volume %(name)s already exists in storage pool %(pool)s" msgstr "卷 %(name)s 已存在于存储池 %(pool)s 中" -#: vrtManager/instance.py:2927 +#: vrtManager/instance.py:2938 msgid "A network interface that is a host device is removed in the XML editor" msgstr "作为主机设备的网络接口需在 XML 编辑器中删除" -#: vrtManager/instance.py:2943 +#: vrtManager/instance.py:2954 #, python-format msgid "No network interface with MAC %(old_mac)s" msgstr "没有 MAC 为 %(old_mac)s 的网络接口" -#: vrtManager/instance.py:2946 +#: vrtManager/instance.py:2957 msgid "A network interface that is a host device is changed in the XML editor" msgstr "作为主机设备的网络接口需在 XML 编辑器中修改" -#: vrtManager/instance.py:3040 +#: vrtManager/instance.py:3051 msgid "" "A VM changes its PCI devices while it runs, or is shut off without a saved " "state" msgstr "虚拟机只能在运行时或无保存的状态的关机时更改其 PCI 设备" -#: vrtManager/instance.py:3061 +#: vrtManager/instance.py:3072 #, python-format msgid "%(err)s; whether the VM has %(device)s now is not known" msgstr "%(err)s;虚拟机现在是否有 %(device)s 未知" -#: vrtManager/instance.py:3063 +#: vrtManager/instance.py:3074 #, python-format msgid "%(err)s; %(device)s: the VM is not running, its next start has it" msgstr "%(err)s;%(device)s:虚拟机未运行,下次启动时有它" -#: vrtManager/instance.py:3064 +#: vrtManager/instance.py:3075 #, python-format msgid "" "%(err)s; %(device)s: the VM is not running, its next start does not have it" msgstr "%(err)s;%(device)s:虚拟机未运行,下次启动时没有它" -#: vrtManager/instance.py:3065 +#: vrtManager/instance.py:3076 #, python-format msgid "%(err)s; %(device)s: the running VM has it, its next start has it" msgstr "%(err)s;%(device)s:运行中的虚拟机有它,下次启动时有它" -#: vrtManager/instance.py:3066 +#: vrtManager/instance.py:3077 #, python-format msgid "" "%(err)s; %(device)s: the running VM has it, its next start does not have it" msgstr "%(err)s;%(device)s:运行中的虚拟机有它,下次启动时没有它" -#: vrtManager/instance.py:3067 +#: vrtManager/instance.py:3078 #, python-format msgid "" "%(err)s; %(device)s: the running VM does not have it, its next start has it" msgstr "%(err)s;%(device)s:运行中的虚拟机没有它,下次启动时有它" -#: vrtManager/instance.py:3069 +#: vrtManager/instance.py:3080 #, python-format msgid "" "%(err)s; %(device)s: the running VM does not have it, its next start does not" " have it" msgstr "%(err)s;%(device)s:运行中的虚拟机没有它,下次启动时没有它" -#: vrtManager/instance.py:3103 +#: vrtManager/instance.py:3114 #, python-format msgid "The VM has no PCI device %(address)s" msgstr "虚拟机没有 PCI 设备 %(address)s" -#: vrtManager/instance.py:3124 +#: vrtManager/instance.py:3135 msgid "The VM has no USB controller" msgstr "虚拟机没有 USB 控制器" -#: vrtManager/instance.py:3158 +#: vrtManager/instance.py:3169 msgid "The VM has no such USB device" msgstr "虚拟机没有此 USB 设备" -#: vrtManager/instance.py:3172 +#: vrtManager/instance.py:3183 #, python-format msgid "The VM has no network interface %(mac)s" msgstr "虚拟机没有网络接口 %(mac)s" -#: vrtManager/instance.py:3204 +#: vrtManager/instance.py:3215 msgid "The VM has its own RNG device: change it in the XML editor" msgstr "虚拟机有自己的 RNG 设备:请在 XML 编辑器中修改" -#: vrtManager/instance.py:3231 +#: vrtManager/instance.py:3242 msgid "The VM has its own TPM: change it in the XML editor" msgstr "虚拟机有自己的 TPM:请在 XML 编辑器中修改" -#: vrtManager/instance.py:3250 +#: vrtManager/instance.py:3261 #, python-format msgid "Unknown crash action %(action)s" msgstr "未知的崩溃操作 %(action)s" -#: vrtManager/instance.py:3277 +#: vrtManager/instance.py:3288 #, python-format msgid "Network interface %(mac)s is not in the definition" msgstr "网络接口 %(mac)s 不在定义中" -#: vrtManager/instance.py:3368 +#: vrtManager/instance.py:3379 msgid "The guest agent did not answer in time; nothing was changed" msgstr "客户机代理未及时响应;未做任何更改" -#: vrtManager/instance.py:3371 +#: vrtManager/instance.py:3382 msgid "The VM runs Windows: its guest agent sets no root password or SSH key" msgstr "该虚拟机运行 Windows:其客户机代理不能设置 root 密码或 SSH 密钥" diff --git a/vmbackups/jobs.py b/vmbackups/jobs.py index 70d35acd..0737c65e 100644 --- a/vmbackups/jobs.py +++ b/vmbackups/jobs.py @@ -8,6 +8,8 @@ import time from uuid import UUID, uuid4 from django.core.exceptions import PermissionDenied +from django.db.models import Sum +from django.http import Http404 from django.urls import reverse from django.db import transaction from django.utils import timezone @@ -16,10 +18,11 @@ from django.utils.translation import gettext_noop as _ from lxml import etree from libvirt import VIR_DOMAIN_PAUSED, VIR_DOMAIN_RUNNING, VIR_DOMAIN_SHUTOFF, VIR_ERR_NO_DOMAIN, VIR_ERR_NO_STORAGE_VOL, libvirtError +from accounts.models import UserAttributes from appsettings.settings import app_settings from computes.models import Compute from instances.jobs import MOVED, PAUSED_FROZEN, THAW_FAILED, _instance, _log, _snapshot_free_space, record_vm, vm_claims -from instances.utils import get_random_mac_address +from instances.utils import QUOTA_UNVERIFIED, paths_used_on_other_computes, QUOTA_UNVERIFIED_TEXT, check_user_quota, get_random_mac_address, quota_message from instances.models import Instance from operations import claims from operations.jobs import Cancelled, Kind, Outcome, Plan, register, register_periodic @@ -47,6 +50,51 @@ def _superuser(user): raise PermissionDenied +def _may_use(user, instance=None, target=None): + """A superuser; or a VM owner with the backup permission, who may change + instance, on a target open to VM owners.""" + if user is None or not user.is_active: + raise PermissionDenied + if user.is_superuser: + return + if not user.has_perm("instances.backup_instances"): + raise PermissionDenied + if instance is not None: + from instances.views import get_instance + + if instance.is_template: # a template is cloned, not backed up by its owner + raise PermissionDenied + try: + get_instance(user, instance.pk, perm_type="change") + except Http404 as err: + raise PermissionDenied from err + if target is not None and not target.owners: + raise util.OperationError(_("Backup target %(target)s is not open to VM owners"), target=target.name) + + +def _backup_quota(user, needed): + """A VM owner's backups by hand (being made: their estimate) and needed + bytes more stay within their backup quota.""" + if user.is_superuser: + return + limit = UserAttributes.objects.get_or_create(user=user)[0].max_backup_size + if limit < 0: + return + used = (Backup.objects.filter(taken_by=user, policy__isnull=True, state__in=Backup.LIVING) + .aggregate(total=Sum("size"))["total"] or 0) + if used + needed > limit * 1024**3: + raise util.OperationError(_("The backup needs %(needed).1f GiB; %(used).1f GiB of your %(limit)d GiB backup " + "quota is used"), needed=needed / 1024**3, used=used / 1024**3, limit=limit) + + +def _vm_pool(instance): + """The storage pool of the VM's first disk: where its owner's restore as + a new VM goes.""" + proxy = _proxy(instance) + path = etree.fromstring(proxy._XMLDesc(PERSISTENT_XML)).xpath("string(devices/disk[@device='disk']/source/@file)") + return proxy.get_volume_by_path(path).storagePoolLookupByVolume().name() + + def _proxy(instance): c = instance.compute return wvmBackup(c.hostname, c.login, c.password, c.type, instance.name, uuid=instance.uuid) @@ -79,20 +127,27 @@ def _check_state(proxy, frozen): def _checked(op): """In the worker, before anything is made: the VM, its target pool (the one registered) and the space for its disks.""" - _superuser(op.user) instance = _instance(op.params["instance"]) + target = BackupTarget.objects.get(pk=op.params["target"]) + _may_use(op.user, instance, target) # again: rights may have changed since the job was queued if instance.compute_id != op.intent["compute"]: raise util.OperationError(_("The VM moved to another compute after the job was queued")) - target = BackupTarget.objects.get(pk=op.params["target"]) row = _target_row(target, instance.compute) proxy = _proxy(instance) pool = target_pool(proxy, row.pool, row.pool_uuid) plan = proxy.backup_plan() _check_state(proxy, op.params["frozen"]) check_target_space(pool, plan["disks"], **_free_space()) + # the target claim admits one backup at a time: this check counts every other one of the user's + _backup_quota(op.user, _estimate(plan)) return instance, target, row, proxy, pool, plan +def _estimate(plan): + """A backup's size before it is made: what its disks hold now.""" + return sum(d.get("allocation", 0) for d in plan["disks"]) + + def _free_space(): values = _snapshot_free_space() return {"free_percent": values.get("free_percent", 10), "free_min_gib": values.get("free_min_gib", 1)} @@ -245,17 +300,21 @@ class CreateBackup(Kind): "deadline": parse_datetime(raw["deadline"]).isoformat() if raw.get("deadline") else None} def plan(self, user, params): - _superuser(user) instance = _instance(params["instance"]) target = BackupTarget.objects.get(pk=params["target"]) + _may_use(user, instance, target) + if not user.is_superuser and (params["policy"] or params["deadline"]): + raise PermissionDenied # only a schedule asks for those _target_row(target, instance.compute) proxy = _proxy(instance) - proxy.backup_plan() + _backup_quota(user, _estimate(proxy.backup_plan())) _check_state(proxy, params["frozen"]) return Plan( claims={claims.compute_key(instance.compute_id): Claim.SHARED, claims.instance_key(instance.uuid): Claim.EXCLUSIVE, - claims.backup_target_key(target.pk): Claim.EXCLUSIVE}, + claims.backup_target_key(target.pk): Claim.EXCLUSIVE, + # a VM owner's backups one at a time: each run's quota check sees the others' rows + **({} if user.is_superuser else {f"backup_quota:{user.pk}": Claim.EXCLUSIVE})}, resource=claims.instance_key(instance.uuid), label=f"{instance.compute.name}/{instance.name}", intent={"compute": instance.compute_id, "uuid": instance.uuid, "backup": str(uuid4()), @@ -287,7 +346,8 @@ class CreateBackup(Kind): parent=parent.checkpoint if parent else None, backing=backing) Backup.objects.create(uuid=op.intent["backup"], target=target, instance=instance, vm_uuid=instance.uuid, vm_name=instance.name, compute_name=instance.compute.name, operation=op, policy=policy, - parent=parent, checkpoint=checkpoint) + parent=parent, checkpoint=checkpoint, taken_by=op.user, + size=_estimate(plan)) # until it is written: the quota counts it ctx.set_phase(_("Copying disks")) if live: return self._run_live(op, ctx, proxy, pool, status) @@ -545,9 +605,18 @@ class DeleteBackup(Kind): return {"backup": str(UUID(str(raw["backup"]))), "retention": int(raw["retention"]) if raw.get("retention") else None} + @staticmethod + def _may_delete(user, backup): + """A superuser; or a VM owner with the backup permission, a backup + they took by hand.""" + _may_use(user) + if not user.is_superuser and (backup.taken_by_id != user.pk or backup.policy_id is not None): + raise PermissionDenied + _may_use(user, target=backup.target) + def plan(self, user, params): - _superuser(user) backup = _backup(params) + self._may_delete(user, backup) if backup.state == Backup.CREATING: raise util.OperationError(_("This backup is being made; cancel its job to stop it")) if backup.depended_on(): @@ -561,8 +630,8 @@ class DeleteBackup(Kind): ) def run(self, op, ctx): - _superuser(op.user) backup = _backup(op.params) + self._may_delete(op.user, backup) if op.params.get("retention") and not _beyond_keep(backup, op.params["retention"]): raise util.OperationError(_("The backup is no longer beyond what its schedule keeps; it is kept")) if backup.depended_on(): # made since the deletion was queued: the target claim now holds it off @@ -583,6 +652,8 @@ class DeleteBackup(Kind): return {} def reconcile(self, op): + if not op.intent.get("deleting"): # stopped before it began: the rights it checks are not checked here + return Outcome(Operation.FAILED, error=say(_("The job stopped before the deletion began"))) backup = Backup.objects.select_related("target").filter(uuid=op.params["backup"]).first() if backup is None: return Outcome(Operation.SUCCEEDED) @@ -669,11 +740,40 @@ class RestoreBackup(Kind): "connect": str(raw.get("connect", "")).lower() in ("1", "true", "on"), "start": str(raw.get("start", "")).lower() in ("1", "true", "on")} + @staticmethod + def _owner_quota(user, params, backup): + """For a VM owner: the backup is of a VM they may change, restored on + its compute into its first disk's pool, within their quota. What the + new VM adds to the quota, None for a superuser.""" + _may_use(user, backup.instance, backup.target) + if user.is_superuser: + return None + if backup.instance is None: + raise PermissionDenied + if params["compute"] != backup.instance.compute_id or params["pool"] != _vm_pool(backup.instance): + raise PermissionDenied + compute = backup.instance.compute + conn = _connect(compute) + row = _target_row(backup.target, compute) + tree = etree.fromstring(get_file(conn, target_pool(conn, row.pool, row.pool_uuid), + backup.files.get(role=BackupFile.DOMAIN).volume)) + memory = int(tree.findtext("memory")) * {"KiB": 1, "MiB": 1024, "GiB": 1024**2}.get( + tree.find("memory").get("unit", "KiB"), 1) // 1024 + disk = sum(f.capacity >> 30 for f in backup.files.filter(role=BackupFile.DISK)) + quota = {"cpus": int(tree.findtext("vcpu")), "memory": memory, "disk": disk} + exceeded = check_user_quota(user, 1, quota["cpus"], quota["memory"], quota["disk"]) + if exceeded == QUOTA_UNVERIFIED: + raise util.OperationError(QUOTA_UNVERIFIED_TEXT) + if exceeded: + raise util.OperationError(_("%(quota)s: cannot restore %(name)s"), quota=quota_message(exceeded), + name=params["name"]) + return quota + def plan(self, user, params): - _superuser(user) backup = _backup(params) if backup.state != Backup.READY: raise util.OperationError(_("Only a ready backup is restored")) + quota = self._owner_quota(user, params, backup) compute = Compute.objects.get(pk=params["compute"]) _target_row(backup.target, compute) compute.refuse_new_vms() @@ -685,19 +785,25 @@ class RestoreBackup(Kind): keys[claims.volume_key(compute.pk, params["pool"], name)] = Claim.EXCLUSIVE keys[claims.backup_key(backup.uuid)] = Claim.SHARED keys[claims.backup_target_key(backup.target_id)] = Claim.EXCLUSIVE + if quota: # a VM owner's: no other increase of their quota is admitted until the VM is recorded + keys[claims.quota_key(user.pk)] = Claim.EXCLUSIVE return Plan( claims=keys, resource=claims.backup_key(backup.uuid), label=f"{compute.name}/{params['name']}", intent={"compute": compute.pk, "uuid": str(uuid4()), "name": params["name"], "from": backup.vm_name, - "volumes": volumes, "pool": params["pool"], + "volumes": volumes, "pool": params["pool"], **({"quota": quota} if quota else {}), "time": timezone.localtime(backup.created_at).strftime("%Y-%m-%d %H:%M")}, ) def run(self, op, ctx): - _superuser(op.user) p = op.params backup = _backup(p) + # the rights again; the quota was taken at admission: the job counts in it until its VM is recorded + _may_use(op.user, backup.instance if not op.user.is_superuser else None, backup.target) + if not op.user.is_superuser and (backup.instance is None or p["compute"] != backup.instance.compute_id + or p["pool"] != _vm_pool(backup.instance)): + raise PermissionDenied # the VM moved since the job was queued: the owner's restore follows it compute = Compute.objects.get(pk=p["compute"]) compute.refuse_new_vms() _check_name(p["name"]) @@ -812,7 +918,7 @@ class RestoreBackup(Kind): return _log(op, state, f"restored from the backup of {op.intent['from']} taken {op.intent['time']}") -def _over_plan(backup, proxy): +def _over_plan(backup, proxy, owner=False): """What a restore over the backup's VM makes: {"disks": {dev: [pool, volume name]}, "old": {dev: the disk's path now}, "nvram": the VM's NVRAM path or None, "tpm": bool}. @@ -829,6 +935,10 @@ def _over_plan(backup, proxy): if set(now) != set(files): raise util.OperationError(_("The VM's disks (%(now)s) are not the backup's (%(then)s); restore it as a new VM " "or one disk"), now=", ".join(sorted(now)), then=", ".join(sorted(files))) + for dev, f in files.items(): # a VM owner's disk quota counts the VM's disks as they are now + if owner and f.capacity > now[dev]["capacity"]: + raise util.OperationError(_("The backup's disk %(dev)s is larger than the VM's now; restore it as a new VM"), + dev=dev) if bool(plan["nvram"]) != (backup.manifest.get("nvram", "none") != "none"): raise util.OperationError(_("The VM's UEFI firmware changed since the backup; restore it as a new VM")) if plan["tpm"] != (backup.manifest.get("tpm", "none") != "none"): @@ -854,15 +964,16 @@ class RestoreOver(Kind): return {"backup": str(UUID(str(raw["backup"])))} def plan(self, user, params): - _superuser(user) backup = _backup(params) if backup.state != Backup.READY: raise util.OperationError(_("Only a ready backup is restored")) instance = backup.instance if instance is None: + _may_use(user) raise util.OperationError(_("The backup's VM is no longer in the panel; restore it as a new VM")) + _may_use(user, instance, backup.target) _target_row(backup.target, instance.compute) - over = _over_plan(backup, _proxy(instance)) + over = _over_plan(backup, _proxy(instance), owner=not user.is_superuser) keys = {claims.compute_key(instance.compute_id): Claim.SHARED, claims.instance_key(instance.uuid): Claim.EXCLUSIVE, claims.backup_key(backup.uuid): Claim.SHARED, claims.backup_target_key(backup.target_id): Claim.EXCLUSIVE} for pool, name in over["disks"].values(): # no other job makes a volume of these names meanwhile @@ -876,13 +987,13 @@ class RestoreOver(Kind): ) def run(self, op, ctx): - _superuser(op.user) backup = _backup(op.params) instance = _instance(backup.instance_id) + _may_use(op.user, instance, backup.target) if instance.compute_id != op.intent["compute"]: raise util.OperationError(MOVED) proxy = _proxy(instance) - if _over_plan(backup, proxy) != op.intent["over"]: + if _over_plan(backup, proxy, owner=not op.user.is_superuser) != op.intent["over"]: raise util.OperationError(_("The VM's disks changed after the job was queued")) row = _target_row(backup.target, instance.compute) tpool = target_pool(proxy, row.pool, row.pool_uuid) @@ -914,10 +1025,12 @@ class RestoreOver(Kind): ctx.record_intent(copied=[*op.intent.get("copied", []), dev], paths=paths, copying=None) # the VM may have been started or saved outside the panel meanwhile: then it keeps its disks - if _over_plan(backup, proxy) != op.intent["over"]: + if _over_plan(backup, proxy, owner=not op.user.is_superuser) != op.intent["over"]: raise util.OperationError(_("The VM changed while its backup was copied; it keeps its disks")) + # an owner cannot remove the old disks: they go once the VM no longer names them + remove = [] if op.user.is_superuser else list(op.intent["over"]["old"].values()) ctx.set_phase(_("Replacing the VM's disks")) - ctx.record_intent(switching=True, autostart=bool(proxy.instance.autostart())) + ctx.record_intent(switching=True, autostart=bool(proxy.instance.autostart()), remove=remove) return self._switch(op, backup, proxy, tpool) @staticmethod @@ -947,8 +1060,24 @@ class RestoreOver(Kind): proxy._defineXML(restore_over_definition(proxy._XMLDesc(PERSISTENT_XML), disks)) if op.intent["autostart"]: proxy.instance.setAutostart(1) + RestoreOver._remove_old(op, proxy, backup.instance) return {"open": reverse("instances:instance", args=[backup.instance_id])} + @staticmethod + def _remove_old(op, proxy, instance): + """The disks the VM ran from, after the switch, when its owner restored + it; one another domain uses, checked right before, is kept.""" + paths = op.intent.get("remove", []) + if not paths: + return + used = proxy.paths_used_by_other_domains(paths) | paths_used_on_other_computes(instance.compute, paths) + for path in (path for path in paths if path not in used): + try: + proxy.get_volume_by_path(path).delete(0) + except libvirtError as err: + if err.get_error_code() != VIR_ERR_NO_STORAGE_VOL: + raise + def progress(self, op): disks = Backup.objects.filter(uuid=op.params["backup"]).values_list("files__dev", "files__capacity", "files__role") copied = set(op.intent.get("copied", [])) @@ -969,6 +1098,7 @@ class RestoreOver(Kind): # defined: the switch is done; the VM may have run since, its NVRAM and TPM are not replaced again if op.intent["autostart"]: proxy.instance.setAutostart(1) + self._remove_old(op, proxy, instance) return Outcome(Operation.SUCCEEDED, result={"open": reverse("instances:instance", args=[instance.pk])}) if proxy.get_status() != VIR_DOMAIN_SHUTOFF or proxy.instance.hasManagedSaveImage(0): return Outcome(Operation.UNCERTAIN, error=say(_( diff --git a/vmbackups/migrations/0005_owners.py b/vmbackups/migrations/0005_owners.py new file mode 100644 index 00000000..033d2fcf --- /dev/null +++ b/vmbackups/migrations/0005_owners.py @@ -0,0 +1,26 @@ +# Generated by Django 5.2.18 on 2026-11-17 16:04 + +import django.db.models.deletion +from django.conf import settings +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('vmbackups', '0004_incremental'), + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ] + + operations = [ + migrations.AddField( + model_name='backup', + name='taken_by', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL), + ), + migrations.AddField( + model_name='backuptarget', + name='owners', + field=models.BooleanField(default=False), + ), + ] diff --git a/vmbackups/models.py b/vmbackups/models.py index ae8e9a66..f4c4befc 100644 --- a/vmbackups/models.py +++ b/vmbackups/models.py @@ -14,6 +14,7 @@ class BackupTarget(models.Model): name = models.CharField(max_length=64, unique=True) created_at = models.DateTimeField(auto_now_add=True) checked_at = models.DateTimeField(null=True) # its last target check that ended + owners = models.BooleanField(default=False) # VM owners with the backup permission may use it def __str__(self): return self.name @@ -87,6 +88,7 @@ class BackupRun(models.Model): class Backup(models.Model): CREATING, READY, FAILED, DELETING, MISSING = "creating", "ready", "failed", "deleting", "missing" STATES = [(CREATING, "creating"), (READY, "ready"), (FAILED, "failed"), (DELETING, "deleting"), (MISSING, "missing")] + LIVING = (CREATING, READY, MISSING, DELETING) # its files are or will be in the target OFFLINE, FROZEN, CRASH = "offline", "frozen", "crash" CONSISTENCIES = [(OFFLINE, "offline"), (FROZEN, "frozen"), (CRASH, "crash-consistent")] @@ -108,13 +110,15 @@ class Backup(models.Model): # an incremental backup's base; its disk files have the parent's as backing files parent = models.ForeignKey("self", on_delete=models.SET_NULL, null=True, related_name="children") checkpoint = models.CharField(max_length=64, blank=True) # the VM's checkpoint made with it + # whose job made it: a VM owner's own backups count in their backup quota + taken_by = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.SET_NULL, null=True, related_name="+") class Meta: ordering = ["-created_at"] def depended_on(self): """Whether a backup builds on this one: a failed one holds nothing.""" - return self.children.filter(state__in=(self.CREATING, self.READY, self.MISSING, self.DELETING)).exists() + return self.children.filter(state__in=self.LIVING).exists() @property def prefix(self): diff --git a/vmbackups/tests/test_delete.py b/vmbackups/tests/test_delete.py index 7da27c76..a21d41e0 100644 --- a/vmbackups/tests/test_delete.py +++ b/vmbackups/tests/test_delete.py @@ -80,6 +80,13 @@ class DeleteBackupTests(TransactionTestCase): self.assertEqual(DeleteBackup().reconcile(op).state, Operation.SUCCEEDED) self.assertFalse(Backup.objects.exists()) + def test_recovery_does_not_begin_a_deletion(self): + # the worker stopped before run: the rights it would check are not checked again by recovery + op = self.submit() + self.assertEqual(DeleteBackup().reconcile(op).state, Operation.FAILED) + self.assertTrue(Backup.objects.filter(pk=self.backup.pk).exists()) + self.assertEqual(self.removed, []) + def test_a_creating_backup_is_not_deleted(self): Backup.objects.filter(pk=self.backup.pk).update(state=Backup.CREATING) with self.assertRaisesMessage(OperationError, "being made"): diff --git a/vmbackups/tests/test_owners.py b/vmbackups/tests/test_owners.py new file mode 100644 index 00000000..818a6d9c --- /dev/null +++ b/vmbackups/tests/test_owners.py @@ -0,0 +1,294 @@ +"""VM owners with the backup permission: their VMs, targets open to owners, +their own backups, and the backup quota (layer 6).""" + +import hashlib +from types import SimpleNamespace +from unittest.mock import MagicMock, patch +from uuid import uuid4 + +from django.contrib.auth import get_user_model +from django.contrib.auth.models import Permission +from django.core.exceptions import PermissionDenied +from django.test import TransactionTestCase + +from accounts.models import UserAttributes, UserInstance +from appsettings.settings import get_settings +from computes.models import Compute +from instances.models import Instance +from operations import jobs +from operations.jobs import Context +from operations.models import Operation, acquire +from vmbackups.jobs import CreateBackup +from vmbackups.models import Backup, BackupFile, BackupTarget, BackupTargetPool +from vmbackups.tests.test_create import plan, proxy, target_pool +from vrtManager.util import OperationError + +GIB = 1024**3 +WORKER = "wvc-test:1:a" +DEFINITION = ( + "vm171717171-0000-4000-8000-000000000001" + "20971522" + "hvm/usr/libexec/qemu-kvm" + "" + "" +).encode() + + +class OwnerTests(TransactionTestCase): + def setUp(self): + get_settings() + self.owner = get_user_model().objects.create_user("bk_owner", password="pw") + self.owner.user_permissions.add(Permission.objects.get(codename="backup_instances")) + self.compute = Compute.objects.create(name="h1", hostname="192.0.2.71", login="u", password="p", type=1) + self.vm = Instance.objects.create(compute=self.compute, name="vm1", uuid="71717171-0000-4000-8000-000000000001") + UserInstance.objects.create(user=self.owner, instance=self.vm, is_change=True) + self.target = BackupTarget.objects.create(name="nfs1", owners=True) + BackupTargetPool.objects.create(target=self.target, compute=self.compute, pool="b1", pool_uuid="pool-uuid") + UserAttributes.objects.update_or_create(user=self.owner, defaults={"max_backup_size": 10}) + self.proxy = proxy() + self.proxy.backup_plan.return_value = plan() + self.proxy.backup_plan.return_value["disks"][0]["allocation"] = 4 * GIB + self.pool = target_pool() + for name, value in ( + ("vmbackups.jobs.wvmBackup", MagicMock(return_value=self.proxy)), + ("vmbackups.jobs.target_pool", MagicMock(return_value=self.pool)), + ("vmbackups.jobs.put_file", MagicMock(return_value="sha")), + ("vmbackups.jobs.remove_files", MagicMock()), + ): + patcher = patch(name, value) + patcher.start() + self.addCleanup(patcher.stop) + + def submit(self, kind, raw, user=None): + op = jobs.submit(kind, user or self.owner, raw, f"key-{uuid4().hex[:12]}") + acquire(WORKER, "wvc-test") + Operation.objects.filter(pk=op.pk).update(state=Operation.RUNNING, worker=WORKER) + op.refresh_from_db() + return op + + def back_up(self, **raw): + return self.submit("backup.create", {"instance": self.vm.pk, "target": self.target.pk, **raw}) + + def taken(self, size_gib, user=None, policy=None, state=Backup.READY): + return Backup.objects.create(target=self.target, instance=self.vm, vm_uuid=self.vm.uuid, vm_name="vm1", + compute_name="h1", state=state, size=size_gib * GIB, taken_by=user or self.owner, + policy=policy) + + # backing up + + def test_an_owner_backs_up_their_vm_and_the_backup_is_theirs(self): + op = self.back_up() + CreateBackup().run(op, Context(op, SimpleNamespace(identity=WORKER))) + backup = Backup.objects.get(uuid=op.intent["backup"]) + self.assertEqual((backup.state, backup.taken_by), (Backup.READY, self.owner)) + + def test_without_the_permission_or_change_rights_nothing_is_backed_up(self): + self.owner.user_permissions.clear() + with self.assertRaises(PermissionDenied): + self.back_up() + self.owner.user_permissions.add(Permission.objects.get(codename="backup_instances")) + UserInstance.objects.filter(user=self.owner).update(is_change=False) + self.owner = get_user_model().objects.get(pk=self.owner.pk) # a fresh permission cache + with self.assertRaises(PermissionDenied): + self.back_up() + + def test_a_target_not_open_to_owners_is_refused(self): + BackupTarget.objects.filter(pk=self.target.pk).update(owners=False) + with self.assertRaisesMessage(OperationError, "not open to VM owners"): + self.back_up() + + def test_an_owner_cannot_act_as_a_schedule(self): + with self.assertRaises(PermissionDenied): + self.back_up(policy=1) + + def test_rights_lost_after_the_job_was_queued_stop_it(self): + op = self.back_up() + BackupTarget.objects.filter(pk=self.target.pk).update(owners=False) + with self.assertRaisesMessage(OperationError, "not open to VM owners"): + CreateBackup().run(op, Context(op, SimpleNamespace(identity=WORKER))) + + def test_the_quota_counts_the_owners_own_backups(self): + self.taken(6) + self.taken(50, policy=None, user=get_user_model().objects.create_superuser("adm", "a@example.com", "pw")) + self.taken(50, state=Backup.FAILED) + op = self.back_up() # 6 + 4 of 10 GiB: the administrator's and the failed one do not count + CreateBackup().run(op, Context(op, SimpleNamespace(identity=WORKER))) + jobs.finish(op, jobs.Outcome(Operation.SUCCEEDED)) + with self.assertRaisesMessage(OperationError, "backup quota"): + self.back_up() # 6 + the new one's real size + 4 + UserAttributes.objects.filter(user=self.owner).update(max_backup_size=-1) + self.back_up() + + def test_a_backup_being_made_holds_its_estimate(self): + op = self.back_up() + # the run check: another backup of the owner was admitted and made its row meanwhile + self.taken(7, state=Backup.CREATING) + with self.assertRaisesMessage(OperationError, "backup quota"): + CreateBackup().run(op, Context(op, SimpleNamespace(identity=WORKER))) + + def test_an_owners_backups_run_one_at_a_time(self): + # different VMs, different targets: the run check reads the other's row only after it exists + op = self.back_up() + self.assertTrue(op.claims.filter(resource=f"backup_quota:{self.owner.pk}", mode="exclusive").exists()) + + def test_no_quota_means_none(self): + UserAttributes.objects.filter(user=self.owner).update(max_backup_size=0) + with self.assertRaisesMessage(OperationError, "backup quota"): + self.back_up() + + # deleting + + def test_an_owner_deletes_only_their_own_backups_by_hand(self): + mine, schedules, others = self.taken(1), self.taken(1), self.taken(1, user=get_user_model().objects.create_user("x")) + from vmbackups.models import BackupPolicy + import datetime + + policy = BackupPolicy.objects.create(name="n", target=self.target, time=datetime.time(2), keep=2) + Backup.objects.filter(pk=schedules.pk).update(policy=policy) + self.submit("backup.delete", {"backup": str(mine.uuid)}) + for backup in (schedules, others): + with self.assertRaises(PermissionDenied): + self.submit("backup.delete", {"backup": str(backup.uuid)}) + + # restoring + + def ready_backup(self): + backup = self.taken(1, user=get_user_model().objects.create_superuser("adm2", "b@example.com", "pw")) + BackupFile.objects.create(backup=backup, role=BackupFile.DISK, dev="vda", volume=f"{backup.prefix}-vda.qcow2", + format="qcow2", capacity=8 * GIB) + BackupFile.objects.create(backup=backup, role=BackupFile.DOMAIN, volume=f"{backup.prefix}-domain.xml", + size=len(DEFINITION), sha256=hashlib.sha256(DEFINITION).hexdigest()) + return backup + + def restore(self, backup, **raw): + return self.submit("backup.restore", {"backup": str(backup.uuid), "compute": self.compute.pk, "pool": "default", + "name": "vm1-restored", **raw}) + + def test_an_owner_restores_as_a_new_vm_on_the_vms_host_and_pool_within_the_quota(self): + backup = self.ready_backup() + conn = MagicMock() + with (patch("vmbackups.jobs.wvmConnect", return_value=conn), + patch("vmbackups.jobs.get_file", return_value=DEFINITION), + patch("vmbackups.jobs._vm_pool", return_value="default")): + UserAttributes.objects.filter(user=self.owner).update(max_instances=-1, max_cpus=-1, max_memory=-1, + max_disk_size=-1) + op = self.restore(backup) + self.assertEqual(op.intent["quota"], {"cpus": 2, "memory": 2048, "disk": 8}) + Operation.objects.all().delete() + from operations.models import Claim + + Claim.objects.all().delete() + for raw in ({"compute": Compute.objects.create(name="h2", hostname="192.0.2.72", login="u", password="p", + type=1).pk}, {"pool": "fast"}): + with self.assertRaises(PermissionDenied): + self.restore(backup, **raw) + from instances.utils import QuotaExceeded + + # the owner's VMs are read from their hosts: here the quota check answers + with (patch("vmbackups.jobs.check_user_quota", return_value=QuotaExceeded("cpu", 3, 1)) as check, + self.assertRaisesMessage(OperationError, "vCPU quota")): + self.restore(backup) + check.assert_called_once_with(self.owner, 1, 2, 2048, 8) + + def test_a_restore_counts_in_the_quota_until_its_vm_is_recorded(self): + from instances.utils import check_user_quota + + backup = self.ready_backup() + UserAttributes.objects.filter(user=self.owner).update(max_instances=2, max_cpus=-1, max_memory=-1, max_disk_size=-1) + with (patch("vmbackups.jobs.wvmConnect", return_value=MagicMock()), + patch("vmbackups.jobs.get_file", return_value=DEFINITION), + patch("vmbackups.jobs._vm_pool", return_value="default")): + self.restore(backup) + # the owner's VM and the restore make two: one more is over + self.assertTrue(check_user_quota(self.owner, 1, 0, 0, 0)) + + def test_an_owners_restore_over_removes_the_old_disks_not_used_elsewhere(self): + from vmbackups.jobs import RestoreOver + + backup = self.ready_backup() + over = {"disks": {"vda": ["default", "vm1-vda-x.qcow2"]}, "old": {"vda": "/pool/a.qcow2"}, "nvram": None, "tpm": False} + old_vol = MagicMock() + self.proxy.get_volume_by_path.return_value = old_vol + self.proxy.paths_used_by_other_domains.return_value = set() + self.proxy._XMLDesc.return_value = DEFINITION.decode() + self.proxy.get_status.return_value = 5 + self.proxy.instance.autostart.return_value = 0 + with (patch("vmbackups.jobs._over_plan", return_value=over), + patch("vmbackups.jobs._check_files"), + patch("vmbackups.jobs.paths_used_on_other_computes", return_value=set()), + patch("vmbackups.jobs.wvmStorage") as storage, + patch("vmbackups.jobs.wvmInstance._refuse_taken"), + patch("vmbackups.jobs.check_target_space")): + storage.return_value.clone_volume.return_value = "/pool/vm1-vda-x.qcow2" + self.proxy.file_pools.return_value = {"default": (MagicMock(), "/pool")} + op = self.submit("backup.restore_over", {"backup": str(backup.uuid)}) + RestoreOver().run(op, Context(op, SimpleNamespace(identity=WORKER))) + op.refresh_from_db() + self.assertEqual(op.intent["remove"], ["/pool/a.qcow2"]) + old_vol.delete.assert_called_once_with(0) + + def test_an_old_disk_used_meanwhile_by_another_vm_is_kept(self): + from vmbackups.jobs import RestoreOver + + op = SimpleNamespace(intent={"remove": ["/pool/a.qcow2", "/pool/b.qcow2"]}, user=self.owner, + params={"backup": ""}) + self.proxy.paths_used_by_other_domains.return_value = {"/pool/a.qcow2"} # attached since the switch began + volumes = {} + self.proxy.get_volume_by_path.side_effect = lambda path: volumes.setdefault(path, MagicMock()) + with patch("vmbackups.jobs.paths_used_on_other_computes", return_value=set()): + RestoreOver._remove_old(op, self.proxy, self.vm) + self.assertEqual([p for p, v in volumes.items() if v.delete.called], ["/pool/b.qcow2"]) + + def test_an_owner_restores_over_only_disks_no_larger_than_the_vms(self): + from vmbackups.jobs import _over_plan + + backup = self.ready_backup() # its vda is 8 GiB; the VM's now 1 GiB + self.proxy.get_status.return_value = 5 + self.proxy.instance.snapshotNum.return_value = 0 + self.proxy.instance.name.return_value = "vm1" + self.proxy.backup_plan.return_value = {"disks": [{"dev": "vda", "path": "/pool/a.qcow2", "pool": "default", + "format": "qcow2", "capacity": GIB}], "nvram": None, "tpm": False} + with self.assertRaisesMessage(OperationError, "larger"): + _over_plan(backup, self.proxy, owner=True) + self.assertTrue(_over_plan(backup, self.proxy, owner=False)) + + def test_an_owners_restore_holds_their_quota(self): + backup = self.ready_backup() + with (patch("vmbackups.jobs.wvmConnect", return_value=MagicMock()), + patch("vmbackups.jobs.get_file", return_value=DEFINITION), + patch("vmbackups.jobs._vm_pool", return_value="default"), + patch("vmbackups.jobs.check_user_quota", return_value="")): + op = self.restore(backup) + self.assertTrue(op.claims.filter(resource=f"quota:user:{self.owner.pk}", mode="exclusive").exists()) + + def test_a_template_is_not_backed_up_by_an_owner(self): + self.owner.is_staff = True # a staff owner may change a template + self.owner.save() + Instance.objects.filter(pk=self.vm.pk).update(is_template=True) + with self.assertRaises(PermissionDenied): + self.back_up() + + def test_a_closed_target_stops_an_owners_deletion(self): + mine = self.taken(1) + BackupTarget.objects.filter(pk=self.target.pk).update(owners=False) + with self.assertRaisesMessage(OperationError, "not open to VM owners"): + self.submit("backup.delete", {"backup": str(mine.uuid)}) + + def test_another_owners_vm_is_not_restored_over(self): + backup = self.ready_backup() + UserInstance.objects.filter(user=self.owner).delete() + with self.assertRaises((PermissionDenied, Exception)): + self.submit("backup.restore_over", {"backup": str(backup.uuid)}) + + def test_a_restore_of_another_vms_backup_is_refused(self): + backup = self.ready_backup() + other = Instance.objects.create(compute=self.compute, name="vm2", uuid="71717171-0000-4000-8000-000000000002") + Backup.objects.filter(pk=backup.pk).update(instance=other) + with self.assertRaises(PermissionDenied): + self.restore(backup) + + def test_superusers_keep_restore_one_disk(self): + backup = self.ready_backup() + with self.assertRaises(PermissionDenied): + self.submit("backup.restore_disk", {"backup": str(backup.uuid), "dev": "vda", "compute": self.compute.pk, + "pool": "default", "name": "x.qcow2"}) diff --git a/vrtManager/backup.py b/vrtManager/backup.py index c9a4192a..a7343f77 100644 --- a/vrtManager/backup.py +++ b/vrtManager/backup.py @@ -53,7 +53,7 @@ class wvmBackup(wvmInstance): def backup_plan(self): """What a backup of the VM copies, from its persistent definition: - {"definition", "disks": [{dev, path, pool, format, capacity}], + {"definition", "disks": [{dev, path, pool, format, capacity, allocation}], "nvram": path or None, "tpm": whether it has a TPM (shut off: its state is read by the job), "left_out": [{dev, why}]}. Refuses, naming why, a VM whose backup could not be restored as it is.""" @@ -99,8 +99,10 @@ class wvmBackup(wvmInstance): raise raise OperationError(gettext_noop("Disk %(dev)s (%(path)s) is in no storage pool of the host; it cannot be backed up"), dev=dev, path=path) from err + info = vol.info() disks.append({"dev": dev, "path": path, "pool": vol.storagePoolLookupByVolume().name(), - "format": disk_format, "capacity": vol.info()[1]}) + "format": disk_format, "capacity": info[1], + "allocation": min(info[1], self._chain_allocation(vol))}) if self.instance.state()[0] != libvirt.VIR_DOMAIN_SHUTOFF: # a running VM's disks are copied: the definition kept must name the same ones @@ -147,6 +149,20 @@ class wvmBackup(wvmInstance): vol = self._find_volume(pool, os.path.basename(path)) return None if vol is None else self.download_volume(vol) + def _chain_allocation(self, vol): + """The bytes a disk's volume and the files below it hold: its backup + copies them flat.""" + total, seen = 0, set() + while vol is not None and vol.path() not in seen: + seen.add(vol.path()) + total += vol.info()[2] + below = etree.fromstring(vol.XMLDesc(0)).findtext("backingStore/path") + try: + vol = self.get_volume_by_path(below) if below else None + except libvirt.libvirtError: + vol = None # in no pool: counted by its own size only + return total + def checkpoint_usable(self, name, devs): """Whether the checkpoint name can be an incremental backup's base: on this host, with a bitmap of known size for each disk of devs diff --git a/vrtManager/tests/test_backup.py b/vrtManager/tests/test_backup.py index 8a48a8b6..dfde944c 100644 --- a/vrtManager/tests/test_backup.py +++ b/vrtManager/tests/test_backup.py @@ -48,6 +48,8 @@ def proxy(xml=None, live=None, state=libvirt.VIR_DOMAIN_SHUTOFF, managed_save=Fa def volume(path): vol = MagicMock() vol.info.return_value = [0, (10 if path.endswith("qcow2") else 20) * GIB, GIB] + vol.path.return_value = path + vol.XMLDesc.return_value = "" vol.storagePoolLookupByVolume.return_value = pool return vol @@ -67,14 +69,32 @@ class BackupPlanTestCase(unittest.TestCase): self.assertEqual( plan["disks"], [ - {"dev": "vda", "path": "/pool/a.qcow2", "pool": "default", "format": "qcow2", "capacity": 10 * GIB}, - {"dev": "vdb", "path": "/pool/b.img", "pool": "default", "format": "raw", "capacity": 20 * GIB}, + {"dev": "vda", "path": "/pool/a.qcow2", "pool": "default", "format": "qcow2", "capacity": 10 * GIB, + "allocation": GIB}, + {"dev": "vdb", "path": "/pool/b.img", "pool": "default", "format": "raw", "capacity": 20 * GIB, + "allocation": GIB}, ], ) self.assertEqual(plan["left_out"], [{"dev": "sda", "why": "CD-ROM: not copied"}]) self.assertIsNone(plan["nvram"]) self.assertIn("vm1", plan["definition"]) + def test_a_disks_allocation_counts_its_backing_files(self): + # an overlay holds what changed since its snapshot: the backup copies the chain flat + p = proxy() + def volume(path): + vol = MagicMock() + vol.info.return_value = [0, 10 * GIB, GIB] + vol.path.return_value = path + backing = {"/pool/a.qcow2": "/pool/a.base"}.get(path) + vol.XMLDesc.return_value = (f"{backing}" + if backing else "") + vol.storagePoolLookupByVolume.return_value.name.return_value = "default" + return vol + p.get_volume_by_path = MagicMock(side_effect=volume) + disks = {d["dev"]: d for d in p.backup_plan()["disks"]} + self.assertEqual((disks["vda"]["allocation"], disks["vdb"]["allocation"]), (2 * GIB, GIB)) + def test_the_nvram_is_named(self): xml = domain(os_extra="/var/lib/libvirt/qemu/nvram/vm1_VARS.fd") self.assertEqual(proxy(xml).backup_plan()["nvram"], "/var/lib/libvirt/qemu/nvram/vm1_VARS.fd")