diff --git a/instances/templates/instance.html b/instances/templates/instance.html index 24b817f6..67734a52 100644 --- a/instances/templates/instance.html +++ b/instances/templates/instance.html @@ -107,6 +107,11 @@ {% endif %} + {% if backups %} + + {% endif %} @@ -126,6 +131,7 @@ {% if can_snapshot and not instance.is_template %}{% include 'instances/snapshots_tab.html' %}{% endif %} {% if show_settings %}{% include 'instances/settings_tab.html' %}{% endif %} {% if not instance.is_template %}{% include 'instances/stats_tab.html' %}{% endif %} + {% if backups %}{% include 'vmbackups/vm_tab.html' %}{% endif %} {% include 'instances/destroy_tab.html' %} diff --git a/instances/views.py b/instances/views.py index f4e8b8ad..45d347c6 100755 --- a/instances/views.py +++ b/instances/views.py @@ -67,6 +67,7 @@ from vrtManager.util import randomPasswd from instances.models import Instance from instances.templatetags.vm_states import disk_seen +from vmbackups.utils import vm_tab from . import addresses, report, utils from .api.serializers import DestroyOptionsSerializer, PowerOnSerializer @@ -386,8 +387,12 @@ def _instance_page(request, pk, instance, compute): else: migrate_refusal = None + # superusers back VMs up; not a template, which is cloned + backups = vm_tab(instance) if request.user.is_superuser and not instance.is_template else None + return render(request, "instance.html", { "instance": instance, + "backups": backups, "compute": compute, "computes": computes, "users": users, diff --git a/locale/tr/LC_MESSAGES/django.mo b/locale/tr/LC_MESSAGES/django.mo index f64a49b1..5c43c6ca 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 b7729738..7af75afc 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 05:39+0000\n" +"POT-Creation-Date: 2026-11-17 06:13+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" @@ -220,7 +220,7 @@ 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 #: computes/templates/computes/list.html:60 computes/templates/overview.html:90 -#: instances/views.py:262 +#: instances/views.py:263 msgid "VMs" msgstr "Sanal makineler" @@ -244,7 +244,7 @@ msgstr "Sanal makine ekle" #: instances/templates/allinstances.html:108 #: instances/templates/allinstances_index_nongrouped.html:8 #: instances/templates/create_steps.html:6 -#: instances/templates/create_steps.html:8 instances/views.py:239 +#: instances/templates/create_steps.html:8 instances/views.py:240 #: operations/templates/operations/jobs.html:24 msgid "Host" msgstr "Sunucu" @@ -770,7 +770,7 @@ msgstr "" #: instances/templates/allinstances_index_nongrouped.html:14 #: instances/templates/create_instance_w2.html:63 #: instances/templates/instances/resize_tab.html:30 -#: instances/templates/instances/settings_tab.html:854 instances/views.py:239 +#: instances/templates/instances/settings_tab.html:854 instances/views.py:240 msgid "vCPUs" msgstr "vCPU" @@ -972,7 +972,7 @@ msgid "IP" msgstr "IP" #: admin/templates/admin/logs.html:56 admin/views.py:395 instances/states.py:19 -#: instances/views.py:479 logs/views.py:18 +#: instances/views.py:484 logs/views.py:18 msgid "Unknown" msgstr "Bilinmeyen" @@ -982,6 +982,7 @@ msgstr "Tamamlandı" #: admin/templates/admin/logs.html:56 admin/views.py:395 logs/views.py:18 #: operations/templates/operations/job.html:107 +#: vmbackups/templates/vmbackups/vm_tab.html:49 msgid "Failed" msgstr "Başarısız" @@ -1016,7 +1017,7 @@ msgstr "Şablon" msgid "Left" msgstr "Ayrıldığı sunucu" -#: admin/templates/admin/tombstone_list.html:34 instances/views.py:240 +#: admin/templates/admin/tombstone_list.html:34 instances/views.py:241 msgid "Owners" msgstr "Sahipler" @@ -2249,7 +2250,7 @@ msgstr "Sunucu, sanal makineleri taşınmadan bakıma alınsın mı?" msgid "Put in maintenance without migrating" msgstr "Taşımadan bakıma al" -#: computes/templates/computes/bulk_migrate.html:26 instances/views.py:379 +#: computes/templates/computes/bulk_migrate.html:26 instances/views.py:380 msgid "There is no other host to migrate to." msgstr "Taşınacak başka bir sunucu yok." @@ -3171,12 +3172,12 @@ msgstr "" "VNC olarak değiştirin." #: instances/api/viewsets.py:157 instances/api/viewsets.py:175 -#: instances/views.py:853 instances/views.py:875 instances/views.py:1860 +#: instances/views.py:858 instances/views.py:880 instances/views.py:1865 msgid "Templates cannot be started." msgstr "Şablon makineler başlatılamaz." #: instances/forms.py:14 instances/templates/create_instance_w2.html:69 -#: instances/templates/instances/settings_tab.html:858 instances/views.py:239 +#: instances/templates/instances/settings_tab.html:858 instances/views.py:240 msgid "Memory (MiB)" msgstr "Bellek (MiB)" @@ -3263,7 +3264,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 +#: instances/jobs.py:73 vmbackups/jobs.py:73 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ı" @@ -3451,10 +3452,11 @@ msgid "Clone VM" msgstr "Sanal makineyi klonla" #: instances/jobs.py:656 instances/jobs.py:663 instances/jobs.py:1005 +#: vmbackups/jobs.py:210 msgid "Copying disks" msgstr "Diskler kopyalanıyor" -#: instances/jobs.py:715 +#: instances/jobs.py:715 vmbackups/jobs.py:286 msgid "libvirt has no result of the copy" msgstr "libvirt'te kopyanın sonucu yok" @@ -3467,7 +3469,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 +#: instances/jobs.py:729 instances/jobs.py:821 vmbackups/jobs.py:292 msgid "The copy failed" msgstr "Kopyalama başarısız oldu" @@ -3489,11 +3491,11 @@ msgstr "" "Klonun bir birimi oluşturuluyordu; şu birimleri kontrol edin, sonra bu işi " "çözün: %(volumes)s" -#: instances/jobs.py:801 +#: instances/jobs.py:801 vmbackups/jobs.py:329 msgid "The job stopped before the copy started" msgstr "İş, kopyalama başlamadan durdu" -#: instances/jobs.py:808 +#: instances/jobs.py:808 vmbackups/jobs.py:377 msgid "libvirt is still copying the disks" msgstr "libvirt diskleri hâlâ kopyalıyor" @@ -3534,12 +3536,12 @@ msgstr "" msgid "Each network card needs a network" msgstr "Her ağ kartının bir ağı olmalı" -#: instances/jobs.py:868 vrtManager/instance.py:2849 +#: instances/jobs.py:868 vrtManager/instance.py:2860 #, python-format msgid "This host has no network %(name)s" msgstr "Bu sunucuda %(name)s ağı yok" -#: instances/jobs.py:870 vrtManager/instance.py:2851 +#: instances/jobs.py:870 vrtManager/instance.py:2862 #, python-format msgid "This host has no network filter %(name)s" msgstr "Bu sunucuda %(name)s ağ filtresi yok" @@ -3564,7 +3566,7 @@ msgstr "" msgid "Create VM" msgstr "Sanal makine oluştur" -#: instances/jobs.py:928 instances/jobs.py:975 instances/views.py:2597 +#: instances/jobs.py:928 instances/jobs.py:975 instances/views.py:2602 msgid "A virtual machine with this name already exists" msgstr "Bu isimde bir sanal makine mevcut" @@ -3613,7 +3615,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:3198 +#: instances/jobs.py:957 vrtManager/instance.py:3209 msgid "This host offers no TPM 2.0: install swtpm on it" msgstr "Bu sunucu TPM 2.0 sunmuyor: üzerine swtpm kurun" @@ -3924,7 +3926,7 @@ msgid "Disk source" msgstr "Disk kaynağı" #: instances/templates/add_instance_volume.html:21 -#: instances/templates/create_instance_w2.html:134 instances/views.py:2627 +#: instances/templates/create_instance_w2.html:134 instances/views.py:2632 msgid "New disk" msgstr "Yeni disk" @@ -3957,6 +3959,7 @@ msgstr "Harf, rakam, nokta, tire ve alt çizgi." #: instances/templates/add_instance_volume.html:44 #: instances/templates/instances/settings_tab.html:851 +#: vmbackups/templates/vmbackups/vm_tab.html:36 msgid "Size" msgstr "Boyut" @@ -4113,7 +4116,7 @@ msgstr "Bul" msgid "Address" msgstr "Adres" -#: instances/templates/allinstances.html:105 instances/views.py:239 +#: instances/templates/allinstances.html:105 instances/views.py:240 #: interfaces/templates/interface.html:153 networks/templates/network.html:202 msgid "VM" msgstr "VM" @@ -4318,7 +4321,7 @@ msgstr "Özel CPU modelleri" msgid "Size (GiB)" msgstr "Boyut (GiB)" -#: instances/templates/create_instance_w2.html:161 instances/views.py:2628 +#: instances/templates/create_instance_w2.html:161 instances/views.py:2633 msgid "Existing volumes" msgstr "Mevcut birimler" @@ -4355,7 +4358,7 @@ msgstr "Aygıt" msgid "Remove" msgstr "Kaldır" -#: instances/templates/create_instance_w2.html:194 instances/views.py:2629 +#: instances/templates/create_instance_w2.html:194 instances/views.py:2634 msgid "Clone from template" msgstr "Şablondan klonla" @@ -4545,7 +4548,12 @@ msgstr "Ayarlar" msgid "Stats" msgstr "İstatistikler" -#: instances/templates/instance.html:111 +#: instances/templates/instance.html:112 templates/navbar.html:21 +#: vmbackups/templates/vmbackups/targets.html:17 +msgid "Backups" +msgstr "Yedekler" + +#: instances/templates/instance.html:116 #: instances/templates/instances/destroy_tab.html:7 msgid "Destroy" msgstr "Sil" @@ -4911,7 +4919,7 @@ msgid "Add USB device" msgstr "USB aygıtı ekle" #: instances/templates/instances/host_devices_form.html:18 -#: vrtManager/instance.py:3102 +#: vrtManager/instance.py:3113 msgid "" "A VM with a saved state does not change its USB devices: start it, or start " "it without its saved state" @@ -6591,70 +6599,71 @@ msgstr "Geçersiz MAC adresi" msgid "More MAC addresses than networks" msgstr "Ağlardan daha fazla MAC adresi" -#: instances/views.py:191 +#: instances/views.py:192 msgid "Enter an IP address, a network such as 192.0.2.0/24, or a MAC address." msgstr "Bir IP adresi, 192.0.2.0/24 gibi bir ağ ya da bir MAC adresi girin." -#: instances/views.py:197 instances/views.py:231 +#: instances/views.py:198 instances/views.py:232 msgid "Too many searches are still running; try again shortly." msgstr "Çok fazla arama hâlâ çalışıyor; birazdan yeniden deneyin." -#: instances/views.py:239 interfaces/templates/interface.html:46 +#: instances/views.py:240 interfaces/templates/interface.html:46 #: networks/templates/network.html:51 #: operations/templates/operations/jobs.html:38 #: operations/templates/operations/jobs.html:62 #: storages/templates/storage.html:91 +#: vmbackups/templates/vmbackups/vm_tab.html:36 msgid "State" msgstr "Durum" -#: instances/views.py:239 +#: instances/views.py:240 msgid "OS" msgstr "İşletim sistemi" -#: instances/views.py:239 +#: instances/views.py:240 msgid "OS family" msgstr "İşletim sistemi ailesi" -#: instances/views.py:239 +#: instances/views.py:240 msgid "IP addresses" msgstr "IP adresleri" -#: instances/views.py:240 +#: instances/views.py:241 msgid "Address sources" msgstr "Adres kaynakları" -#: instances/views.py:240 +#: instances/views.py:241 msgid "MAC addresses" msgstr "MAC adresleri" -#: instances/views.py:240 +#: instances/views.py:241 msgid "In the panel" msgstr "Panelde" -#: instances/views.py:251 +#: instances/views.py:252 msgid "yes" msgstr "evet" -#: instances/views.py:251 +#: instances/views.py:252 msgid "no" msgstr "hayır" -#: instances/views.py:253 +#: instances/views.py:254 #, python-format msgid "Created: %(time)s" msgstr "Oluşturulma: %(time)s" -#: instances/views.py:254 +#: instances/views.py:255 #, python-format msgid "VMs listed: %(n)s" msgstr "Listelenen sanal makineler: %(n)s" -#: instances/views.py:255 +#: instances/views.py:256 #, python-format msgid "Running VMs read: %(n)s" msgstr "Okunan çalışan sanal makineler: %(n)s" -#: instances/views.py:256 +#: instances/views.py:257 #, python-format msgid "" "Without a connected guest agent (a static address on them cannot be seen): " @@ -6662,7 +6671,7 @@ msgid "" msgstr "" "Bağlı konuk ajanı olmayanlar (üzerlerindeki statik adres görülemez): %(n)s" -#: instances/views.py:257 +#: instances/views.py:258 #, python-format msgid "" "Guest agents not read (a paused VM, no answer in time, or an error): %(n)s" @@ -6670,45 +6679,45 @@ msgstr "" "Okunamayan konuk ajanları (duraklatılmış VM, zamanında yanıt yok ya da hata):" " %(n)s" -#: instances/views.py:259 +#: instances/views.py:260 #, python-format msgid "Hosts not reached: %(hosts)s" msgstr "Ulaşılamayan sunucular: %(hosts)s" -#: instances/views.py:261 +#: instances/views.py:262 #, python-format msgid "Hosts not finished in time: %(hosts)s" msgstr "Zamanında bitmeyen sunucular: %(hosts)s" -#: instances/views.py:262 +#: instances/views.py:263 msgid "Coverage" msgstr "Kapsam" -#: instances/views.py:277 +#: instances/views.py:278 #, python-format msgid "The host %(host)s of '%(name)s' cannot be reached: %(error)s" msgstr "'%(name)s' sanal makinesinin sunucusu %(host)s erişilemiyor: %(error)s" -#: instances/views.py:283 +#: instances/views.py:284 #, python-format msgid "The host of '%(name)s' cannot be reached right now." msgstr "'%(name)s' sanal makinesinin sunucusuna şu anda erişilemiyor." -#: instances/views.py:284 +#: instances/views.py:285 msgid " Jobs on it can be followed under Jobs in the menu." msgstr " Üzerindeki işler menüdeki İşler bölümünden izlenebilir." -#: instances/views.py:292 +#: instances/views.py:293 #, python-format msgid "'%(name)s' is no longer on its host." msgstr "'%(name)s' artık sunucusunda yok." -#: instances/views.py:381 +#: instances/views.py:382 msgid "A VM migrates when it is running, paused or shut off." msgstr "" "Sanal makine çalışırken, duraklatılmışken ya da kapalıyken taşınabilir." -#: instances/views.py:383 +#: instances/views.py:384 msgid "" "A VM with snapshots cannot be migrated: its snapshots stay on this host. " "Delete them first." @@ -6716,7 +6725,7 @@ msgstr "" "Anlık görüntüsü olan bir sanal makine taşınamaz: anlık görüntüleri bu " "sunucuda kalır. Önce onları silin." -#: instances/views.py:385 +#: instances/views.py:386 msgid "" "A VM with host devices cannot be migrated: the destination may not have them." " Remove them first." @@ -6724,16 +6733,16 @@ msgstr "" "Sunucu aygıtları olan bir sanal makine taşınamaz: hedefte bu aygıtlar " "olmayabilir. Önce onları kaldırın." -#: instances/views.py:624 +#: instances/views.py:629 #, python-format msgid "Disk %(dev)s has changed since the page was loaded; reload the page" msgstr "%(dev)s diski sayfa yüklendikten sonra değişti; sayfayı yenileyin" -#: instances/views.py:699 instances/views.py:700 +#: instances/views.py:704 instances/views.py:705 msgid "The VM was moved meanwhile; try again." msgstr "Sanal makine bu arada taşındı; yeniden deneyin." -#: instances/views.py:816 +#: instances/views.py:821 msgid "" "The running VM has no free PCI slot for another disk on this bus: choose the " "scsi bus if the VM has a SCSI controller, or shut the VM down and add the " @@ -6746,7 +6755,7 @@ msgstr "" "yuvaları ekle, sonraki başlatmadan itibaren ona boş yuvalar verir. Yeni bir " "birim havuzunda kalır, mevcut birim olarak eklenebilir." -#: instances/views.py:820 +#: instances/views.py:825 msgid "" "The running VM has no free PCI slot for the SCSI controller the disk needs: " "shut the VM down and add the disk then; Add PCIe slots on the Disks tab gives" @@ -6758,195 +6767,195 @@ msgstr "" "PCIe yuvaları ekle, sonraki başlatmadan itibaren ona boş yuvalar verir. Yeni " "bir birim havuzunda kalır, mevcut birim olarak eklenebilir." -#: instances/views.py:838 +#: instances/views.py:843 #, python-format msgid "Invalid disk options: %(options)s" msgstr "Geçersiz disk seçenekleri: %(options)s" -#: instances/views.py:850 instances/views.py:945 +#: instances/views.py:855 instances/views.py:950 #, python-format msgid "Invalid options: %(options)s" msgstr "Geçersiz seçenekler: %(options)s" -#: instances/views.py:885 +#: instances/views.py:890 msgid "The VM was forced off but did not start again: it stays off." msgstr "Sanal makine zorla kapatıldı ancak yeniden başlamadı: kapalı kalıyor." -#: instances/views.py:1073 +#: instances/views.py:1078 #, python-format msgid "Set the gstfsd key of %(compute)s first (Computes, edit the host)" msgstr "" "Önce %(compute)s sunucusunun gstfsd anahtarını ayarlayın (Sunucular, sunucuyu" " düzenle)" -#: instances/views.py:1080 instances/views.py:1098 instances/views.py:1107 +#: instances/views.py:1085 instances/views.py:1103 instances/views.py:1112 #, python-format msgid "gstfsd error: %(err)s" msgstr "gstfsd hatası: %(err)s" -#: instances/views.py:1108 +#: instances/views.py:1113 msgid "the reply is not signed with the key" msgstr "yanıt anahtarla imzalanmamış" -#: instances/views.py:1116 +#: instances/views.py:1121 msgid "Shut the VM down, or start its QEMU guest agent, and try again" msgstr "" "Sanal makineyi kapatın ya da QEMU konuk ajanını başlatın ve yeniden deneyin" -#: instances/views.py:1124 +#: instances/views.py:1129 msgid "The change may still be made when the agent answers again." msgstr "Ajan yeniden yanıt verdiğinde değişiklik yine de yapılabilir." -#: instances/views.py:1139 +#: instances/views.py:1144 msgid "Enter a password" msgstr "Bir parola girin" -#: instances/views.py:1144 +#: instances/views.py:1149 msgid "Enter a password of at most 4096 characters, without NUL characters" msgstr "En fazla 4096 karakterlik, NUL karakteri içermeyen bir parola girin" -#: instances/views.py:1160 +#: instances/views.py:1165 msgid "Reset root password" msgstr "Root parolasını sıfırla" -#: instances/views.py:1176 +#: instances/views.py:1181 msgid "Select an SSH public key" msgstr "Bir SSH açık anahtarı seçin" -#: instances/views.py:1198 +#: instances/views.py:1203 #, python-format msgid "Installed new SSH public key %(keyname)s" msgstr "Yeni %(keyname)s SSH açık anahtarı yüklendi" -#: instances/views.py:1218 +#: instances/views.py:1223 msgid "Enter a whole number of vCPUs" msgstr "vCPU sayısı için bir tam sayı girin" -#: instances/views.py:1222 +#: instances/views.py:1227 msgid "Shut off the VM to change its vCPUs" msgstr "vCPU'larını değiştirmek için sanal makineyi kapatın" -#: instances/views.py:1225 +#: instances/views.py:1230 msgid "The current vCPUs cannot be more than the maximum" msgstr "Geçerli vCPU sayısı en fazla değerden büyük olamaz" -#: instances/views.py:1232 +#: instances/views.py:1237 #, python-format msgid "%(quota)s: cannot resize the CPU of '%(instance_name)s'." msgstr "%(quota)s: '%(instance_name)s' CPU'su yeniden boyutlandırılamıyor." -#: instances/views.py:1240 +#: instances/views.py:1245 #, python-format msgid "vCPUs set to %(cur)s (maximum %(max)s)" msgstr "vCPU sayısı %(cur)s olarak ayarlandı (en fazla %(max)s)" -#: instances/views.py:1259 +#: instances/views.py:1264 msgid "Enter a whole number for memory" msgstr "Bellek için bir tam sayı girin" -#: instances/views.py:1262 +#: instances/views.py:1267 msgid "The current memory cannot be more than the maximum" msgstr "Geçerli bellek en fazla değerden büyük olamaz" -#: instances/views.py:1266 +#: instances/views.py:1271 #, python-format msgid "%(quota)s: cannot resize the memory of '%(instance_name)s'." msgstr "%(quota)s: '%(instance_name)s' belleği yeniden boyutlandırılamıyor." -#: instances/views.py:1272 +#: instances/views.py:1277 #, python-format msgid "Memory set to %(cur)s MiB (maximum %(max)s MiB)" msgstr "Bellek %(cur)s MiB olarak ayarlandı (en fazla %(max)s MiB)" -#: instances/views.py:1292 +#: instances/views.py:1297 msgid "Enter disk sizes as whole GiB" msgstr "Disk boyutlarını tam GiB olarak girin" -#: instances/views.py:1296 +#: instances/views.py:1301 #, python-format msgid "Disk %(dev)s was changed meanwhile; reload the page" msgstr "%(dev)s diski bu arada değişti; sayfayı yeniden yükleyin" -#: instances/views.py:1300 +#: instances/views.py:1305 #, python-format msgid "%(dev)s is %(size)s: a disk cannot shrink" msgstr "%(dev)s boyutu %(size)s: disk küçültülemez" -#: instances/views.py:1308 +#: instances/views.py:1313 msgid "No disks were selected or valid for resizing." msgstr "Boyutlandırma için seçilmiş ya da geçerli disk yok." -#: instances/views.py:1317 +#: instances/views.py:1322 #, python-format msgid "%(quota)s: cannot resize the disks of '%(instance_name)s'." msgstr "%(quota)s: '%(instance_name)s' diskleri yeniden boyutlandırılamıyor." -#: instances/views.py:1329 +#: instances/views.py:1334 #, python-format msgid "The storage pool of %(dev)s cannot resize its volumes" msgstr "%(dev)s diskinin depolama havuzu birimlerini boyutlandıramaz" -#: instances/views.py:1331 +#: instances/views.py:1336 #, python-format msgid "Disk is resized: %(dev)s" msgstr "Disk boyutu değiştirildi: %(dev)s" -#: instances/views.py:1425 +#: instances/views.py:1430 msgid "The VM's machine has no PCIe slots to add" msgstr "Sanal makinenin makine tipinde eklenecek PCIe yuvası yok" -#: instances/views.py:1430 +#: instances/views.py:1435 #, python-format msgid "%(count)s PCIe slots added" msgstr "%(count)s PCIe yuvası eklendi" -#: instances/views.py:1432 +#: instances/views.py:1437 #, python-format msgid "%(count)s PCIe slots added: the VM gets them at its next start" msgstr "" "%(count)s PCIe yuvası eklendi: sanal makine bunları sonraki başlatmasında " "alır" -#: instances/views.py:1478 +#: instances/views.py:1483 #, python-format msgid "%(volume)s is already a disk of this VM" msgstr "%(volume)s zaten bu sanal makinenin bir diski" -#: instances/views.py:1568 +#: instances/views.py:1573 msgid "Volume changes are applied. But it will be activated after shutdown" msgstr "" "Birim değişiklikleri uygulandı. Ama yeniden başlatıldıktan sonra uygulanacak" -#: instances/views.py:1573 +#: instances/views.py:1578 msgid "Volume is changed successfully." msgstr "Birim başarıyla değiştirildi." -#: instances/views.py:1593 +#: instances/views.py:1598 #, python-format 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:1598 vrtManager/instance.py:2426 +#: instances/views.py:1603 vrtManager/instance.py:2426 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" " kaldırın" -#: instances/views.py:1604 +#: instances/views.py:1609 #, python-format msgid "Disk %(dev)s has a pending change; delete it once the VM is shut down" msgstr "" "%(dev)s diskinin bekleyen bir değişikliği var; sanal makine kapatıldığında " "silin" -#: instances/views.py:1619 +#: instances/views.py:1624 #, python-format msgid "Volume %(vol)s is used by another VM; detach it instead" msgstr "" "%(vol)s birimi başka bir sanal makine tarafından kullanılıyor; onun yerine " "ayırın" -#: instances/views.py:1637 +#: instances/views.py:1642 #, python-format msgid "" "The guest has not released disk %(dev)s yet; volume %(vol)s was kept. Delete " @@ -6955,66 +6964,66 @@ msgstr "" "Konuk sistem %(dev)s diskini henüz bırakmadı; %(vol)s birimi korundu. Sanal " "makine kapatıldığında depolama havuzundan silin." -#: instances/views.py:1648 +#: instances/views.py:1653 #, python-format msgid "Disk %(dev)s was detached, but its volume was kept: %(err)s" msgstr "%(dev)s diski ayrıldı, ancak birimi korundu: %(err)s" -#: instances/views.py:1676 +#: instances/views.py:1681 #, python-format msgid "This VM cannot take a CD-ROM on the %(bus)s bus now" msgstr "Bu sanal makineye şu anda %(bus)s veri yolunda CD-ROM eklenemez" -#: instances/views.py:1679 +#: instances/views.py:1684 msgid "A USB CD-ROM needs an ISO image: libvirt has no empty USB drive" msgstr "USB CD-ROM bir ISO imajı ister: libvirt boş USB sürücü desteklemiyor" -#: instances/views.py:1684 +#: instances/views.py:1689 #, python-format msgid "%(image)s is already in a CD-ROM of this VM" msgstr "%(image)s bu sanal makinenin bir CD-ROM'unda zaten takılı" -#: instances/views.py:1765 +#: instances/views.py:1770 #, python-format msgid "Pool %(pool)s was not read again: %(err)s" msgstr "%(pool)s havuzu yeniden okunamadı: %(err)s" -#: instances/views.py:1786 +#: instances/views.py:1791 #, python-format msgid "Snapshot was not deleted: %(err)s" msgstr "Anlık görüntü silinmedi: %(err)s" -#: instances/views.py:1905 +#: instances/views.py:1910 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:1911 vrtManager/instance.py:1198 +#: instances/views.py:1916 vrtManager/instance.py:1198 msgid "Invalid Device Type for boot order" msgstr "Ön yükleme sırası için geçersiz aygıt türü" -#: instances/views.py:1922 +#: instances/views.py:1927 msgid "Boot order changed. It applies at the next start." msgstr "Ön yükleme sırası değiştirildi. Sonraki başlatmada uygulanır." -#: instances/views.py:1924 +#: instances/views.py:1929 msgid "Boot order changed successfully." msgstr "Ön yükleme sırası başarıyla değiştirildi." -#: instances/views.py:1944 +#: instances/views.py:1949 msgid "The XML is empty" msgstr "XML boş" -#: instances/views.py:1948 instances/views.py:2609 +#: instances/views.py:1953 instances/views.py:2614 #, python-format msgid "The XML is not well-formed: %(error)s" msgstr "XML düzgün biçimlendirilmemiş: %(error)s" -#: instances/views.py:1950 +#: instances/views.py:1955 #, python-format msgid "The XML must keep the VM's UUID %(uuid)s." msgstr "XML, sanal makinenin %(uuid)s UUID'sini korumalıdır." -#: instances/views.py:1954 +#: instances/views.py:1959 msgid "" "The definition has changed since the editor was opened. Reload the page to " "edit the current one." @@ -7022,45 +7031,45 @@ msgstr "" "Düzenleyici açıldığından beri tanım değişti. Geçerli tanımı düzenlemek için " "sayfayı yeniden yükleyin." -#: instances/views.py:1970 +#: instances/views.py:1975 msgid "The XML definition was saved." msgstr "XML tanımı kaydedildi." -#: instances/views.py:1972 +#: instances/views.py:1977 msgid "The XML definition was saved; the VM uses it from its next start." msgstr "" "XML tanımı kaydedildi; sanal makine onu sonraki başlatmasından itibaren " "kullanır." -#: instances/views.py:2053 +#: instances/views.py:2058 msgid "Select one network interface to change" msgstr "Değiştirilecek bir ağ arabirimi seçin" -#: instances/views.py:2067 +#: instances/views.py:2072 #, python-format msgid "Network interface %(mac)s was changed meanwhile; reload the page" msgstr "%(mac)s ağ arayüzü bu arada değişti; sayfayı yeniden yükleyin" -#: instances/views.py:2097 +#: instances/views.py:2102 msgid "Network Device Config is changed. Please shutdown instance to activate." msgstr "" "Ağ aygıtı yapılandırması değiştirildi. Aktifleştirmek için lütfen sanal " "makineyi kapatın." -#: instances/views.py:2099 +#: instances/views.py:2104 msgid "Network device changed" msgstr "Ağ aygıtı değiştirildi" -#: instances/views.py:2111 +#: instances/views.py:2116 msgid "No network selected" msgstr "Ağ seçilmedi" -#: instances/views.py:2116 +#: instances/views.py:2121 #, python-format msgid "The VM already has a network device with MAC %(mac)s" msgstr "Sanal makinede %(mac)s MAC adresli bir ağ aygıtı zaten var" -#: instances/views.py:2135 +#: instances/views.py:2140 msgid "" "The running VM has no free PCI slot for another network device: shut it down " "and add the device then; Add PCIe slots on the Disks tab gives it free ones " @@ -7070,21 +7079,21 @@ msgstr "" "aygıtı sonra ekleyin; Diskler sekmesindeki PCIe yuvaları ekle, sonraki " "başlatmadan itibaren ona boş yuvalar verir." -#: instances/views.py:2181 instances/views.py:2187 +#: instances/views.py:2186 instances/views.py:2192 msgid "The VM has it" msgstr "Sanal makinede var" -#: instances/views.py:2222 +#: instances/views.py:2227 #, python-format msgid "The host has no USB device %(device)s; reload the page" msgstr "Sunucuda %(device)s USB aygıtı yok; sayfayı yeniden yükleyin" -#: instances/views.py:2243 +#: instances/views.py:2248 #, python-format msgid "The host has no PCI device %(device)s" msgstr "Sunucuda %(device)s PCI aygıtı yok" -#: instances/views.py:2261 +#: instances/views.py:2266 #, python-format msgid "" "Removal of PCI device %(address)s requested: the guest has not let it go yet;" @@ -7094,20 +7103,20 @@ msgstr "" "bırakmadı; bırakana ya da sanal makine durana kadar çalışan sanal makinede " "kalır." -#: instances/views.py:2306 instances/views.py:2336 +#: instances/views.py:2311 instances/views.py:2341 msgid "Select a network interface and a QoS direction" msgstr "Bir ağ arabirimi ve bir QoS yönü seçin" -#: instances/views.py:2309 vrtManager/network.py:470 +#: instances/views.py:2314 vrtManager/network.py:470 msgid "QoS rates must be whole numbers" msgstr "QoS hızları tam sayı olmalıdır" -#: instances/views.py:2316 networks/views.py:235 +#: instances/views.py:2321 networks/views.py:235 #, python-format msgid "%(qos_dir)s QoS is set" msgstr "%(qos_dir)s QoS ayarlandı" -#: instances/views.py:2321 +#: instances/views.py:2326 #, python-format msgid "" "%(qos_dir)s QoS is set. A running VM gets it after it is powered off and on." @@ -7115,12 +7124,12 @@ msgstr "" "%(qos_dir)s QoS ayarlandı. Çalışan bir sanal makine, kapatılıp açıldıktan " "sonra bunu alır." -#: instances/views.py:2343 networks/views.py:261 +#: instances/views.py:2348 networks/views.py:261 #, python-format msgid "%(qos_dir)s QoS is deleted" msgstr "%(qos_dir)s QoS silindi" -#: instances/views.py:2348 +#: instances/views.py:2353 #, python-format msgid "" "%(qos_dir)s QoS is deleted. A running VM keeps the old limit until it is " @@ -7129,21 +7138,21 @@ msgstr "" "%(qos_dir)s QoS silindi. Çalışan bir sanal makine, kapatılıp açılana kadar " "eski sınırı korur." -#: instances/views.py:2376 +#: instances/views.py:2381 msgid "Only one owner is allowed and the one already added" msgstr "Sadece bir sahibe izin verilmiştir ve bir sahip zaten eklenmiş" -#: instances/views.py:2378 +#: instances/views.py:2383 #, python-format msgid "%(user)s is already an owner" msgstr "%(user)s zaten bir sahip" -#: instances/views.py:2423 +#: instances/views.py:2428 #, python-format msgid "Console settings were not saved: %(errors)s" msgstr "Konsol ayarları kaydedilmedi: %(errors)s" -#: instances/views.py:2445 +#: instances/views.py:2450 msgid "" "Error setting console password. You should check that your instance have an " "graphic device." @@ -7151,37 +7160,37 @@ msgstr "" "Konsol parolası ayarlanırken hata oluştu. Sanal makinenin bir grafik aygıtına" " sahip olduğundan emin olunuz." -#: instances/views.py:2492 +#: instances/views.py:2497 msgid "Shut the VM down to change whether it is a template." msgstr "Şablon olup olmadığını değiştirmek için sanal makineyi kapatın." -#: instances/views.py:2498 +#: instances/views.py:2503 #, python-format msgid "%(quota)s: '%(instance_name)s' stays a template." msgstr "%(quota)s: '%(instance_name)s' şablon olarak kalıyor." -#: instances/views.py:2595 +#: instances/views.py:2600 msgid "The XML has no name" msgstr "XML'de ad yok" -#: instances/views.py:2613 webvirtcloud/middleware.py:157 +#: instances/views.py:2618 webvirtcloud/middleware.py:157 #, python-format msgid "libvirt Error - %(exception)s" msgstr "libvirt Hatası - %(exception)s" -#: instances/views.py:2627 +#: instances/views.py:2632 msgid "An empty disk of the size you set" msgstr "Belirlediğiniz boyutta boş bir disk" -#: instances/views.py:2628 +#: instances/views.py:2633 msgid "Volumes already in a pool" msgstr "Bir havuzda zaten bulunan birimler" -#: instances/views.py:2629 +#: instances/views.py:2634 msgid "A copy of a template volume" msgstr "Bir şablon biriminin kopyası" -#: instances/views.py:2719 +#: instances/views.py:2724 msgid "" "This host has no running storage pool for the VM's disks: add or start one on" " its Storage page." @@ -7189,29 +7198,29 @@ msgstr "" "Bu sunucuda sanal makinenin diskleri için çalışan bir depolama havuzu yok: " "Depolama sayfasından bir tane ekleyin ya da başlatın." -#: instances/views.py:2721 +#: instances/views.py:2726 msgid "This host has no network for the VM: add one on its Networks page." msgstr "" "Bu sunucuda sanal makine için ağ yok: Ağlar sayfasından bir tane ekleyin." -#: instances/views.py:2753 +#: instances/views.py:2758 #, python-format msgid "The machine type is q35, not %(machine)s: UEFI Secure Boot needs it" msgstr "Makine türü %(machine)s değil q35: UEFI Secure Boot bunu gerektiriyor" -#: instances/views.py:2782 +#: instances/views.py:2787 msgid "Flavor Created" msgstr "Flavor Oluşturuldu" -#: instances/views.py:2790 +#: instances/views.py:2795 msgid "Create Flavor" msgstr "Kullanıcı Oluştur" -#: instances/views.py:2802 +#: instances/views.py:2807 msgid "Flavor Deleted" msgstr "Flavor Silindi" -#: instances/views.py:2808 +#: instances/views.py:2813 msgid "Only the size template goes; VMs made from it keep their size." msgstr "" "Yalnızca boyut şablonu silinir; ondan oluşturulan sanal makineler boyutlarını" @@ -8621,6 +8630,7 @@ msgid "No jobs" msgstr "İş yok" #: operations/templates/operations/jobs.html:59 +#: vmbackups/templates/vmbackups/vm_tab.html:50 msgid "Job" msgstr "İş" @@ -9510,10 +9520,6 @@ msgstr "Geri" msgid "Home" msgstr "Ana sayfa" -#: templates/navbar.html:21 vmbackups/templates/vmbackups/targets.html:17 -msgid "Backups" -msgstr "Yedekler" - #: templates/navbar.html:31 msgid "Administration" msgstr "Yönetim" @@ -9713,6 +9719,97 @@ msgstr "Sunucu" msgid "A backup target with this name exists" msgstr "Bu adla bir yedek hedefi zaten var" +#: vmbackups/jobs.py:46 +#, 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" + +#: vmbackups/jobs.py:56 +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:60 +msgid "" +"A running VM's backup needs libvirt 11.10 or later; shut the VM down to back " +"it up" +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:62 +msgid "A paused VM's file systems cannot be frozen" +msgstr "Duraklatılmış bir sanal makinenin dosya sistemleri dondurulamaz" + +#: vmbackups/jobs.py:64 +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:114 +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:175 +msgid "Back up VM" +msgstr "Sanal makineyi yedekle" + +#: vmbackups/jobs.py:226 vmbackups/jobs.py:293 +msgid "Writing the backup's files" +msgstr "Yedeğin dosyaları yazılıyor" + +#: vmbackups/jobs.py:305 +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:354 +#, 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 "" +"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:371 +#, 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 "" +"İş durduğunda bir disk kopyalanıyordu; yedek hedefindeki şu birimleri kontrol" +" edin, sonra bu işi çözün: %(volumes)s" + +#: vmbackups/jobs.py:381 +#, python-format +msgid "" +"Another backup runs on the VM; check these volumes of the backup target, then" +" resolve this job: %(volumes)s" +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:387 +#, 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'te kopyanın sonucu yok; yedek hedefindeki şu birimleri kontrol edin, " +"sonra bu işi çözün: %(volumes)s" + +#: vmbackups/jobs.py:395 +msgid "The job stopped before the copy ended" +msgstr "İş, kopyalama bitmeden durdu" + +#: vmbackups/jobs.py:402 +#, python-format +msgid "The backup's files could not be written: %(error)s" +msgstr "Yedeğin dosyaları yazılamadı: %(error)s" + #: vmbackups/templates/vmbackups/target.html:6 #: vmbackups/templates/vmbackups/target.html:8 #: vmbackups/templates/vmbackups/targets.html:6 @@ -9785,7 +9882,58 @@ msgstr "Henüz yedek hedefi yok." msgid "Add a backup target" msgstr "Yedek hedefi ekle" -#: vmbackups/utils.py:25 +#: vmbackups/templates/vmbackups/vm_tab.html:10 +#: vmbackups/templates/vmbackups/vm_tab.html:25 +msgid "Back up now" +msgstr "Şimdi yedekle" + +#: vmbackups/templates/vmbackups/vm_tab.html:13 +msgid "Backup target" +msgstr "Yedek hedefi" + +#: vmbackups/templates/vmbackups/vm_tab.html:21 +msgid "Require frozen file systems" +msgstr "Dosya sistemlerinin dondurulmasını zorunlu kıl" + +#: vmbackups/templates/vmbackups/vm_tab.html:28 +msgid "" +"A running VM keeps running: its disks are copied from one instant, its file " +"systems frozen for that instant when the guest agent answers, otherwise the " +"backup is crash-consistent. Memory is not kept." +msgstr "" +"Çalışan sanal makine çalışmaya devam eder: diskleri tek bir andan kopyalanır;" +" konuk ajanı yanıt verirse dosya sistemleri o an için dondurulur, vermezse " +"yedek çökme tutarlıdır. Bellek saklanmaz." + +#: vmbackups/templates/vmbackups/vm_tab.html:36 +msgid "Time" +msgstr "Zaman" + +#: vmbackups/templates/vmbackups/vm_tab.html:36 +msgid "Target" +msgstr "Hedef" + +#: vmbackups/templates/vmbackups/vm_tab.html:36 +msgid "Consistency" +msgstr "Tutarlılık" + +#: vmbackups/templates/vmbackups/vm_tab.html:46 +msgid "Ready" +msgstr "Hazır" + +#: vmbackups/templates/vmbackups/vm_tab.html:47 +msgid "Creating" +msgstr "Oluşturuluyor" + +#: vmbackups/templates/vmbackups/vm_tab.html:48 +msgid "Deleting" +msgstr "Siliniyor" + +#: vmbackups/templates/vmbackups/vm_tab.html:58 +msgid "No backup of this VM yet." +msgstr "Bu sanal makinenin henüz yedeği yok." + +#: vmbackups/utils.py:27 #, python-format msgid "" "Volume %(volume)s belongs to a backup of %(vm)s; delete the backup on the " @@ -9793,7 +9941,7 @@ msgid "" msgstr "" "%(volume)s birimi %(vm)s yedeğine ait; yedeği Yedekler sayfasından silin" -#: vmbackups/utils.py:35 +#: vmbackups/utils.py:37 #, python-format msgid "" "Storage pool %(pool)s is backup target %(target)s; remove it from the target " @@ -9801,12 +9949,17 @@ msgid "" msgstr "" "%(pool)s depolama havuzu %(target)s yedek hedefidir; önce hedeften çıkarın" -#: vmbackups/views.py:61 vmbackups/views.py:69 +#: vmbackups/utils.py:49 +msgid "No backup target has a storage pool on this VM's host." +msgstr "" +"Hiçbir yedek hedefinin bu sanal makinenin sunucusunda depolama havuzu yok." + +#: vmbackups/views.py:67 vmbackups/views.py:75 #, python-format msgid "Backup target %(target)s has backups; delete them first" msgstr "%(target)s yedek hedefinde yedekler var; önce onları silin" -#: vmbackups/views.py:86 +#: vmbackups/views.py:92 #, python-format msgid "" "Storage pool %(pool)s of %(compute)s is not the same directory as storage " @@ -9815,6 +9968,10 @@ msgstr "" "%(compute)s sunucusunun %(pool)s depolama havuzu, %(other_compute)s " "sunucusunun %(other)s depolama havuzuyla aynı dizin değil" +#: vmbackups/views.py:124 +msgid "Choose a backup target" +msgstr "Bir yedek hedefi seçin" + #: vrtManager/backup.py:35 #, python-format msgid "" @@ -10523,20 +10680,20 @@ msgstr "" msgid "Volume %(name)s already exists in storage pool %(pool)s" msgstr "%(name)s birimi %(pool)s depolama havuzunda zaten var" -#: vrtManager/instance.py:2888 +#: vrtManager/instance.py:2899 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:2904 +#: vrtManager/instance.py:2915 #, python-format msgid "No network interface with MAC %(old_mac)s" msgstr "MAC adresi %(old_mac)s olan ağ arabirimi yok" -#: vrtManager/instance.py:2907 +#: vrtManager/instance.py:2918 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:3001 +#: vrtManager/instance.py:3012 msgid "" "A VM changes its PCI devices while it runs, or is shut off without a saved " "state" @@ -10544,43 +10701,43 @@ msgstr "" "Sanal makine PCI aygıtlarını çalışırken veya kaydedilmiş durumu olmadan " "kapalıyken değiştirir" -#: vrtManager/instance.py:3022 +#: vrtManager/instance.py:3033 #, 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:3024 +#: vrtManager/instance.py:3035 #, 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:3025 +#: vrtManager/instance.py:3036 #, 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:3026 +#: vrtManager/instance.py:3037 #, 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:3027 +#: vrtManager/instance.py:3038 #, 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:3028 +#: vrtManager/instance.py:3039 #, 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:3030 +#: vrtManager/instance.py:3041 #, python-format msgid "" "%(err)s; %(device)s: the running VM does not have it, its next start does not" @@ -10588,48 +10745,48 @@ msgid "" msgstr "" "%(err)s; %(device)s: çalışan sanal makinede yok, sonraki başlatmada yok" -#: vrtManager/instance.py:3064 +#: vrtManager/instance.py:3075 #, python-format msgid "The VM has no PCI device %(address)s" msgstr "Sanal makinede %(address)s PCI aygıtı yok" -#: vrtManager/instance.py:3085 +#: vrtManager/instance.py:3096 msgid "The VM has no USB controller" msgstr "Sanal makinede USB denetleyicisi yok" -#: vrtManager/instance.py:3119 +#: vrtManager/instance.py:3130 msgid "The VM has no such USB device" msgstr "Sanal makinede böyle bir USB aygıtı yok" -#: vrtManager/instance.py:3133 +#: vrtManager/instance.py:3144 #, python-format msgid "The VM has no network interface %(mac)s" msgstr "Sanal makinede %(mac)s ağ arabirimi yok" -#: vrtManager/instance.py:3164 +#: vrtManager/instance.py:3175 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:3191 +#: vrtManager/instance.py:3202 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:3210 +#: vrtManager/instance.py:3221 #, python-format msgid "Unknown crash action %(action)s" msgstr "Bilinmeyen çökme eylemi %(action)s" -#: vrtManager/instance.py:3237 +#: vrtManager/instance.py:3248 #, python-format msgid "Network interface %(mac)s is not in the definition" msgstr "%(mac)s ağ arayüzü tanımda yok" -#: vrtManager/instance.py:3328 +#: vrtManager/instance.py:3339 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:3331 +#: vrtManager/instance.py:3342 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 1e30fd6e..8853f4e5 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 65aa4718..ac4f89be 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 05:39+0000\n" +"POT-Creation-Date: 2026-11-17 06:13+0000\n" "PO-Revision-Date: \n" "Last-Translator: \n" "Language-Team: \n" @@ -215,7 +215,7 @@ msgstr "用户页面导航" #: accounts/templates/account.html:50 accounts/templates/account.html:58 #: admin/forms.py:207 computes/templates/computes/list.html:33 #: computes/templates/computes/list.html:60 computes/templates/overview.html:90 -#: instances/views.py:262 +#: instances/views.py:263 msgid "VMs" msgstr "虚拟机" @@ -239,7 +239,7 @@ msgstr "添加虚拟机" #: instances/templates/allinstances.html:108 #: instances/templates/allinstances_index_nongrouped.html:8 #: instances/templates/create_steps.html:6 -#: instances/templates/create_steps.html:8 instances/views.py:239 +#: instances/templates/create_steps.html:8 instances/views.py:240 #: operations/templates/operations/jobs.html:24 msgid "Host" msgstr "主机" @@ -747,7 +747,7 @@ msgstr "NEW_USER_DEFAULT_INSTANCES:%(name)s 已有所有者,且只允许一 #: instances/templates/allinstances_index_nongrouped.html:14 #: instances/templates/create_instance_w2.html:63 #: instances/templates/instances/resize_tab.html:30 -#: instances/templates/instances/settings_tab.html:854 instances/views.py:239 +#: instances/templates/instances/settings_tab.html:854 instances/views.py:240 msgid "vCPUs" msgstr "vCPU" @@ -947,7 +947,7 @@ msgid "IP" msgstr "IP" #: admin/templates/admin/logs.html:56 admin/views.py:395 instances/states.py:19 -#: instances/views.py:479 logs/views.py:18 +#: instances/views.py:484 logs/views.py:18 msgid "Unknown" msgstr "未知" @@ -957,6 +957,7 @@ msgstr "完成" #: admin/templates/admin/logs.html:56 admin/views.py:395 logs/views.py:18 #: operations/templates/operations/job.html:107 +#: vmbackups/templates/vmbackups/vm_tab.html:49 msgid "Failed" msgstr "失败" @@ -989,7 +990,7 @@ msgstr "模板" msgid "Left" msgstr "已离开" -#: admin/templates/admin/tombstone_list.html:34 instances/views.py:240 +#: admin/templates/admin/tombstone_list.html:34 instances/views.py:241 msgid "Owners" msgstr "所有者" @@ -2157,7 +2158,7 @@ msgstr "不迁移其虚拟机,直接将主机置于维护状态?" msgid "Put in maintenance without migrating" msgstr "不迁移,直接进入维护" -#: computes/templates/computes/bulk_migrate.html:26 instances/views.py:379 +#: computes/templates/computes/bulk_migrate.html:26 instances/views.py:380 msgid "There is no other host to migrate to." msgstr "没有其他可迁移到的主机。" @@ -3022,12 +3023,12 @@ msgid "" msgstr "不支持控制台类型 '%(type)s'。请将虚拟机图形切换为 VNC。" #: instances/api/viewsets.py:157 instances/api/viewsets.py:175 -#: instances/views.py:853 instances/views.py:875 instances/views.py:1860 +#: instances/views.py:858 instances/views.py:880 instances/views.py:1865 msgid "Templates cannot be started." msgstr "模板无法启动。" #: instances/forms.py:14 instances/templates/create_instance_w2.html:69 -#: instances/templates/instances/settings_tab.html:858 instances/views.py:239 +#: instances/templates/instances/settings_tab.html:858 instances/views.py:240 msgid "Memory (MiB)" msgstr "内存(MiB)" @@ -3108,7 +3109,7 @@ msgstr "控制台监听的不只是 localhost;只有管理员可以移除其 msgid "The name of the virtual machine must not contain any special characters" msgstr "虚拟机名称不能包含任何特殊字符" -#: instances/jobs.py:73 +#: instances/jobs.py:73 vmbackups/jobs.py:73 msgid "The VM moved to another compute after the job was queued" msgstr "任务排队后,虚拟机已移到另一个计算节点" @@ -3281,10 +3282,11 @@ msgid "Clone VM" msgstr "克隆虚拟机" #: instances/jobs.py:656 instances/jobs.py:663 instances/jobs.py:1005 +#: vmbackups/jobs.py:210 msgid "Copying disks" msgstr "正在复制磁盘" -#: instances/jobs.py:715 +#: instances/jobs.py:715 vmbackups/jobs.py:286 msgid "libvirt has no result of the copy" msgstr "libvirt 没有复制的结果" @@ -3295,7 +3297,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 +#: instances/jobs.py:729 instances/jobs.py:821 vmbackups/jobs.py:292 msgid "The copy failed" msgstr "复制失败" @@ -3313,11 +3315,11 @@ msgid "" "this job: %(volumes)s" msgstr "克隆的一个卷正在创建中;请检查这些卷,然后处理此任务:%(volumes)s" -#: instances/jobs.py:801 +#: instances/jobs.py:801 vmbackups/jobs.py:329 msgid "The job stopped before the copy started" msgstr "任务在复制开始前停止" -#: instances/jobs.py:808 +#: instances/jobs.py:808 vmbackups/jobs.py:377 msgid "libvirt is still copying the disks" msgstr "libvirt 仍在复制磁盘" @@ -3350,12 +3352,12 @@ msgstr "镜像已存在。请检查卷或更改虚拟机名称" msgid "Each network card needs a network" msgstr "每个网卡都需要一个网络" -#: instances/jobs.py:868 vrtManager/instance.py:2849 +#: instances/jobs.py:868 vrtManager/instance.py:2860 #, python-format msgid "This host has no network %(name)s" msgstr "此主机没有网络 %(name)s" -#: instances/jobs.py:870 vrtManager/instance.py:2851 +#: instances/jobs.py:870 vrtManager/instance.py:2862 #, python-format msgid "This host has no network filter %(name)s" msgstr "此主机没有网络过滤器 %(name)s" @@ -3377,7 +3379,7 @@ msgstr "磁盘缓存 %(cache)s 与设置中的原生 (native) 磁盘 I/O 不兼 msgid "Create VM" msgstr "创建虚拟机" -#: instances/jobs.py:928 instances/jobs.py:975 instances/views.py:2597 +#: instances/jobs.py:928 instances/jobs.py:975 instances/views.py:2602 msgid "A virtual machine with this name already exists" msgstr "同名虚拟机已存在" @@ -3425,7 +3427,7 @@ msgstr "cloud-init 种子需要为磁盘使用目录类型的存储池" msgid "This host offers no firmware %(firmware)s" msgstr "此主机不提供固件 %(firmware)s" -#: instances/jobs.py:957 vrtManager/instance.py:3198 +#: instances/jobs.py:957 vrtManager/instance.py:3209 msgid "This host offers no TPM 2.0: install swtpm on it" msgstr "此主机不提供 TPM 2.0:请在主机上安装 swtpm" @@ -3725,7 +3727,7 @@ msgid "Disk source" msgstr "磁盘来源" #: instances/templates/add_instance_volume.html:21 -#: instances/templates/create_instance_w2.html:134 instances/views.py:2627 +#: instances/templates/create_instance_w2.html:134 instances/views.py:2632 msgid "New disk" msgstr "新磁盘" @@ -3758,6 +3760,7 @@ msgstr "字母、数字、点、短横线和下划线。" #: instances/templates/add_instance_volume.html:44 #: instances/templates/instances/settings_tab.html:851 +#: vmbackups/templates/vmbackups/vm_tab.html:36 msgid "Size" msgstr "大小" @@ -3909,7 +3912,7 @@ msgstr "查找" msgid "Address" msgstr "地址" -#: instances/templates/allinstances.html:105 instances/views.py:239 +#: instances/templates/allinstances.html:105 instances/views.py:240 #: interfaces/templates/interface.html:153 networks/templates/network.html:202 msgid "VM" msgstr "虚拟机" @@ -4107,7 +4110,7 @@ msgstr "自定义 CPU 型号" msgid "Size (GiB)" msgstr "大小(GiB)" -#: instances/templates/create_instance_w2.html:161 instances/views.py:2628 +#: instances/templates/create_instance_w2.html:161 instances/views.py:2633 msgid "Existing volumes" msgstr "已有卷" @@ -4144,7 +4147,7 @@ msgstr "设备" msgid "Remove" msgstr "移除" -#: instances/templates/create_instance_w2.html:194 instances/views.py:2629 +#: instances/templates/create_instance_w2.html:194 instances/views.py:2634 msgid "Clone from template" msgstr "从模板克隆" @@ -4330,7 +4333,12 @@ msgstr "设置" msgid "Stats" msgstr "统计" -#: instances/templates/instance.html:111 +#: instances/templates/instance.html:112 templates/navbar.html:21 +#: vmbackups/templates/vmbackups/targets.html:17 +msgid "Backups" +msgstr "备份" + +#: instances/templates/instance.html:116 #: instances/templates/instances/destroy_tab.html:7 msgid "Destroy" msgstr "销毁" @@ -4668,7 +4676,7 @@ msgid "Add USB device" msgstr "添加 USB 设备" #: instances/templates/instances/host_devices_form.html:18 -#: vrtManager/instance.py:3102 +#: vrtManager/instance.py:3113 msgid "" "A VM with a saved state does not change its USB devices: start it, or start " "it without its saved state" @@ -6210,141 +6218,142 @@ msgstr "无效的 MAC 地址" msgid "More MAC addresses than networks" msgstr "MAC 地址数量多于网络数量" -#: instances/views.py:191 +#: instances/views.py:192 msgid "Enter an IP address, a network such as 192.0.2.0/24, or a MAC address." msgstr "请输入 IP 地址、网络(如 192.0.2.0/24)或 MAC 地址。" -#: instances/views.py:197 instances/views.py:231 +#: instances/views.py:198 instances/views.py:232 msgid "Too many searches are still running; try again shortly." msgstr "仍在运行的搜索过多;请稍后再试。" -#: instances/views.py:239 interfaces/templates/interface.html:46 +#: instances/views.py:240 interfaces/templates/interface.html:46 #: networks/templates/network.html:51 #: operations/templates/operations/jobs.html:38 #: operations/templates/operations/jobs.html:62 #: storages/templates/storage.html:91 +#: vmbackups/templates/vmbackups/vm_tab.html:36 msgid "State" msgstr "状态" -#: instances/views.py:239 +#: instances/views.py:240 msgid "OS" msgstr "操作系统" -#: instances/views.py:239 +#: instances/views.py:240 msgid "OS family" msgstr "操作系统系列" -#: instances/views.py:239 +#: instances/views.py:240 msgid "IP addresses" msgstr "IP 地址" -#: instances/views.py:240 +#: instances/views.py:241 msgid "Address sources" msgstr "地址来源" -#: instances/views.py:240 +#: instances/views.py:241 msgid "MAC addresses" msgstr "MAC 地址" -#: instances/views.py:240 +#: instances/views.py:241 msgid "In the panel" msgstr "在面板中" -#: instances/views.py:251 +#: instances/views.py:252 msgid "yes" msgstr "是" -#: instances/views.py:251 +#: instances/views.py:252 msgid "no" msgstr "否" -#: instances/views.py:253 +#: instances/views.py:254 #, python-format msgid "Created: %(time)s" msgstr "创建时间:%(time)s" -#: instances/views.py:254 +#: instances/views.py:255 #, python-format msgid "VMs listed: %(n)s" msgstr "列出的虚拟机:%(n)s" -#: instances/views.py:255 +#: instances/views.py:256 #, python-format msgid "Running VMs read: %(n)s" msgstr "已读取的运行中虚拟机:%(n)s" -#: instances/views.py:256 +#: instances/views.py:257 #, python-format msgid "" "Without a connected guest agent (a static address on them cannot be seen): " "%(n)s" msgstr "没有已连接客户机代理的虚拟机(无法看到其上的静态地址):%(n)s" -#: instances/views.py:257 +#: instances/views.py:258 #, python-format msgid "" "Guest agents not read (a paused VM, no answer in time, or an error): %(n)s" msgstr "未读取的客户机代理(虚拟机已暂停、未及时响应或出错):%(n)s" -#: instances/views.py:259 +#: instances/views.py:260 #, python-format msgid "Hosts not reached: %(hosts)s" msgstr "无法连接的主机:%(hosts)s" -#: instances/views.py:261 +#: instances/views.py:262 #, python-format msgid "Hosts not finished in time: %(hosts)s" msgstr "未按时完成的主机:%(hosts)s" -#: instances/views.py:262 +#: instances/views.py:263 msgid "Coverage" msgstr "覆盖范围" -#: instances/views.py:277 +#: instances/views.py:278 #, python-format msgid "The host %(host)s of '%(name)s' cannot be reached: %(error)s" msgstr "无法连接“%(name)s”所在的主机 %(host)s:%(error)s" -#: instances/views.py:283 +#: instances/views.py:284 #, python-format msgid "The host of '%(name)s' cannot be reached right now." msgstr "目前无法连接“%(name)s”所在的主机。" -#: instances/views.py:284 +#: instances/views.py:285 msgid " Jobs on it can be followed under Jobs in the menu." msgstr " 其上的任务可在菜单的“任务”中跟踪。" -#: instances/views.py:292 +#: instances/views.py:293 #, python-format msgid "'%(name)s' is no longer on its host." msgstr "“%(name)s”已不在其主机上。" -#: instances/views.py:381 +#: instances/views.py:382 msgid "A VM migrates when it is running, paused or shut off." msgstr "虚拟机在运行、暂停或关机状态下均可迁移。" -#: instances/views.py:383 +#: instances/views.py:384 msgid "" "A VM with snapshots cannot be migrated: its snapshots stay on this host. " "Delete them first." msgstr "有快照的虚拟机无法迁移:其快照保留在本主机上。请先删除快照。" -#: instances/views.py:385 +#: instances/views.py:386 msgid "" "A VM with host devices cannot be migrated: the destination may not have them." " Remove them first." msgstr "有主机设备的虚拟机无法迁移:目标主机可能没有这些设备。请先移除它们。" -#: instances/views.py:624 +#: instances/views.py:629 #, python-format msgid "Disk %(dev)s has changed since the page was loaded; reload the page" msgstr "磁盘 %(dev)s 在页面加载后已更改;请刷新页面" -#: instances/views.py:699 instances/views.py:700 +#: instances/views.py:704 instances/views.py:705 msgid "The VM was moved meanwhile; try again." msgstr "该虚拟机在此期间已被移动;请重试。" -#: instances/views.py:816 +#: instances/views.py:821 msgid "" "The running VM has no free PCI slot for another disk on this bus: choose the " "scsi bus if the VM has a SCSI controller, or shut the VM down and add the " @@ -6354,7 +6363,7 @@ msgstr "" "运行中的虚拟机在此总线上没有可用 PCI 插槽来添加磁盘:如果虚拟机有 SCSI 控制器,请选择 scsi " "总线;或关闭虚拟机后再添加磁盘。“磁盘”选项卡上的“添加 PCIe 插槽”可使其从下次启动起获得可用插槽。新卷会保留在其存储池中,可作为现有卷挂载。" -#: instances/views.py:820 +#: instances/views.py:825 msgid "" "The running VM has no free PCI slot for the SCSI controller the disk needs: " "shut the VM down and add the disk then; Add PCIe slots on the Disks tab gives" @@ -6364,289 +6373,289 @@ msgstr "" "运行中的虚拟机没有可用 PCI 插槽来添加磁盘所需的 SCSI 控制器:请关闭虚拟机后再添加磁盘。“磁盘”选项卡上的“添加 PCIe " "插槽”可使其从下次启动起获得可用插槽。新卷会保留在其存储池中,可作为现有卷挂载。" -#: instances/views.py:838 +#: instances/views.py:843 #, python-format msgid "Invalid disk options: %(options)s" msgstr "无效的磁盘选项:%(options)s" -#: instances/views.py:850 instances/views.py:945 +#: instances/views.py:855 instances/views.py:950 #, python-format msgid "Invalid options: %(options)s" msgstr "无效的选项:%(options)s" -#: instances/views.py:885 +#: instances/views.py:890 msgid "The VM was forced off but did not start again: it stays off." msgstr "虚拟机已被强制关机,但没有再次启动:它保持关机状态。" -#: instances/views.py:1073 +#: instances/views.py:1078 #, python-format msgid "Set the gstfsd key of %(compute)s first (Computes, edit the host)" msgstr "请先设置 %(compute)s 的 gstfsd 密钥(计算节点,编辑该主机)" -#: instances/views.py:1080 instances/views.py:1098 instances/views.py:1107 +#: instances/views.py:1085 instances/views.py:1103 instances/views.py:1112 #, python-format msgid "gstfsd error: %(err)s" msgstr "gstfsd 错误:%(err)s" -#: instances/views.py:1108 +#: instances/views.py:1113 msgid "the reply is not signed with the key" msgstr "回复未使用该密钥签名" -#: instances/views.py:1116 +#: instances/views.py:1121 msgid "Shut the VM down, or start its QEMU guest agent, and try again" msgstr "请关闭虚拟机,或启动其 QEMU 客户机代理,然后重试" -#: instances/views.py:1124 +#: instances/views.py:1129 msgid "The change may still be made when the agent answers again." msgstr "当代理再次响应时,此更改仍可能生效。" -#: instances/views.py:1139 +#: instances/views.py:1144 msgid "Enter a password" msgstr "请输入密码" -#: instances/views.py:1144 +#: instances/views.py:1149 msgid "Enter a password of at most 4096 characters, without NUL characters" msgstr "请输入不超过 4096 个字符且不含 NUL 字符的密码" -#: instances/views.py:1160 +#: instances/views.py:1165 msgid "Reset root password" msgstr "重置 root 密码" -#: instances/views.py:1176 +#: instances/views.py:1181 msgid "Select an SSH public key" msgstr "请选择 SSH 公钥" -#: instances/views.py:1198 +#: instances/views.py:1203 #, python-format msgid "Installed new SSH public key %(keyname)s" msgstr "已安装新的 SSH 公钥 %(keyname)s" -#: instances/views.py:1218 +#: instances/views.py:1223 msgid "Enter a whole number of vCPUs" msgstr "请输入整数个 vCPU" -#: instances/views.py:1222 +#: instances/views.py:1227 msgid "Shut off the VM to change its vCPUs" msgstr "请关闭虚拟机以更改其 vCPU" -#: instances/views.py:1225 +#: instances/views.py:1230 msgid "The current vCPUs cannot be more than the maximum" msgstr "当前 vCPU 数不能超过最大值" -#: instances/views.py:1232 +#: instances/views.py:1237 #, python-format msgid "%(quota)s: cannot resize the CPU of '%(instance_name)s'." msgstr "%(quota)s:无法调整“%(instance_name)s”的 CPU。" -#: instances/views.py:1240 +#: instances/views.py:1245 #, python-format msgid "vCPUs set to %(cur)s (maximum %(max)s)" msgstr "vCPU 已设为 %(cur)s(最大 %(max)s)" -#: instances/views.py:1259 +#: instances/views.py:1264 msgid "Enter a whole number for memory" msgstr "请输入整数内存值" -#: instances/views.py:1262 +#: instances/views.py:1267 msgid "The current memory cannot be more than the maximum" msgstr "当前内存不能超过最大值" -#: instances/views.py:1266 +#: instances/views.py:1271 #, python-format msgid "%(quota)s: cannot resize the memory of '%(instance_name)s'." msgstr "%(quota)s:无法调整“%(instance_name)s”的内存。" -#: instances/views.py:1272 +#: instances/views.py:1277 #, python-format msgid "Memory set to %(cur)s MiB (maximum %(max)s MiB)" msgstr "内存已设为 %(cur)s MiB(最大 %(max)s MiB)" -#: instances/views.py:1292 +#: instances/views.py:1297 msgid "Enter disk sizes as whole GiB" msgstr "请以整数 GiB 输入磁盘大小" -#: instances/views.py:1296 +#: instances/views.py:1301 #, python-format msgid "Disk %(dev)s was changed meanwhile; reload the page" msgstr "磁盘 %(dev)s 在此期间已更改;请重新加载页面" -#: instances/views.py:1300 +#: instances/views.py:1305 #, python-format msgid "%(dev)s is %(size)s: a disk cannot shrink" msgstr "%(dev)s 为 %(size)s:磁盘不能缩小" -#: instances/views.py:1308 +#: instances/views.py:1313 msgid "No disks were selected or valid for resizing." msgstr "未选择磁盘或没有可调整大小的有效磁盘。" -#: instances/views.py:1317 +#: instances/views.py:1322 #, python-format msgid "%(quota)s: cannot resize the disks of '%(instance_name)s'." msgstr "%(quota)s:无法调整“%(instance_name)s”的磁盘。" -#: instances/views.py:1329 +#: instances/views.py:1334 #, python-format msgid "The storage pool of %(dev)s cannot resize its volumes" msgstr "%(dev)s 所在的存储池无法调整其卷的大小" -#: instances/views.py:1331 +#: instances/views.py:1336 #, python-format msgid "Disk is resized: %(dev)s" msgstr "磁盘已调整大小:%(dev)s" -#: instances/views.py:1425 +#: instances/views.py:1430 msgid "The VM's machine has no PCIe slots to add" msgstr "该虚拟机的机器类型没有可添加的 PCIe 插槽" -#: instances/views.py:1430 +#: instances/views.py:1435 #, python-format msgid "%(count)s PCIe slots added" msgstr "已添加 %(count)s 个 PCIe 插槽" -#: instances/views.py:1432 +#: instances/views.py:1437 #, python-format msgid "%(count)s PCIe slots added: the VM gets them at its next start" msgstr "已添加 %(count)s 个 PCIe 插槽:虚拟机在下次启动时获得它们" -#: instances/views.py:1478 +#: instances/views.py:1483 #, python-format msgid "%(volume)s is already a disk of this VM" msgstr "%(volume)s 已是此虚拟机的磁盘" -#: instances/views.py:1568 +#: instances/views.py:1573 msgid "Volume changes are applied. But it will be activated after shutdown" msgstr "卷更改已应用,但将在关机后生效" -#: instances/views.py:1573 +#: instances/views.py:1578 msgid "Volume is changed successfully." msgstr "卷已成功更改。" -#: instances/views.py:1593 +#: instances/views.py:1598 #, python-format msgid "Disk %(dev)s is not a storage volume of this instance" msgstr "磁盘 %(dev)s 不是此虚拟机的存储卷" -#: instances/views.py:1598 vrtManager/instance.py:2426 +#: instances/views.py:1603 vrtManager/instance.py:2426 msgid "The VM has a saved state; start it or remove the saved state first" msgstr "虚拟机有保存的状态;请先启动它或删除保存的状态" -#: instances/views.py:1604 +#: instances/views.py:1609 #, python-format msgid "Disk %(dev)s has a pending change; delete it once the VM is shut down" msgstr "磁盘 %(dev)s 有待生效的更改;请在虚拟机关机后删除它" -#: instances/views.py:1619 +#: instances/views.py:1624 #, python-format msgid "Volume %(vol)s is used by another VM; detach it instead" msgstr "卷 %(vol)s 正被另一台虚拟机使用;请改为分离它" -#: instances/views.py:1637 +#: instances/views.py:1642 #, python-format msgid "" "The guest has not released disk %(dev)s yet; volume %(vol)s was kept. Delete " "it from the storage pool once the VM is shut down." msgstr "客户机尚未释放磁盘 %(dev)s;卷 %(vol)s 已保留。请在虚拟机关机后从存储池中删除它。" -#: instances/views.py:1648 +#: instances/views.py:1653 #, python-format msgid "Disk %(dev)s was detached, but its volume was kept: %(err)s" msgstr "磁盘 %(dev)s 已分离,但其卷已保留:%(err)s" -#: instances/views.py:1676 +#: instances/views.py:1681 #, python-format msgid "This VM cannot take a CD-ROM on the %(bus)s bus now" msgstr "该虚拟机现在无法在 %(bus)s 总线上添加 CD-ROM" -#: instances/views.py:1679 +#: instances/views.py:1684 msgid "A USB CD-ROM needs an ISO image: libvirt has no empty USB drive" msgstr "USB CD-ROM 需要 ISO 镜像:libvirt 不支持空的 USB 驱动器" -#: instances/views.py:1684 +#: instances/views.py:1689 #, python-format msgid "%(image)s is already in a CD-ROM of this VM" msgstr "%(image)s 已在此虚拟机的某个光驱中" -#: instances/views.py:1765 +#: instances/views.py:1770 #, python-format msgid "Pool %(pool)s was not read again: %(err)s" msgstr "未重新读取存储池 %(pool)s:%(err)s" -#: instances/views.py:1786 +#: instances/views.py:1791 #, python-format msgid "Snapshot was not deleted: %(err)s" msgstr "快照未删除:%(err)s" -#: instances/views.py:1905 +#: instances/views.py:1910 msgid "Add at least one device to the boot order." msgstr "请至少向启动顺序中添加一个设备。" -#: instances/views.py:1911 vrtManager/instance.py:1198 +#: instances/views.py:1916 vrtManager/instance.py:1198 msgid "Invalid Device Type for boot order" msgstr "启动顺序的设备类型无效" -#: instances/views.py:1922 +#: instances/views.py:1927 msgid "Boot order changed. It applies at the next start." msgstr "启动顺序已更改,将在下次启动时生效。" -#: instances/views.py:1924 +#: instances/views.py:1929 msgid "Boot order changed successfully." msgstr "启动顺序已成功更改。" -#: instances/views.py:1944 +#: instances/views.py:1949 msgid "The XML is empty" msgstr "XML 为空" -#: instances/views.py:1948 instances/views.py:2609 +#: instances/views.py:1953 instances/views.py:2614 #, python-format msgid "The XML is not well-formed: %(error)s" msgstr "XML 格式不正确:%(error)s" -#: instances/views.py:1950 +#: instances/views.py:1955 #, python-format msgid "The XML must keep the VM's UUID %(uuid)s." msgstr "XML 必须保留虚拟机的 UUID %(uuid)s。" -#: instances/views.py:1954 +#: instances/views.py:1959 msgid "" "The definition has changed since the editor was opened. Reload the page to " "edit the current one." msgstr "自打开编辑器以来定义已被更改。请重新加载页面以编辑当前定义。" -#: instances/views.py:1970 +#: instances/views.py:1975 msgid "The XML definition was saved." msgstr "XML 定义已保存。" -#: instances/views.py:1972 +#: instances/views.py:1977 msgid "The XML definition was saved; the VM uses it from its next start." msgstr "XML 定义已保存;虚拟机从下次启动起使用它。" -#: instances/views.py:2053 +#: instances/views.py:2058 msgid "Select one network interface to change" msgstr "请选择一个要更改的网络接口" -#: instances/views.py:2067 +#: instances/views.py:2072 #, python-format msgid "Network interface %(mac)s was changed meanwhile; reload the page" msgstr "网络接口 %(mac)s 在此期间已更改;请重新加载页面" -#: instances/views.py:2097 +#: instances/views.py:2102 msgid "Network Device Config is changed. Please shutdown instance to activate." msgstr "网络设备配置已更改。请关闭虚拟机以使其生效。" -#: instances/views.py:2099 +#: instances/views.py:2104 msgid "Network device changed" msgstr "网络设备已更改" -#: instances/views.py:2111 +#: instances/views.py:2116 msgid "No network selected" msgstr "未选择网络" -#: instances/views.py:2116 +#: instances/views.py:2121 #, python-format msgid "The VM already has a network device with MAC %(mac)s" msgstr "虚拟机已有 MAC 地址为 %(mac)s 的网络设备" -#: instances/views.py:2135 +#: instances/views.py:2140 msgid "" "The running VM has no free PCI slot for another network device: shut it down " "and add the device then; Add PCIe slots on the Disks tab gives it free ones " @@ -6654,136 +6663,136 @@ msgid "" msgstr "" "运行中的虚拟机没有可用 PCI 插槽来添加网络设备:请关机后再添加设备。“磁盘”选项卡上的“添加 PCIe 插槽”可使其从下次启动起获得可用插槽。" -#: instances/views.py:2181 instances/views.py:2187 +#: instances/views.py:2186 instances/views.py:2192 msgid "The VM has it" msgstr "虚拟机已有此设备" -#: instances/views.py:2222 +#: instances/views.py:2227 #, python-format msgid "The host has no USB device %(device)s; reload the page" msgstr "主机没有 USB 设备 %(device)s;请重新加载页面" -#: instances/views.py:2243 +#: instances/views.py:2248 #, python-format msgid "The host has no PCI device %(device)s" msgstr "主机上没有 PCI 设备 %(device)s" -#: instances/views.py:2261 +#: instances/views.py:2266 #, python-format msgid "" "Removal of PCI device %(address)s requested: the guest has not let it go yet;" " it stays in the running VM until it does or the VM stops." msgstr "已请求移除 PCI 设备 %(address)s:客户机尚未释放它;在客户机释放或虚拟机停止之前,它仍保留在运行中的虚拟机中。" -#: instances/views.py:2306 instances/views.py:2336 +#: instances/views.py:2311 instances/views.py:2341 msgid "Select a network interface and a QoS direction" msgstr "请选择网络接口和 QoS 方向" -#: instances/views.py:2309 vrtManager/network.py:470 +#: instances/views.py:2314 vrtManager/network.py:470 msgid "QoS rates must be whole numbers" msgstr "QoS 速率必须为整数" -#: instances/views.py:2316 networks/views.py:235 +#: instances/views.py:2321 networks/views.py:235 #, python-format msgid "%(qos_dir)s QoS is set" msgstr "%(qos_dir)s QoS 已设置" -#: instances/views.py:2321 +#: instances/views.py:2326 #, python-format msgid "" "%(qos_dir)s QoS is set. A running VM gets it after it is powered off and on." msgstr "%(qos_dir)s QoS 已设置。运行中的虚拟机需关机再开机后才能生效。" -#: instances/views.py:2343 networks/views.py:261 +#: instances/views.py:2348 networks/views.py:261 #, python-format msgid "%(qos_dir)s QoS is deleted" msgstr "%(qos_dir)s QoS 已删除" -#: instances/views.py:2348 +#: instances/views.py:2353 #, python-format msgid "" "%(qos_dir)s QoS is deleted. A running VM keeps the old limit until it is " "powered off and on." msgstr "%(qos_dir)s QoS 已删除。运行中的虚拟机在关机再开机之前保留旧的限制。" -#: instances/views.py:2376 +#: instances/views.py:2381 msgid "Only one owner is allowed and the one already added" msgstr "只允许一个所有者,且已添加" -#: instances/views.py:2378 +#: instances/views.py:2383 #, python-format msgid "%(user)s is already an owner" msgstr "%(user)s 已是所有者" -#: instances/views.py:2423 +#: instances/views.py:2428 #, python-format msgid "Console settings were not saved: %(errors)s" msgstr "控制台设置未保存:%(errors)s" -#: instances/views.py:2445 +#: instances/views.py:2450 msgid "" "Error setting console password. You should check that your instance have an " "graphic device." msgstr "设置控制台密码出错。请检查虚拟机是否有图形设备。" -#: instances/views.py:2492 +#: instances/views.py:2497 msgid "Shut the VM down to change whether it is a template." msgstr "请关闭虚拟机以更改其是否为模板。" -#: instances/views.py:2498 +#: instances/views.py:2503 #, python-format msgid "%(quota)s: '%(instance_name)s' stays a template." msgstr "%(quota)s:“%(instance_name)s”仍为模板。" -#: instances/views.py:2595 +#: instances/views.py:2600 msgid "The XML has no name" msgstr "XML 中没有名称" -#: instances/views.py:2613 webvirtcloud/middleware.py:157 +#: instances/views.py:2618 webvirtcloud/middleware.py:157 #, python-format msgid "libvirt Error - %(exception)s" msgstr "libvirt 错误 - %(exception)s" -#: instances/views.py:2627 +#: instances/views.py:2632 msgid "An empty disk of the size you set" msgstr "按设定大小创建的空磁盘" -#: instances/views.py:2628 +#: instances/views.py:2633 msgid "Volumes already in a pool" msgstr "存储池中已有的卷" -#: instances/views.py:2629 +#: instances/views.py:2634 msgid "A copy of a template volume" msgstr "模板卷的副本" -#: instances/views.py:2719 +#: instances/views.py:2724 msgid "" "This host has no running storage pool for the VM's disks: add or start one on" " its Storage page." msgstr "此主机没有可用于虚拟机磁盘的运行中存储池:请在其“存储”页面添加或启动一个。" -#: instances/views.py:2721 +#: instances/views.py:2726 msgid "This host has no network for the VM: add one on its Networks page." msgstr "此主机没有可供虚拟机使用的网络:请在其“网络”页面添加一个。" -#: instances/views.py:2753 +#: instances/views.py:2758 #, python-format msgid "The machine type is q35, not %(machine)s: UEFI Secure Boot needs it" msgstr "机器类型为 q35,而不是 %(machine)s:UEFI 安全启动需要它" -#: instances/views.py:2782 +#: instances/views.py:2787 msgid "Flavor Created" msgstr "规格已创建" -#: instances/views.py:2790 +#: instances/views.py:2795 msgid "Create Flavor" msgstr "创建规格" -#: instances/views.py:2802 +#: instances/views.py:2807 msgid "Flavor Deleted" msgstr "规格已删除" -#: instances/views.py:2808 +#: instances/views.py:2813 msgid "Only the size template goes; VMs made from it keep their size." msgstr "仅删除此规格;由它创建的虚拟机保持其大小。" @@ -8123,6 +8132,7 @@ msgid "No jobs" msgstr "没有任务" #: operations/templates/operations/jobs.html:59 +#: vmbackups/templates/vmbackups/vm_tab.html:50 msgid "Job" msgstr "任务" @@ -8960,10 +8970,6 @@ msgstr "返回" msgid "Home" msgstr "首页" -#: templates/navbar.html:21 vmbackups/templates/vmbackups/targets.html:17 -msgid "Backups" -msgstr "备份" - #: templates/navbar.html:31 msgid "Administration" msgstr "管理" @@ -9158,6 +9164,83 @@ msgstr "计算节点" msgid "A backup target with this name exists" msgstr "已存在同名的备份目标" +#: vmbackups/jobs.py:46 +#, python-format +msgid "Backup target %(target)s has no storage pool on %(compute)s" +msgstr "备份目标 %(target)s 在 %(compute)s 上没有存储池" + +#: vmbackups/jobs.py:56 +msgid "The VM must be running, paused or shut off to be backed up" +msgstr "虚拟机必须处于运行、暂停或关闭状态才能备份" + +#: vmbackups/jobs.py:60 +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:62 +msgid "A paused VM's file systems cannot be frozen" +msgstr "无法冻结已暂停虚拟机的文件系统" + +#: vmbackups/jobs.py:64 +msgid "The guest agent does not answer: the file systems cannot be frozen" +msgstr "客户机代理没有响应:无法冻结文件系统" + +#: vmbackups/jobs.py:114 +msgid "" +"The VM's NVRAM file changed while it was backed up; back the VM up again" +msgstr "虚拟机的 NVRAM 文件在备份期间发生了变化;请重新备份该虚拟机" + +#: vmbackups/jobs.py:175 +msgid "Back up VM" +msgstr "备份虚拟机" + +#: vmbackups/jobs.py:226 vmbackups/jobs.py:293 +msgid "Writing the backup's files" +msgstr "正在写入备份文件" + +#: vmbackups/jobs.py:305 +msgid "The guest's file systems could not be thawed; trying again" +msgstr "无法解冻客户机的文件系统;正在重试" + +#: vmbackups/jobs.py:354 +#, 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:371 +#, 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:381 +#, 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:387 +#, 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:395 +msgid "The job stopped before the copy ended" +msgstr "作业在复制结束前停止" + +#: vmbackups/jobs.py:402 +#, python-format +msgid "The backup's files could not be written: %(error)s" +msgstr "无法写入备份文件:%(error)s" + #: vmbackups/templates/vmbackups/target.html:6 #: vmbackups/templates/vmbackups/target.html:8 #: vmbackups/templates/vmbackups/targets.html:6 @@ -9221,32 +9304,88 @@ msgstr "还没有备份目标。" msgid "Add a backup target" msgstr "添加备份目标" -#: vmbackups/utils.py:25 +#: vmbackups/templates/vmbackups/vm_tab.html:10 +#: vmbackups/templates/vmbackups/vm_tab.html:25 +msgid "Back up now" +msgstr "立即备份" + +#: vmbackups/templates/vmbackups/vm_tab.html:13 +msgid "Backup target" +msgstr "备份目标" + +#: vmbackups/templates/vmbackups/vm_tab.html:21 +msgid "Require frozen file systems" +msgstr "要求冻结文件系统" + +#: vmbackups/templates/vmbackups/vm_tab.html:28 +msgid "" +"A running VM keeps running: its disks are copied from one instant, its file " +"systems frozen for that instant when the guest agent answers, otherwise the " +"backup is crash-consistent. Memory is not kept." +msgstr "运行中的虚拟机会继续运行:其磁盘从同一时刻复制;客户机代理响应时,文件系统在该时刻被冻结,否则备份为崩溃一致。不保存内存。" + +#: vmbackups/templates/vmbackups/vm_tab.html:36 +msgid "Time" +msgstr "时间" + +#: vmbackups/templates/vmbackups/vm_tab.html:36 +msgid "Target" +msgstr "目标" + +#: vmbackups/templates/vmbackups/vm_tab.html:36 +msgid "Consistency" +msgstr "一致性" + +#: vmbackups/templates/vmbackups/vm_tab.html:46 +msgid "Ready" +msgstr "就绪" + +#: vmbackups/templates/vmbackups/vm_tab.html:47 +msgid "Creating" +msgstr "正在创建" + +#: vmbackups/templates/vmbackups/vm_tab.html:48 +msgid "Deleting" +msgstr "正在删除" + +#: vmbackups/templates/vmbackups/vm_tab.html:58 +msgid "No backup of this VM yet." +msgstr "此虚拟机还没有备份。" + +#: vmbackups/utils.py:27 #, python-format msgid "" "Volume %(volume)s belongs to a backup of %(vm)s; delete the backup on the " "Backups page" msgstr "卷 %(volume)s 属于 %(vm)s 的备份;请在备份页面删除该备份" -#: vmbackups/utils.py:35 +#: vmbackups/utils.py:37 #, python-format msgid "" "Storage pool %(pool)s is backup target %(target)s; remove it from the target " "first" msgstr "存储池 %(pool)s 是备份目标 %(target)s;请先将其从目标中移除" -#: vmbackups/views.py:61 vmbackups/views.py:69 +#: vmbackups/utils.py:49 +msgid "No backup target has a storage pool on this VM's host." +msgstr "没有备份目标在此虚拟机的主机上有存储池。" + +#: vmbackups/views.py:67 vmbackups/views.py:75 #, python-format msgid "Backup target %(target)s has backups; delete them first" msgstr "备份目标 %(target)s 中有备份;请先删除它们" -#: vmbackups/views.py:86 +#: vmbackups/views.py:92 #, python-format msgid "" "Storage pool %(pool)s of %(compute)s is not the same directory as storage " "pool %(other)s of %(other_compute)s" msgstr "%(compute)s 的存储池 %(pool)s 与 %(other_compute)s 的存储池 %(other)s 不是同一目录" +#: vmbackups/views.py:124 +msgid "Choose a backup target" +msgstr "请选择备份目标" + #: vrtManager/backup.py:35 #, python-format msgid "" @@ -9879,106 +10018,106 @@ msgstr "" msgid "Volume %(name)s already exists in storage pool %(pool)s" msgstr "卷 %(name)s 已存在于存储池 %(pool)s 中" -#: vrtManager/instance.py:2888 +#: vrtManager/instance.py:2899 msgid "A network interface that is a host device is removed in the XML editor" msgstr "作为主机设备的网络接口需在 XML 编辑器中删除" -#: vrtManager/instance.py:2904 +#: vrtManager/instance.py:2915 #, python-format msgid "No network interface with MAC %(old_mac)s" msgstr "没有 MAC 为 %(old_mac)s 的网络接口" -#: vrtManager/instance.py:2907 +#: vrtManager/instance.py:2918 msgid "A network interface that is a host device is changed in the XML editor" msgstr "作为主机设备的网络接口需在 XML 编辑器中修改" -#: vrtManager/instance.py:3001 +#: vrtManager/instance.py:3012 msgid "" "A VM changes its PCI devices while it runs, or is shut off without a saved " "state" msgstr "虚拟机只能在运行时或无保存的状态的关机时更改其 PCI 设备" -#: vrtManager/instance.py:3022 +#: vrtManager/instance.py:3033 #, python-format msgid "%(err)s; whether the VM has %(device)s now is not known" msgstr "%(err)s;虚拟机现在是否有 %(device)s 未知" -#: vrtManager/instance.py:3024 +#: vrtManager/instance.py:3035 #, 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:3025 +#: vrtManager/instance.py:3036 #, 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:3026 +#: vrtManager/instance.py:3037 #, 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:3027 +#: vrtManager/instance.py:3038 #, 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:3028 +#: vrtManager/instance.py:3039 #, 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:3030 +#: vrtManager/instance.py:3041 #, 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:3064 +#: vrtManager/instance.py:3075 #, python-format msgid "The VM has no PCI device %(address)s" msgstr "虚拟机没有 PCI 设备 %(address)s" -#: vrtManager/instance.py:3085 +#: vrtManager/instance.py:3096 msgid "The VM has no USB controller" msgstr "虚拟机没有 USB 控制器" -#: vrtManager/instance.py:3119 +#: vrtManager/instance.py:3130 msgid "The VM has no such USB device" msgstr "虚拟机没有此 USB 设备" -#: vrtManager/instance.py:3133 +#: vrtManager/instance.py:3144 #, python-format msgid "The VM has no network interface %(mac)s" msgstr "虚拟机没有网络接口 %(mac)s" -#: vrtManager/instance.py:3164 +#: vrtManager/instance.py:3175 msgid "The VM has its own RNG device: change it in the XML editor" msgstr "虚拟机有自己的 RNG 设备:请在 XML 编辑器中修改" -#: vrtManager/instance.py:3191 +#: vrtManager/instance.py:3202 msgid "The VM has its own TPM: change it in the XML editor" msgstr "虚拟机有自己的 TPM:请在 XML 编辑器中修改" -#: vrtManager/instance.py:3210 +#: vrtManager/instance.py:3221 #, python-format msgid "Unknown crash action %(action)s" msgstr "未知的崩溃操作 %(action)s" -#: vrtManager/instance.py:3237 +#: vrtManager/instance.py:3248 #, python-format msgid "Network interface %(mac)s is not in the definition" msgstr "网络接口 %(mac)s 不在定义中" -#: vrtManager/instance.py:3328 +#: vrtManager/instance.py:3339 msgid "The guest agent did not answer in time; nothing was changed" msgstr "客户机代理未及时响应;未做任何更改" -#: vrtManager/instance.py:3331 +#: vrtManager/instance.py:3342 msgid "The VM runs Windows: its guest agent sets no root password or SSH key" msgstr "该虚拟机运行 Windows:其客户机代理不能设置 root 密码或 SSH 密钥" diff --git a/vmbackups/api.py b/vmbackups/api.py new file mode 100644 index 00000000..20449b04 --- /dev/null +++ b/vmbackups/api.py @@ -0,0 +1,32 @@ +from django.urls import reverse +from drf_spectacular.utils import extend_schema +from rest_framework import mixins, status, viewsets +from rest_framework.response import Response + +from admin.permissions import IsSuperUser +from operations import jobs +from operations.api.serializers import OperationSerializer +from webvirtcloud.serializers import ErrorSerializer + +from .models import Backup +from .serializers import BackupSerializer, CreateBackupSerializer + + +class BackupViewSet(mixins.ListModelMixin, mixins.RetrieveModelMixin, viewsets.GenericViewSet): + """VM backups: list, read, and back a VM up (a job, answered 202).""" + + permission_classes = [IsSuperUser] + serializer_class = BackupSerializer + queryset = Backup.objects.select_related("target").prefetch_related("files") + lookup_field = "uuid" + + @extend_schema(request=CreateBackupSerializer, responses={202: OperationSerializer, 400: dict, 409: ErrorSerializer}) + def create(self, request): + serializer = CreateBackupSerializer(data=request.data) + if not serializer.is_valid(): + return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) + data = serializer.validated_data + raw = {"instance": data["instance"].pk, "target": data["target"].pk, "frozen": data["frozen"]} + op = jobs.submit("backup.create", request.user, raw, data["submission_key"]) + return Response(OperationSerializer(op, context={"request": request}).data, status=status.HTTP_202_ACCEPTED, + headers={"Location": reverse("operation-detail", args=[op.pk])}) diff --git a/vmbackups/jobs.py b/vmbackups/jobs.py new file mode 100644 index 00000000..4a55666a --- /dev/null +++ b/vmbackups/jobs.py @@ -0,0 +1,409 @@ +"""Jobs of the vmbackups app (operations framework).""" + +import hashlib +import json +import time +from uuid import uuid4 + +from django.core.exceptions import PermissionDenied +from django.db import transaction +from django.utils import timezone +from django.utils.translation import gettext_noop as _ +from libvirt import VIR_DOMAIN_PAUSED, VIR_DOMAIN_RUNNING, VIR_DOMAIN_SHUTOFF, VIR_ERR_NO_DOMAIN, libvirtError + +from appsettings.settings import app_settings +from instances.jobs import PAUSED_FROZEN, THAW_FAILED, _instance, _log, _snapshot_free_space +from instances.models import Instance +from operations import claims +from operations.jobs import Cancelled, Kind, Outcome, Plan, register +from operations.models import Claim, Operation +from operations.utils import safe_text, say +from vrtManager import util +from vrtManager.backup import backup_file_names, check_target_space, put_file, remove_files, target_pool, wvmBackup +from vrtManager.instance import LIVE_CLONE_MIN_LIBVIRT + +from .models import Backup, BackupFile, BackupTarget + +MANIFEST_FORMAT = 1 +NVRAM_READS = 3 # a running VM's NVRAM read after its backup, until it is the one read before +NVRAM_WAIT = 5 # seconds between those reads +PROGRESS_EVERY = 2 # seconds between reads of a push backup's progress + + +def _superuser(user): + if user is None or not user.is_active or not user.is_superuser: + raise PermissionDenied + + +def _proxy(instance): + c = instance.compute + return wvmBackup(c.hostname, c.login, c.password, c.type, instance.name, uuid=instance.uuid) + + +def _target_row(target, compute): + row = target.pool_on(compute) + if row is None: + raise util.OperationError(_("Backup target %(target)s has no storage pool on %(compute)s"), + target=target.name, compute=compute.name) + return row + + +def _check_state(proxy, frozen): + """A running, paused or shut-off VM is backed up; frozen file systems + only when its guest agent answers.""" + status = proxy.get_status() + if status not in (VIR_DOMAIN_RUNNING, VIR_DOMAIN_PAUSED, VIR_DOMAIN_SHUTOFF): + raise util.OperationError(_("The VM must be running, paused or shut off to be backed up")) + if status == VIR_DOMAIN_SHUTOFF: + return + if proxy.wvm.getLibVersion() < LIVE_CLONE_MIN_LIBVIRT: + raise util.OperationError(_("A running VM's backup needs libvirt 11.10 or later; shut the VM down to back it up")) + if frozen and status == VIR_DOMAIN_PAUSED: + raise util.OperationError(_("A paused VM's file systems cannot be frozen")) + if frozen and not proxy.is_agent_ready(): + raise util.OperationError(_("The guest agent does not answer: the file systems cannot be 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"]) + 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()) + return instance, target, row, proxy, pool, plan + + +def _free_space(): + values = _snapshot_free_space() + return {"free_percent": values.get("free_percent", 10), "free_min_gib": values.get("free_min_gib", 1)} + + +def _owner(): + return int(app_settings.INSTANCE_VOLUME_DEFAULT_OWNER_UID), int(app_settings.INSTANCE_VOLUME_DEFAULT_OWNER_GID) + + +def _all_names(names): + return [*names["disks"].values(), *(n for n in (names["nvram"], names["domain"], names["manifest"]) if n)] + + +def _nvram(op, proxy): + """The NVRAM file's bytes, or None when the VM has none or never + started. A running VM's is kept only when it is the one read before its + backup began: the guest did not write it across the capture point.""" + path = op.intent["plan"]["nvram"] + if not path: + return None + before = op.intent.get("nvram_before") + data = proxy.read_nvram(path) + if not op.intent["live"]: + return data + for attempt in range(NVRAM_READS): + if attempt: + time.sleep(NVRAM_WAIT) + data = proxy.read_nvram(path) + if (hashlib.sha256(data).hexdigest() if data is not None else None) == before: + return data + raise util.OperationError(_("The VM's NVRAM file changed while it was backed up; back the VM up again")) + + +def _publish(op, proxy, pool): + """The copied disks are complete: the NVRAM file, the definition and the + manifest written and read back, then the row ready with its files. + Runs again in recovery: each upload replaces its volume.""" + plan, names = op.intent["plan"], op.intent["names"] + backup = Backup.objects.get(uuid=op.intent["backup"]) + pool.refresh(0) + files = [] + for disk in plan["disks"]: + size = pool.storageVolLookupByName(names["disks"][disk["dev"]]).info()[2] + files.append({"role": BackupFile.DISK, "dev": disk["dev"], "volume": names["disks"][disk["dev"]], + "format": disk["format"], "capacity": disk["capacity"], "size": size, "sha256": ""}) + nvram = _nvram(op, proxy) + if nvram is not None: + files.append({"role": BackupFile.NVRAM, "dev": "", "volume": names["nvram"], "format": "raw", + "capacity": len(nvram), "size": len(nvram), "sha256": put_file(proxy, pool, names["nvram"], nvram, _owner())}) + definition = plan["definition"].encode() + files.append({"role": BackupFile.DOMAIN, "dev": "", "volume": names["domain"], "format": "", "capacity": len(definition), + "size": len(definition), "sha256": put_file(proxy, pool, names["domain"], definition, _owner())}) + manifest = { + "format": MANIFEST_FORMAT, + "backup": str(backup.uuid), + "vm": {"name": backup.vm_name, "uuid": backup.vm_uuid}, + "compute": backup.compute_name, + "created_at": backup.created_at.isoformat(), + "consistency": op.intent["consistency"], + "nvram": "copied" if nvram is not None else ("never written" if plan["nvram"] else "none"), + "files": files, + "left_out": plan["left_out"], + "libvirt": proxy.wvm.getLibVersion(), + "hypervisor": proxy.wvm.getVersion(), + } + data = json.dumps(manifest, indent=2, sort_keys=True).encode() + put_file(proxy, pool, names["manifest"], data, _owner()) + with transaction.atomic(): + backup.files.all().delete() + BackupFile.objects.bulk_create(BackupFile(backup=backup, **f) for f in files) + backup.manifest = manifest + backup.consistency = op.intent["consistency"] + backup.size = sum(f["size"] for f in files) + len(data) + backup.state = Backup.READY + backup.finished_at = timezone.now() + backup.save() + return {"backup": str(backup.uuid)} + + +def _discard(op, pool): + """The job's files removed, its row failed.""" + remove_files(pool, _all_names(op.intent["names"])) + Backup.objects.filter(uuid=op.intent["backup"]).update(state=Backup.FAILED, finished_at=timezone.now()) + + +@register +class CreateBackup(Kind): + """A shut-off VM's disks are copied one at a time; a running or paused + VM's with libvirt's push backup, from one instant (the live clone's).""" + + name = "backup.create" + label = _("Back up VM") + cancellable = True # libvirt aborts a push backup; an offline copy stops before its next disk + progress_bytes = True + + def normalize(self, raw): + return {"instance": int(raw["instance"]), "target": int(raw["target"]), + "frozen": str(raw.get("frozen", "")).lower() in ("1", "true", "on")} + + def plan(self, user, params): + _superuser(user) + instance = _instance(params["instance"]) + target = BackupTarget.objects.get(pk=params["target"]) + _target_row(target, instance.compute) + proxy = _proxy(instance) + 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}, + resource=claims.instance_key(instance.uuid), + label=f"{instance.compute.name}/{instance.name}", + intent={"compute": instance.compute_id, "uuid": instance.uuid, "backup": str(uuid4()), + "target": target.name}, + ) + + def run(self, op, ctx): + instance, target, row, proxy, pool, plan = _checked(op) + status = proxy.get_status() + live = status != VIR_DOMAIN_SHUTOFF + names = backup_file_names(op.intent["backup"], plan["disks"], bool(plan["nvram"])) + ctx.record_intent(live=live, plan=plan, names=names, pool=row.pool, pool_uuid=row.pool_uuid, + consistency=Backup.OFFLINE if not live else Backup.CRASH) + 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) + ctx.set_phase(_("Copying disks")) + if live: + return self._run_live(op, ctx, proxy, pool, status) + try: + for disk in plan["disks"]: + op.refresh_from_db(fields=["cancel_requested"]) + if op.cancel_requested: + _discard(op, pool) + raise Cancelled + ctx.record_intent(copying=disk["dev"]) + proxy.copy_disk_offline(disk, row.pool, names["disks"][disk["dev"]], *_owner()) + ctx.record_intent(copied=[*op.intent.get("copied", []), disk["dev"]], copying=None) + except libvirtError as err: # libvirt answered: the copy failed and ended + ctx.record_intent(copy_result=[False, safe_text(err)], copying=None) + raise + ctx.record_intent(copy_result=[True, ""]) + ctx.set_phase(_("Writing the backup's files")) + return _publish(op, proxy, pool) + + def _run_live(self, op, ctx, proxy, pool, status): + plan, names = op.intent["plan"], op.intent["names"] + if plan["nvram"]: + data = proxy.read_nvram(plan["nvram"]) + ctx.record_intent(nvram_before=hashlib.sha256(data).hexdigest() if data is not None else None) + ctx.record_intent(made=True) + targets = proxy.make_live_targets(plan["disks"], op.intent["pool"], names["disks"], *_owner()) + ctx.record_intent(paths=[t["path"] for t in targets]) + # a completed result libvirt still holds is of an earlier job + proxy.discard_backup_result() + ctx.record_intent(copy_started=True) + op.refresh_from_db(fields=["cancel_requested"]) + if op.cancel_requested: + _discard(op, pool) + raise Cancelled + + # a required freeze is tried even when the agent seems gone: its failure then fails the backup + freeze = status == VIR_DOMAIN_RUNNING and (op.params["frozen"] or proxy.is_agent_ready()) + thaw_error = None + try: + try: + if freeze: + ctx.record_intent(frozen=True) + try: + proxy.fs_freeze() + except libvirtError: + if op.params["frozen"]: + raise + # crash-consistent, as without an agent; a freeze that failed part way may have + # frozen some file systems: frozen stays recorded, so the guest is thawed as frozen + else: + ctx.record_intent(consistency=Backup.FROZEN) + proxy.begin_clone_backup(targets) + finally: + if op.intent.get("frozen"): + thaw_error = self._thaw(op, ctx, proxy) + except libvirtError as err: + # no backup of ours runs: the copy failed (if this read fails, recovery decides) + if proxy.backup_targets() != set(op.intent["paths"]): + ctx.record_intent(copy_result=[False, safe_text(err)]) + raise + op.refresh_from_db(fields=["cancel_requested"]) + if op.cancel_requested: # the cancel hook may have run before the backup began + try: + self.cancel(op) + except libvirtError: + pass # the hook aborted it, or it ended: its result tells + + while proxy.backup_progress() is not None: + if thaw_error: # the guest must not stay frozen for the copy: tried at each look + thaw_error = self._thaw(op, ctx, proxy) + time.sleep(PROGRESS_EVERY) + if thaw_error: + thaw_error = self._thaw(op, ctx, proxy) + result = proxy.backup_result() + ctx.record_intent(copy_result=[result[0], safe_text(result[1] or "")] if result else None) + if result is None: + raise util.OperationError(_("libvirt has no result of the copy")) # recovery decides + if not result[0]: + _discard(op, pool) + op.refresh_from_db(fields=["cancel_requested"]) + if op.cancel_requested: + raise Cancelled + raise util.OperationError(result[1] or _("The copy failed")) + ctx.set_phase(_("Writing the backup's files")) + done = _publish(op, proxy, pool) + if thaw_error: # the backup is ready; recovery keeps trying to thaw the guest + raise util.OperationError(THAW_FAILED, error=thaw_error, vm=op.resource_label.rpartition("/")[2]) + return done + + @staticmethod + def _thaw(op, ctx, proxy): + """Thaws the guest; its error, or None once thawed.""" + try: + proxy.fs_thaw() + except libvirtError as err: # frozen stays recorded + ctx.set_phase(_("The guest's file systems could not be thawed; trying again")) + return err + ctx.record_intent(frozen=False) + return None + + def progress(self, op): + if op.intent.get("live"): + return _proxy(_instance(op.params["instance"])).backup_progress() if op.intent.get("copy_started") else None + disks = op.intent.get("plan", {}).get("disks", []) + copied = set(op.intent.get("copied", [])) + return sum(d["capacity"] for d in disks if d["dev"] in copied), sum(d["capacity"] for d in disks) + + def cancel(self, op): + # an offline copy stops before its next disk (run checks the request) + if not op.intent.get("live"): + return + proxy = _proxy(_instance(op.params["instance"])) + paths = set(op.intent.get("paths", [])) + if paths and proxy.backup_targets() == paths: + proxy.abort_backup() + + def reconcile(self, op): + backup = Backup.objects.filter(uuid=op.intent["backup"]).first() + if backup is None: # the row comes before any file + return Outcome(Operation.FAILED, error=say(_("The job stopped before the copy started"))) + instance = Instance.objects.select_related("compute").filter(pk=op.params["instance"]).first() + ended = Operation.CANCELLED if op.cancel_requested else Operation.FAILED + names = ", ".join(_all_names(op.intent["names"])) + proxy = None + if instance is not None and instance.compute_id == op.intent["compute"]: + try: + proxy = _proxy(instance) + except libvirtError as err: + if err.get_error_code() != VIR_ERR_NO_DOMAIN: + raise # unreachable: recovery waits and retries + + thawed = [] + if op.intent.get("frozen") and proxy is not None: # thawed first, before anything else + status = proxy.get_status() + if status == VIR_DOMAIN_RUNNING: + proxy.fs_thaw() # a failure raises: recovery waits and tries again + elif status == VIR_DOMAIN_PAUSED: # libvirt thaws no paused guest + thawed = say(PAUSED_FROZEN, vm=op.resource_label.rpartition("/")[2]) + if backup.state == Backup.READY: + return Outcome(Operation.SUCCEEDED, result={"backup": str(backup.uuid), **({"warning": thawed} if thawed else {})}) + + if proxy is None: + Backup.objects.filter(pk=backup.pk).update(state=Backup.FAILED, finished_at=timezone.now()) + return Outcome(Operation.UNCERTAIN, error=say(_( + "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"), volumes=names)) + # after the thaw: an unreachable target must not keep a guest frozen + pool = target_pool(proxy, op.intent["pool"], op.intent["pool_uuid"]) + outcome = self._outcome(op, proxy, pool, ended, names) + if outcome.state == Operation.SUCCEEDED and thawed: + outcome.result["warning"] = thawed + else: + outcome.error += thawed + return outcome + + def _outcome(self, op, proxy, pool, ended, names): + result = op.intent.get("copy_result") + if not op.intent["live"]: + if result is None and op.intent.get("copying"): + Backup.objects.filter(uuid=op.intent["backup"]).update(state=Backup.FAILED, finished_at=timezone.now()) + return Outcome(Operation.UNCERTAIN, error=say(_( + "A disk was being copied when the job stopped; check these volumes of the backup target, then " + "resolve this job: %(volumes)s"), volumes=names)) + elif op.intent.get("copy_started") and result is None: + targets = proxy.backup_targets() + paths = set(op.intent["paths"]) + if targets == paths: + return Outcome(Operation.RUNNING, phase=_("libvirt is still copying the disks"), + progress=proxy.backup_progress()) + if targets is not None: + return Outcome(Operation.UNCERTAIN, error=say(_( + "Another backup runs on the VM; check these volumes of the backup target, then resolve this " + "job: %(volumes)s"), volumes=names)) + result = proxy.backup_result() + if result is None: + Backup.objects.filter(uuid=op.intent["backup"]).update(state=Backup.FAILED, finished_at=timezone.now()) + return Outcome(Operation.UNCERTAIN, error=say(_( + "libvirt has no result of the copy; check these volumes of the backup target, then resolve this " + "job: %(volumes)s"), volumes=names)) + elif op.intent.get("made") and not op.intent.get("paths"): + # the push backup's volumes were being made: they are named from the backup, so removed by name + result = [False, ""] + if result is None or not result[0]: + _discard(op, pool) + return Outcome(ended, error=say(result[1]) if result and result[1] else + say(_("The job stopped before the copy ended"))) + try: + return Outcome(Operation.SUCCEEDED, result=_publish(op, proxy, pool)) + except util.ConnectionFailed: + raise # unreachable: recovery waits and retries + except libvirtError as err: # it would fail the same way at every retry + _discard(op, pool) + return Outcome(Operation.FAILED, error=say(_("The backup's files could not be written: %(error)s"), error=err)) + + def log_entry(self, op, state): + if state == Operation.SUCCEEDED: + action = f"backed up to {op.intent['target']} ({op.intent.get('consistency', '')})" + else: + action = f"back up to {op.intent['target']}" + return _log(op, state, action) diff --git a/vmbackups/serializers.py b/vmbackups/serializers.py new file mode 100644 index 00000000..7b82b58b --- /dev/null +++ b/vmbackups/serializers.py @@ -0,0 +1,29 @@ +from rest_framework import serializers + +from instances.models import Instance + +from .models import Backup, BackupFile, BackupTarget + + +class BackupFileSerializer(serializers.ModelSerializer): + class Meta: + model = BackupFile + fields = ["role", "dev", "volume", "format", "capacity", "size", "sha256"] + + +class BackupSerializer(serializers.ModelSerializer): + target = serializers.SlugRelatedField(slug_field="name", read_only=True) + files = BackupFileSerializer(many=True, read_only=True) + + class Meta: + model = Backup + fields = ["uuid", "target", "instance", "vm_uuid", "vm_name", "compute_name", "created_at", "finished_at", + "state", "consistency", "size", "files", "operation"] + read_only_fields = fields + + +class CreateBackupSerializer(serializers.Serializer): + instance = serializers.PrimaryKeyRelatedField(queryset=Instance.objects.all()) + target = serializers.PrimaryKeyRelatedField(queryset=BackupTarget.objects.all()) + frozen = serializers.BooleanField(default=False) + submission_key = serializers.CharField(write_only=True) diff --git a/vmbackups/templates/vmbackups/vm_tab.html b/vmbackups/templates/vmbackups/vm_tab.html new file mode 100644 index 00000000..96d6fb0f --- /dev/null +++ b/vmbackups/templates/vmbackups/vm_tab.html @@ -0,0 +1,62 @@ +{% load i18n %} +{% load operations %} +{% load bootstrap_icons %} +
+
+
+ {% if backups.problem %} +
{% bs_icon 'exclamation-triangle' %} {{ backups.problem }}
+ {% else %} +
{% csrf_token %}{% submission_key %} +
+
+ + +
+
+
+ + +
+
+
+ +
+
+

{% blocktrans %}A running VM keeps running: its disks are copied from one instant, its file systems frozen for that instant when the guest agent answers, otherwise the backup is crash-consistent. Memory is not kept.{% endblocktrans %}

+
+ {% endif %} + + {% if backups.rows %} +
+ + + + + + {% for backup in backups.rows %} + + + + + + + + {% endfor %} + +
{% trans "Time" %}{% trans "Target" %}{% trans "Consistency" %}{% trans "Size" %}{% trans "State" %}
{{ backup.created_at|date:"Y-m-d H:i" }}{{ backup.target.name }}{{ backup.get_consistency_display }}{% if backup.size %}{{ backup.size|filesizeformat }}{% else %}–{% endif %} + {% if backup.state == "ready" %}{% trans "Ready" %} + {% elif backup.state == "creating" %}{% trans "Creating" %} + {% elif backup.state == "deleting" %}{% trans "Deleting" %} + {% else %}{% trans "Failed" %}{% endif %} + {% if backup.operation_id %}{% trans "Job" %}{% endif %} +
+
+ {% else %} +

{% trans "No backup of this VM yet." %}

+ {% endif %} +
+
+
diff --git a/vmbackups/tests/test_create.py b/vmbackups/tests/test_create.py new file mode 100644 index 00000000..52eaf911 --- /dev/null +++ b/vmbackups/tests/test_create.py @@ -0,0 +1,440 @@ +"""backup.create: a VM backed up into a target, offline or live, published +last with its manifest, recovered from where the worker stopped.""" + +import itertools +from types import SimpleNamespace +from unittest.mock import MagicMock, patch +from uuid import uuid4 + +import libvirt +from django.contrib.auth import get_user_model +from django.test import TransactionTestCase +from lxml import html as lxml_html + +from appsettings.settings import get_settings +from computes.models import Compute +from instances.models import Instance +from instances.tests.test_page_controls import PageControls +from operations import jobs +from operations.jobs import Cancelled, Context +from operations.models import Operation, acquire +from vmbackups.jobs import CreateBackup, _owner +from vmbackups.models import Backup, BackupFile, BackupTarget, BackupTargetPool +from vrtManager.util import OperationError + +GIB = 1024**3 +WORKER = "wvc-test:1:a" +NVRAM = "/var/lib/libvirt/qemu/nvram/vm1_VARS.fd" + + +def libvirt_error(text="x"): + return libvirt.libvirtError(text) + + +def plan(nvram=None): + return { + "definition": "vm1", + "disks": [{"dev": "vda", "path": "/pool/a.qcow2", "pool": "default", "format": "qcow2", "capacity": GIB}], + "nvram": nvram, + "left_out": [{"dev": "sda", "why": "CD-ROM: not copied"}], + } + + +def proxy(status=libvirt.VIR_DOMAIN_SHUTOFF, nvram=None): + p = MagicMock() + p.get_status.return_value = status + p.backup_plan.return_value = plan(nvram) + p.wvm.getLibVersion.return_value = 11_010_000 + p.wvm.getVersion.return_value = 10_001_000 + p.is_agent_ready.return_value = True + p.make_live_targets.side_effect = lambda disks, pool, names, uid, gid: [ + {"dev": d["dev"], "path": f"/b1/{names[d['dev']]}", "format": d["format"]} for d in disks] + p.backup_targets.return_value = None + p.backup_progress.return_value = None + p.backup_result.return_value = (True, "") + p.read_nvram.return_value = b"vars" + return p + + +def target_pool(): + pool = MagicMock() + pool.name.return_value = "b1" + pool.info.return_value = [2, 100 * GIB, 0, 100 * GIB] + pool.storageVolLookupByName.return_value.info.return_value = [0, GIB, GIB // 2] + return pool + + +class CreateBackupTests(TransactionTestCase): + def setUp(self): + get_settings() + self.admin = get_user_model().objects.create_superuser("bk_admin", "a@example.com", "pw") + self.compute = Compute.objects.create(name="h1", hostname="192.0.2.21", login="u", password="p", type=1) + self.vm = Instance.objects.create(compute=self.compute, name="vm1", uuid="21212121-0000-4000-8000-000000000001") + self.target = BackupTarget.objects.create(name="nfs1") + BackupTargetPool.objects.create(target=self.target, compute=self.compute, pool="b1", pool_uuid="pool-uuid") + self.proxy = proxy() + self.pool = target_pool() + self.written = [] + self.removed = [] + 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(side_effect=lambda conn, pool, n, data, owner: self.written.append(n) or "sha")), + ("vmbackups.jobs.remove_files", MagicMock(side_effect=lambda pool, names: self.removed.extend(names))), + ("vmbackups.jobs.NVRAM_WAIT", 0), + ("vmbackups.jobs.PROGRESS_EVERY", 0), + ): + patcher = patch(name, value) + patcher.start() + self.addCleanup(patcher.stop) + + def submit(self, frozen=False): + op = jobs.submit("backup.create", self.admin, {"instance": self.vm.pk, "target": self.target.pk, "frozen": frozen}, + 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 run_job(self, op): + return CreateBackup().run(op, Context(op, SimpleNamespace(identity=WORKER))) + + def interrupted(self, op, error=None): + """run stops where the test makes libvirt fail; the intent it recorded stays.""" + with self.assertRaises(Exception): + self.run_job(op) + op.refresh_from_db() + return op + + def backup(self, op): + return Backup.objects.get(uuid=op.intent["backup"]) + + def test_a_shut_off_vm_is_copied_offline(self): + op = self.submit() + self.assertEqual(self.run_job(op), {"backup": op.intent["backup"]}) + prefix = f"wvc-{op.intent['backup']}" + self.proxy.copy_disk_offline.assert_called_once_with(plan()["disks"][0], "b1", f"{prefix}-vda.qcow2", *_owner()) + self.proxy.begin_clone_backup.assert_not_called() + self.assertEqual(self.written, [f"{prefix}-domain.xml", f"{prefix}-manifest.json"]) # the manifest last + backup = self.backup(op) + self.assertEqual((backup.state, backup.consistency, backup.instance), (Backup.READY, Backup.OFFLINE, self.vm)) + files = {f.role: f for f in backup.files.all()} + self.assertEqual(set(files), {BackupFile.DISK, BackupFile.DOMAIN}) + self.assertEqual((files["disk"].dev, files["disk"].capacity, files["disk"].size), ("vda", GIB, GIB // 2)) + self.assertEqual(backup.manifest["left_out"], plan()["left_out"]) + self.assertEqual(backup.manifest["consistency"], "offline") + + def test_a_running_vm_is_frozen_backed_up_and_thawed(self): + self.proxy.get_status.return_value = libvirt.VIR_DOMAIN_RUNNING + op = self.submit() + self.run_job(op) + calls = [c[0] for c in self.proxy.method_calls] + self.assertLess(calls.index("fs_freeze"), calls.index("begin_clone_backup")) + self.assertLess(calls.index("begin_clone_backup"), calls.index("fs_thaw")) + self.assertEqual(self.backup(op).consistency, Backup.FROZEN) + + def test_no_agent_gives_crash_consistency_unless_frozen_is_required(self): + self.proxy.get_status.return_value = libvirt.VIR_DOMAIN_RUNNING + self.proxy.is_agent_ready.return_value = False + op = self.submit() + self.run_job(op) + self.proxy.fs_freeze.assert_not_called() + self.assertEqual(self.backup(op).consistency, Backup.CRASH) + with self.assertRaisesMessage(OperationError, "guest agent does not answer"): + self.submit(frozen=True) + + def test_a_failed_freeze_goes_on_crash_consistent_unless_required(self): + self.proxy.get_status.return_value = libvirt.VIR_DOMAIN_RUNNING + self.proxy.fs_freeze.side_effect = libvirt_error("agent timeout") + op = self.submit() + self.run_job(op) + self.assertEqual(self.backup(op).consistency, Backup.CRASH) + jobs.finish(op, jobs.Outcome(Operation.SUCCEEDED)) + op = self.submit(frozen=True) + self.interrupted(op) + self.assertEqual(op.intent["copy_result"], [False, "agent timeout"]) + + def test_frozen_is_refused_for_a_paused_vm(self): + self.proxy.get_status.return_value = libvirt.VIR_DOMAIN_PAUSED + with self.assertRaisesMessage(OperationError, "paused"): + self.submit(frozen=True) + op = self.submit() + self.run_job(op) + self.proxy.fs_freeze.assert_not_called() + self.assertEqual(self.backup(op).consistency, Backup.CRASH) + + def test_a_failed_thaw_is_tried_again_while_the_copy_runs(self): + self.proxy.get_status.return_value = libvirt.VIR_DOMAIN_RUNNING + self.proxy.fs_thaw.side_effect = [libvirt_error("thaw failed"), None] + self.proxy.backup_progress.side_effect = [(1, 2), None] + op = self.submit() + result = self.run_job(op) + self.assertNotIn("warning", result) + self.assertEqual(self.proxy.fs_thaw.call_count, 2) + op.refresh_from_db() + self.assertFalse(op.intent["frozen"]) + + def test_a_thaw_that_keeps_failing_is_left_to_recovery(self): + self.proxy.get_status.return_value = libvirt.VIR_DOMAIN_RUNNING + self.proxy.fs_thaw.side_effect = libvirt_error("thaw failed") + op = self.interrupted(self.submit()) + self.assertEqual(self.backup(op).state, Backup.READY) # the copy is kept + with self.assertRaises(libvirt.libvirtError): # recovery waits and tries again + CreateBackup().reconcile(op) + self.proxy.fs_thaw.side_effect = None + self.assertEqual(CreateBackup().reconcile(op).state, Operation.SUCCEEDED) + + def test_an_optional_freeze_that_failed_is_thawed_until_it_works(self): + # a freeze that failed part way may have frozen some file systems: the guest counts as frozen + self.proxy.get_status.return_value = libvirt.VIR_DOMAIN_RUNNING + self.proxy.fs_freeze.side_effect = libvirt_error("agent timeout") + self.proxy.fs_thaw.side_effect = [libvirt_error("agent busy"), None] + self.proxy.backup_progress.side_effect = [(1, 2), None] + op = self.submit() + result = self.run_job(op) + self.assertNotIn("warning", result) + self.assertEqual(self.proxy.fs_thaw.call_count, 2) + op.refresh_from_db() + self.assertFalse(op.intent["frozen"]) + self.assertEqual(self.backup(op).consistency, Backup.CRASH) + + def test_a_running_vms_nvram_is_kept_when_it_did_not_change(self): + self.proxy.get_status.return_value = libvirt.VIR_DOMAIN_RUNNING + self.proxy.backup_plan.return_value = plan(NVRAM) + self.proxy.read_nvram.side_effect = [b"vars", b"new", b"vars"] # before; after, changed then back + op = self.submit() + self.run_job(op) + self.assertIn(f"wvc-{op.intent['backup']}-nvram.fd", self.written) + self.assertEqual(self.backup(op).manifest["nvram"], "copied") + + def test_nvram_changed_across_the_copy_is_retried_then_refused(self): + self.proxy.get_status.return_value = libvirt.VIR_DOMAIN_RUNNING + self.proxy.backup_plan.return_value = plan(NVRAM) + counter = itertools.count() + self.proxy.read_nvram.side_effect = lambda path: b"vars-%d" % next(counter) + op = self.interrupted(self.submit()) + self.assertEqual(self.proxy.read_nvram.call_count, 4) # before, then three after + outcome = CreateBackup().reconcile(op) + self.assertEqual(outcome.state, Operation.FAILED) + self.assertIn(f"wvc-{op.intent['backup']}-vda.qcow2", self.removed) + self.assertEqual(self.backup(op).state, Backup.FAILED) + + def test_the_guest_shutting_down_does_not_fail_the_backup(self): + self.proxy.get_status.return_value = libvirt.VIR_DOMAIN_RUNNING + + def progress(): + # the guest shuts down: its QEMU stays until the backup ends (PRESERVE_SHUTDOWN_DOMAIN) + self.proxy.get_status.return_value = libvirt.VIR_DOMAIN_SHUTOFF + self.proxy.backup_progress.side_effect = None + return (1, 2) + + self.proxy.backup_progress.side_effect = progress + op = self.submit() + self.run_job(op) + self.assertEqual((self.backup(op).state, self.backup(op).consistency), (Backup.READY, Backup.FROZEN)) + + def test_a_replaced_target_pool_is_refused_before_anything_is_made(self): + op = self.submit() + with patch("vmbackups.jobs.target_pool", side_effect=OperationError("Storage pool %(pool)s is replaced", pool="b1")): + with self.assertRaisesMessage(OperationError, "Storage pool b1"): + self.run_job(op) + op.refresh_from_db() + self.assertFalse(op.effects_started) + self.assertFalse(Backup.objects.exists()) + self.proxy.copy_disk_offline.assert_not_called() + self.proxy.make_live_targets.assert_not_called() + + def test_a_target_without_room_is_refused_before_anything_is_made(self): + self.pool.info.return_value = [2, 100 * GIB, 0, GIB] + op = self.submit() + with self.assertRaisesMessage(OperationError, "the backup needs"): + self.run_job(op) + self.assertFalse(Backup.objects.exists()) + + def test_a_full_target_fails_and_removes_the_volumes(self): + self.proxy.copy_disk_offline.side_effect = libvirt_error("No space left on device") + op = self.interrupted(self.submit()) + outcome = CreateBackup().reconcile(op) + self.assertEqual(outcome.state, Operation.FAILED) + self.assertIn("No space left on device", outcome.error[0]["text"]) + self.assertIn(f"wvc-{op.intent['backup']}-vda.qcow2", self.removed) + self.assertEqual(self.backup(op).state, Backup.FAILED) + + def test_a_failed_push_backup_removes_the_volumes(self): + self.proxy.get_status.return_value = libvirt.VIR_DOMAIN_RUNNING + self.proxy.backup_result.return_value = (False, "No space left on device") + op = self.interrupted(self.submit()) + self.assertIn(f"wvc-{op.intent['backup']}-vda.qcow2", self.removed) + self.assertEqual(CreateBackup().reconcile(op).state, Operation.FAILED) + + def live_interrupted(self): + """A push backup running when the worker stopped.""" + self.proxy.get_status.return_value = libvirt.VIR_DOMAIN_RUNNING + self.proxy.backup_progress.side_effect = libvirt_error("connection lost") + op = self.interrupted(self.submit()) + self.proxy.backup_progress.side_effect = None + return op + + def test_recovery_watches_its_running_backup(self): + op = self.live_interrupted() + self.proxy.backup_targets.return_value = set(op.intent["paths"]) + self.proxy.backup_progress.return_value = (1, 4) + outcome = CreateBackup().reconcile(op) + self.assertEqual((outcome.state, outcome.progress), (Operation.RUNNING, (1, 4))) + self.proxy.backup_targets.return_value = None + self.assertEqual(CreateBackup().reconcile(op).state, Operation.SUCCEEDED) + self.assertEqual(self.backup(op).state, Backup.READY) + + def test_recovery_without_a_result_is_uncertain(self): + op = self.live_interrupted() + self.proxy.backup_result.return_value = None + outcome = CreateBackup().reconcile(op) + self.assertEqual(outcome.state, Operation.UNCERTAIN) + self.assertIn(f"wvc-{op.intent['backup']}-vda.qcow2", outcome.error[0]["values"]["volumes"]) + self.assertEqual(self.removed, []) # the files stay for the administrator + self.assertEqual(self.backup(op).state, Backup.FAILED) + + def test_recovery_thaws_first(self): + self.proxy.fs_thaw.side_effect = libvirt_error("thaw failed") + op = self.live_interrupted() + self.assertTrue(op.intent["frozen"]) + self.proxy.fs_thaw.side_effect = None + self.proxy.method_calls.clear() + self.assertEqual(CreateBackup().reconcile(op).state, Operation.SUCCEEDED) + calls = [c[0] for c in self.proxy.method_calls] + self.assertLess(calls.index("fs_thaw"), calls.index("backup_targets")) + + def test_recovery_thaws_even_when_the_target_pool_is_gone(self): + self.proxy.fs_thaw.side_effect = libvirt_error("thaw failed") + op = self.live_interrupted() + self.proxy.fs_thaw.side_effect = None + self.proxy.fs_thaw.reset_mock() + with patch("vmbackups.jobs.target_pool", side_effect=OperationError("Storage pool %(pool)s is gone", pool="b1")): + with self.assertRaises(OperationError): + CreateBackup().reconcile(op) + self.proxy.fs_thaw.assert_called_once_with() + + def test_a_required_freeze_is_not_skipped_when_the_agent_goes(self): + self.proxy.get_status.return_value = libvirt.VIR_DOMAIN_RUNNING + op = self.submit(frozen=True) + # the run's check finds the agent; it is gone by the freeze + self.proxy.is_agent_ready.side_effect = [True, False] + self.proxy.fs_freeze.side_effect = libvirt_error("agent not connected") + op = self.interrupted(op) + self.proxy.begin_clone_backup.assert_not_called() + self.assertEqual(op.intent["copy_result"], [False, "agent not connected"]) + + def test_a_required_freeze_without_an_agent_at_the_start_makes_nothing(self): + self.proxy.get_status.return_value = libvirt.VIR_DOMAIN_RUNNING + op = self.submit(frozen=True) + self.proxy.is_agent_ready.return_value = False + with self.assertRaisesMessage(OperationError, "guest agent does not answer"): + self.run_job(op) + self.assertFalse(Backup.objects.exists()) + + def test_recovery_of_an_offline_copy_is_uncertain(self): + self.proxy.copy_disk_offline.side_effect = RuntimeError("worker gone") # no answer from libvirt + op = self.interrupted(self.submit()) + outcome = CreateBackup().reconcile(op) + self.assertEqual(outcome.state, Operation.UNCERTAIN) + self.assertEqual(self.removed, []) + + def test_recovery_of_a_ready_backup_succeeds(self): + op = self.submit() + self.run_job(op) + self.assertEqual(CreateBackup().reconcile(op).state, Operation.SUCCEEDED) + + def test_cancel_aborts_then_removes(self): + op = self.live_interrupted() + self.proxy.backup_targets.return_value = set(op.intent["paths"]) + CreateBackup().cancel(op) + self.proxy.abort_backup.assert_called_once_with() + Operation.objects.filter(pk=op.pk).update(cancel_requested=True) + op.refresh_from_db() + self.proxy.backup_targets.return_value = None + self.proxy.backup_result.return_value = (False, "operation aborted") + self.assertEqual(CreateBackup().reconcile(op).state, Operation.CANCELLED) + self.assertIn(f"wvc-{op.intent['backup']}-vda.qcow2", self.removed) + + def test_an_offline_copy_cancelled_stops_before_its_next_disk(self): + op = self.submit() + Operation.objects.filter(pk=op.pk).update(cancel_requested=True) + with self.assertRaises(Cancelled): + self.run_job(op) + self.proxy.copy_disk_offline.assert_not_called() + self.assertEqual(self.backup(op).state, Backup.FAILED) + + def test_progress_counts_the_copied_disks(self): + op = self.submit() + self.run_job(op) + op.refresh_from_db() + self.assertEqual(CreateBackup().progress(op), (GIB, GIB)) + + def test_the_log_names_the_target_and_consistency(self): + op = self.submit() + self.run_job(op) + op.refresh_from_db() + self.assertEqual(CreateBackup().log_entry(op, Operation.SUCCEEDED)[3], "VM vm1: backed up to nfs1 (offline)") + + def test_a_vm_on_a_host_without_the_target_is_refused(self): + other = Compute.objects.create(name="h2", hostname="192.0.2.22", login="u", password="p", type=1) + Instance.objects.filter(pk=self.vm.pk).update(compute=other) + with self.assertRaisesMessage(OperationError, "has no storage pool on h2"): + self.submit() + + +class BackupTabTests(PageControls, TransactionTestCase): + def test_the_tab_lists_backups_and_says_why_not(self): + admin = get_user_model().objects.create_superuser("tab-admin", "a@example.com", "x") + target = BackupTarget.objects.create(name="nfs1") + BackupTargetPool.objects.create(target=target, compute=self.compute, pool="b1", pool_uuid="u") + Backup.objects.create(target=target, instance=self.instance, vm_uuid=self.instance.uuid, vm_name="ctl-vm", + compute_name="ctl-compute", state=Backup.READY, consistency=Backup.FROZEN, size=3 * GIB) + with patch("vmbackups.utils.wvmBackup") as backup_proxy: + self.controls(admin) + page = lxml_html.fromstring(self.last_page) + self.assertTrue(page.xpath("//div[@id='backups']//form[contains(@action, '/backups/vm/')]")) + self.assertIn("nfs1", page.xpath("string(//select[@id='backup-target'])")) + self.assertIn("3.0", page.xpath("string(//div[@id='backups']//table)")) + backup_proxy.return_value.backup_plan.side_effect = OperationError("%(vm)s has TPM state", vm="ctl-vm") + self.controls(admin) + page = lxml_html.fromstring(self.last_page) + self.assertIn("ctl-vm has TPM state", page.xpath("string(//div[@id='backups'])")) + self.assertFalse(page.xpath("//div[@id='backups']//form")) + + def test_owners_have_no_backups_tab(self): + self.controls(self.user("tab-owner", owner={"is_change": True})) + self.assertFalse(lxml_html.fromstring(self.last_page).xpath("//*[@id='backups']")) + + +class BackupApiTests(TransactionTestCase): + def setUp(self): + get_settings() + self.admin = get_user_model().objects.create_superuser("api_admin", "a@example.com", "pw") + self.compute = Compute.objects.create(name="h1", hostname="192.0.2.21", login="u", password="p", type=1) + self.vm = Instance.objects.create(compute=self.compute, name="vm1", uuid="21212121-0000-4000-8000-000000000001") + self.target = BackupTarget.objects.create(name="nfs1") + BackupTargetPool.objects.create(target=self.target, compute=self.compute, pool="b1", pool_uuid="u") + + @patch("vmbackups.jobs.wvmBackup") + def test_api_post_returns_the_job(self, backup_proxy): + backup_proxy.return_value = proxy() + self.client.force_login(self.admin) + response = self.client.post("/api/v1/backups/", {"instance": self.vm.pk, "target": self.target.pk, + "submission_key": "key-api-0001"}, content_type="application/json") + self.assertEqual(response.status_code, 202, response.content) + self.assertEqual(response.json()["kind"], "backup.create") + backup = Backup.objects.create(target=self.target, instance=self.vm, vm_uuid=self.vm.uuid, vm_name="vm1", + compute_name="h1", state=Backup.READY) + listed = self.client.get("/api/v1/backups/").json() + rows = listed["results"] if isinstance(listed, dict) else listed + self.assertEqual([r["uuid"] for r in rows], [str(backup.uuid)]) + self.assertEqual(self.client.get(f"/api/v1/backups/{backup.uuid}/").json()["target"], "nfs1") + + def test_api_is_superuser_only(self): + user = get_user_model().objects.create_user("api_user", password="pw") + self.client.force_login(user) + self.assertEqual(self.client.get("/api/v1/backups/").status_code, 403) + response = self.client.post("/api/v1/backups/", {"instance": self.vm.pk, "target": self.target.pk, + "submission_key": "key-api-0002"}, content_type="application/json") + self.assertEqual(response.status_code, 403) diff --git a/vmbackups/urls.py b/vmbackups/urls.py index ace7f84e..d1918343 100644 --- a/vmbackups/urls.py +++ b/vmbackups/urls.py @@ -7,4 +7,5 @@ app_name = "vmbackups" urlpatterns = [ path("targets/", views.targets, name="targets"), path("targets//", views.target, name="target"), + path("vm//create/", views.create, name="create"), ] diff --git a/vmbackups/utils.py b/vmbackups/utils.py index 6372f248..db34ced6 100644 --- a/vmbackups/utils.py +++ b/vmbackups/utils.py @@ -1,10 +1,12 @@ -from django.utils.translation import gettext_noop +from django.utils.translation import gettext, gettext_noop +from libvirt import libvirtError from lxml import etree from storages.forms import inside +from vrtManager.backup import wvmBackup from vrtManager.util import InUse -from .models import Backup, BackupTargetPool +from .models import Backup, BackupTarget, BackupTargetPool def inside_vm_pool(conn, pool): @@ -36,3 +38,19 @@ def refuse_target_pool(compute, pool): pool=pool, target=row.target.name, ) + + +def vm_tab(instance): + """The VM page's Backups tab: the VM's backups, the targets of its host, + and why it cannot be backed up, if it cannot.""" + targets = list(BackupTarget.objects.filter(pools__compute=instance.compute).order_by("name")) + problem = None + if not targets: + problem = gettext("No backup target has a storage pool on this VM's host.") + else: + c = instance.compute + try: + wvmBackup(c.hostname, c.login, c.password, c.type, instance.name, uuid=instance.uuid).backup_plan() + except libvirtError as err: + problem = str(err) + return {"rows": instance.backups.select_related("target", "operation"), "targets": targets, "problem": problem} diff --git a/vmbackups/views.py b/vmbackups/views.py index 0793fd81..52a79ea8 100644 --- a/vmbackups/views.py +++ b/vmbackups/views.py @@ -2,12 +2,18 @@ from django.contrib import messages from django.db import transaction from django.db.models import Count from django.shortcuts import get_object_or_404, redirect, render +from django.urls import reverse +from django.views.decorators.http import require_POST from django.utils.translation import gettext_lazy as _ from django.utils.translation import gettext_noop from libvirt import libvirtError from admin.decorators import superuser_only +from instances.models import Instance from logs.audit import audit +from operations import claims, jobs +from operations.utils import busy_message +from webvirtcloud.middleware import error_text from vrtManager.backup import pool_space, target_pool from vrtManager.connection import wvmConnect from vrtManager.util import OperationError @@ -99,3 +105,23 @@ def target(request, target_id): pools = [pool_state(row) for row in target.pools.select_related("compute").order_by("compute__name")] return render(request, "vmbackups/target.html", {"target": target, "pools": pools, "form": form, "backup_count": target.backups.count()}) + + +@require_POST +@superuser_only +def create(request, instance_id): + """Back up now, from the VM's Backups tab: a backup.create job.""" + instance = get_object_or_404(Instance, pk=instance_id) + page = reverse("instances:instance", args=[instance.pk]) + "#backups" + raw = {"instance": instance.pk, "target": request.POST.get("target", ""), "frozen": request.POST.get("frozen", "")} + try: + op = jobs.submit("backup.create", request.user, raw, request.POST.get("submission_key", "")) + except claims.Busy as busy: + messages.error(request, busy_message(busy, request.user)) + except (jobs.SubmissionConflict, libvirtError) as err: + messages.error(request, error_text(request, err)) + except (ValueError, BackupTarget.DoesNotExist): + messages.error(request, _("Choose a backup target")) + else: + jobs.remember_job(request, op) + return redirect(page) diff --git a/vrtManager/instance.py b/vrtManager/instance.py index 94aaf375..45d8504e 100644 --- a/vrtManager/instance.py +++ b/vrtManager/instance.py @@ -2764,11 +2764,15 @@ class wvmInstance(wvmConnect): ) def backup_targets(self): - """The target paths of the running backup; None when none runs.""" + """The target paths of the running backup; None when none runs, also + when the domain stopped (a guest that shut down during its backup + stops when the backup ends: PRESERVE_SHUTDOWN_DOMAIN).""" + if not self.instance.isActive(): + return None try: xml = self.instance.backupGetXMLDesc(0) except libvirtError as err: - if err.get_error_code() == VIR_ERR_NO_DOMAIN_BACKUP: + if err.get_error_code() in (VIR_ERR_NO_DOMAIN_BACKUP, VIR_ERR_OPERATION_INVALID): return None raise return set(etree.fromstring(xml).xpath("disks/disk/target/@file")) @@ -2776,7 +2780,14 @@ class wvmInstance(wvmConnect): def backup_progress(self): """(bytes copied, bytes to copy) of the running backup; None when none runs.""" - stats = self.instance.jobStats(0) + if not self.instance.isActive(): + return None + try: + stats = self.instance.jobStats(0) + except libvirtError as err: + if err.get_error_code() == VIR_ERR_OPERATION_INVALID: # stopped since: its backup ended + return None + raise if ( stats.get("type", VIR_DOMAIN_JOB_NONE) == VIR_DOMAIN_JOB_NONE or stats.get("operation") != VIR_DOMAIN_JOB_OPERATION_BACKUP diff --git a/vrtManager/tests/test_live_clone.py b/vrtManager/tests/test_live_clone.py index ccac5ed1..232bd388 100644 --- a/vrtManager/tests/test_live_clone.py +++ b/vrtManager/tests/test_live_clone.py @@ -210,6 +210,19 @@ class BackupTestCase(unittest.TestCase): } self.assertIsNone(p.backup_progress()) + def test_a_domain_stopped_after_its_backup_has_no_backup_running(self): + # PRESERVE_SHUTDOWN_DOMAIN: libvirt stops a guest that shut down once its backup ends + p = proxy() + p.instance.isActive.return_value = False + self.assertIsNone(p.backup_progress()) + self.assertIsNone(p.backup_targets()) + p.instance.jobStats.assert_not_called() + p.instance.isActive.return_value = True # stopped between the check and the read + p.instance.jobStats.side_effect = error(libvirt.VIR_ERR_OPERATION_INVALID) + p.instance.backupGetXMLDesc.side_effect = error(libvirt.VIR_ERR_OPERATION_INVALID) + self.assertIsNone(p.backup_progress()) + self.assertIsNone(p.backup_targets()) + def test_result(self): p = proxy() backup = {"type": libvirt.VIR_DOMAIN_JOB_COMPLETED, "operation": libvirt.VIR_DOMAIN_JOB_OPERATION_BACKUP} diff --git a/webvirtcloud/urls-api.py b/webvirtcloud/urls-api.py index 6302eae2..b5ba2ea4 100644 --- a/webvirtcloud/urls-api.py +++ b/webvirtcloud/urls-api.py @@ -5,6 +5,7 @@ from computes.api.viewsets import ComputeArchitecturesView, ComputeViewSet from networks.api.viewsets import NetworkViewSet from interfaces.api.viewsets import InterfaceViewSet from operations.api.viewsets import OperationViewSet +from vmbackups.api import BackupViewSet from storages.api.viewsets import StorageViewSet, VolumeViewSet from instances.api.viewsets import FlavorViewSet, \ InstancesViewSet, \ @@ -19,6 +20,7 @@ router.register(r'migrate', MigrateViewSet, basename='instance-migrate') router.register(r'flavor', FlavorViewSet, basename='instance-flavor') router.register(r'instances', InstancesViewSet, basename='instance') router.register(r'operations', OperationViewSet, basename='operation') +router.register(r'backups', BackupViewSet, basename='backup') compute_router = routers.NestedSimpleRouter(router, r'computes', lookup='compute', use_regex_path=False) compute_router.register(r'instances', InstanceViewSet, basename='compute-instance')