mirror of
https://github.com/retspen/webvirtcloud
synced 2026-12-03 01:16:10 +00:00
feat(vmbackups): the Schedules pages
Backups -> Schedules lists the backup schedules and adds one: a name, a target, every VM of a compute or chosen VMs (a searchable list), a daily time in the panel's time zone (the form names it), how many backups of each VM to keep, Require frozen file systems, Enabled. The VMs' hosts must have a pool of the target. The superuser who saves a schedule is its owner, whom its jobs run as. A schedule's page edits or deletes it (its backups are kept) and lists its runs: the backup job, or why the day's backup was skipped or failed. The Backups page has a Schedule column (or By hand) and a Missing state; a missing backup offers no Restore. A VM's Backups tab names the schedules that cover it. README: a paragraph on schedules. A target with schedules is not deleted: its page says to delete them first.
This commit is contained in:
parent
819cdada69
commit
a145c07601
16 changed files with 743 additions and 111 deletions
|
|
@ -592,6 +592,8 @@ Superusers back a VM up from its **Backups** tab into a backup target: a `dir` o
|
|||
|
||||
VMs with TPM state, host devices, shared host directories, or encrypted or non-file disks are not backed up; CD-ROMs are left out.
|
||||
|
||||
**Backups → Schedules** backs VMs up every day: chosen VMs or every VM of a compute, into a target, at a time in the panel's time zone (`TZ`), keeping the newest backups of each VM up to a number. The job worker starts each VM's backup within 6 hours of the time, one copy at a time per target, and waits for a host in maintenance; a VM not started in that window waits for the next day. Older backups of a schedule are deleted; backups taken by hand are not. Each target is checked once a day: a backup whose files are gone is marked missing.
|
||||
|
||||
The target must be:
|
||||
|
||||
- on storage apart from the VMs' disks: a target on the same storage is lost with it;
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -75,7 +75,8 @@ msgstr "Geçersiz anahtar"
|
|||
#: interfaces/templates/interface.html:119 networks/templates/network.html:145
|
||||
#: networks/templates/network.html:373 nwfilters/templates/nwfilters.html:29
|
||||
#: storages/templates/storage.html:123 virtsecrets/forms.py:34
|
||||
#: virtsecrets/forms.py:36 vmbackups/forms.py:22 vmbackups/forms.py:35
|
||||
#: virtsecrets/forms.py:36 vmbackups/forms.py:23 vmbackups/forms.py:36
|
||||
#: vmbackups/forms.py:57 vmbackups/templates/vmbackups/policies.html:16
|
||||
#: vmbackups/templates/vmbackups/targets.html:17
|
||||
msgid "Name"
|
||||
msgstr "Ad"
|
||||
|
|
@ -220,7 +221,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:263
|
||||
#: instances/views.py:263 vmbackups/templates/vmbackups/policies.html:16
|
||||
msgid "VMs"
|
||||
msgstr "Sanal makineler"
|
||||
|
||||
|
|
@ -965,6 +966,7 @@ msgstr "Mesaj"
|
|||
|
||||
#: admin/templates/admin/logs.html:43
|
||||
#: instances/templates/instances/stats_tab.html:72
|
||||
#: vmbackups/templates/vmbackups/policy.html:29
|
||||
msgid "Result"
|
||||
msgstr "Sonuç"
|
||||
|
||||
|
|
@ -983,7 +985,8 @@ 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/index.html:31
|
||||
#: vmbackups/templates/vmbackups/index.html:32
|
||||
#: vmbackups/templates/vmbackups/policy.html:38
|
||||
#: vmbackups/templates/vmbackups/state.html:1
|
||||
msgid "Failed"
|
||||
msgstr "Başarısız"
|
||||
|
|
@ -2461,6 +2464,7 @@ msgstr "hiçbiri"
|
|||
#: networks/templates/network.html:337 networks/templates/network.html:379
|
||||
#: networks/templates/network.html:406 networks/templates/network.html:445
|
||||
#: nwfilters/templates/nwfilter.html:157 templates/common/form.html:28
|
||||
#: vmbackups/templates/vmbackups/policy_form.html:18
|
||||
msgid "Save"
|
||||
msgstr "Kaydet"
|
||||
|
||||
|
|
@ -3949,7 +3953,7 @@ msgstr "Sunucunun bir havuzunda zaten bulunan bir birim."
|
|||
#: instances/templates/create_instance_w2.html:137
|
||||
#: instances/templates/create_instance_w2.html:165
|
||||
#: instances/templates/instances/move_disk.html:16
|
||||
#: instances/templates/instances/settings_tab.html:223 vmbackups/forms.py:13
|
||||
#: instances/templates/instances/settings_tab.html:223 vmbackups/forms.py:14
|
||||
msgid "Storage pool"
|
||||
msgstr "Depolama havuzu"
|
||||
|
||||
|
|
@ -3961,8 +3965,8 @@ 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/index.html:45
|
||||
#: vmbackups/templates/vmbackups/vm_tab.html:36
|
||||
#: vmbackups/templates/vmbackups/index.html:47
|
||||
#: vmbackups/templates/vmbackups/vm_tab.html:41
|
||||
msgid "Size"
|
||||
msgstr "Boyut"
|
||||
|
||||
|
|
@ -4121,8 +4125,9 @@ msgstr "Adres"
|
|||
|
||||
#: instances/templates/allinstances.html:105 instances/views.py:240
|
||||
#: interfaces/templates/interface.html:153 networks/templates/network.html:202
|
||||
#: vmbackups/templates/vmbackups/index.html:15
|
||||
#: vmbackups/templates/vmbackups/index.html:44
|
||||
#: vmbackups/templates/vmbackups/index.html:16
|
||||
#: vmbackups/templates/vmbackups/index.html:46
|
||||
#: vmbackups/templates/vmbackups/policy.html:29
|
||||
msgid "VM"
|
||||
msgstr "VM"
|
||||
|
||||
|
|
@ -4142,6 +4147,7 @@ msgstr "%(name)s öğesini daralt veya genişlet"
|
|||
|
||||
#: instances/templates/allinstances_index_grouped.html:40
|
||||
#: nwfilters/templates/nwfilters.html:48
|
||||
#: vmbackups/templates/vmbackups/policies.html:23
|
||||
#, python-format
|
||||
msgid "%(counter)s VM"
|
||||
msgid_plural "%(counter)s VMs"
|
||||
|
|
@ -4556,6 +4562,7 @@ msgstr "İstatistikler"
|
|||
#: instances/templates/instance.html:112 templates/navbar.html:21
|
||||
#: vmbackups/templates/vmbackups/index.html:6
|
||||
#: vmbackups/templates/vmbackups/index.html:8
|
||||
#: vmbackups/templates/vmbackups/policies.html:9
|
||||
#: vmbackups/templates/vmbackups/restore.html:9
|
||||
#: vmbackups/templates/vmbackups/targets.html:17
|
||||
msgid "Backups"
|
||||
|
|
@ -6620,9 +6627,10 @@ msgstr "Çok fazla arama hâlâ çalışıyor; birazdan yeniden deneyin."
|
|||
#: operations/templates/operations/jobs.html:38
|
||||
#: operations/templates/operations/jobs.html:62
|
||||
#: storages/templates/storage.html:91
|
||||
#: vmbackups/templates/vmbackups/index.html:26
|
||||
#: vmbackups/templates/vmbackups/index.html:45
|
||||
#: vmbackups/templates/vmbackups/vm_tab.html:36
|
||||
#: vmbackups/templates/vmbackups/index.html:27
|
||||
#: vmbackups/templates/vmbackups/index.html:47
|
||||
#: vmbackups/templates/vmbackups/policies.html:17
|
||||
#: vmbackups/templates/vmbackups/vm_tab.html:41
|
||||
msgid "State"
|
||||
msgstr "Durum"
|
||||
|
||||
|
|
@ -8286,8 +8294,8 @@ msgstr "Filtre oluştur"
|
|||
|
||||
#: nwfilters/templates/nwfilter.html:15 nwfilters/templates/nwfilter.html:54
|
||||
#: operations/templates/operations/jobs.html:46
|
||||
#: vmbackups/templates/vmbackups/index.html:13
|
||||
#: vmbackups/templates/vmbackups/index.html:36
|
||||
#: vmbackups/templates/vmbackups/index.html:14
|
||||
#: vmbackups/templates/vmbackups/index.html:38
|
||||
msgid "Filter"
|
||||
msgstr "Filtre"
|
||||
|
||||
|
|
@ -8325,6 +8333,8 @@ msgid "Parameters"
|
|||
msgstr "Parametreler"
|
||||
|
||||
#: nwfilters/templates/nwfilter.html:64
|
||||
#: vmbackups/templates/vmbackups/index.html:34
|
||||
#: vmbackups/templates/vmbackups/state.html:1
|
||||
msgid "Missing"
|
||||
msgstr "Eksik"
|
||||
|
||||
|
|
@ -8568,6 +8578,7 @@ msgid "Resolution"
|
|||
msgstr "Çözüm"
|
||||
|
||||
#: operations/templates/operations/job.html:81
|
||||
#: vmbackups/templates/vmbackups/policy.html:36
|
||||
msgid "Started"
|
||||
msgstr "Başlangıç"
|
||||
|
||||
|
|
@ -8630,7 +8641,7 @@ msgid "All kinds"
|
|||
msgstr "Tüm türler"
|
||||
|
||||
#: operations/templates/operations/jobs.html:39
|
||||
#: vmbackups/templates/vmbackups/index.html:28
|
||||
#: vmbackups/templates/vmbackups/index.html:29
|
||||
msgid "All states"
|
||||
msgstr "Tüm durumlar"
|
||||
|
||||
|
|
@ -9724,23 +9735,23 @@ msgstr ""
|
|||
"Eski değerin yerini hemen alır; bir parolanın şifrelediği veriler yeniden "
|
||||
"şifrelenmez."
|
||||
|
||||
#: vmbackups/forms.py:12 vmbackups/forms.py:36
|
||||
#: vmbackups/forms.py:13 vmbackups/forms.py:37
|
||||
msgid "Compute"
|
||||
msgstr "Sunucu"
|
||||
|
||||
#: vmbackups/forms.py:28
|
||||
#: vmbackups/forms.py:29
|
||||
msgid "A backup target with this name exists"
|
||||
msgstr "Bu adla bir yedek hedefi zaten var"
|
||||
|
||||
#: vmbackups/forms.py:37
|
||||
#: vmbackups/forms.py:38
|
||||
msgid "Storage pool for the disks"
|
||||
msgstr "Diskler için depolama havuzu"
|
||||
|
||||
#: vmbackups/forms.py:38
|
||||
#: vmbackups/forms.py:39
|
||||
msgid "Connect the network"
|
||||
msgstr "Ağı bağla"
|
||||
|
||||
#: vmbackups/forms.py:39
|
||||
#: vmbackups/forms.py:40
|
||||
msgid ""
|
||||
"The restored guest keeps the VM's addresses and host name: connected beside "
|
||||
"the VM, they clash."
|
||||
|
|
@ -9748,15 +9759,51 @@ msgstr ""
|
|||
"Geri yüklenen konuk, sanal makinenin adreslerini ve ana bilgisayar adını "
|
||||
"taşır: sanal makinenin yanında ağa bağlanırsa çakışırlar."
|
||||
|
||||
#: vmbackups/forms.py:41
|
||||
#: vmbackups/forms.py:42
|
||||
msgid "Start after restore"
|
||||
msgstr "Geri yüklendikten sonra başlat"
|
||||
|
||||
#: vmbackups/jobs.py:57
|
||||
#: vmbackups/forms.py:57 vmbackups/templates/vmbackups/vm_tab.html:13
|
||||
msgid "Backup target"
|
||||
msgstr "Yedek hedefi"
|
||||
|
||||
#: vmbackups/forms.py:57
|
||||
msgid "Every VM of a compute"
|
||||
msgstr "Bir sunucunun bütün sanal makineleri"
|
||||
|
||||
#: vmbackups/forms.py:58
|
||||
msgid "Or these VMs"
|
||||
msgstr "Ya da bu sanal makineler"
|
||||
|
||||
#: vmbackups/forms.py:58 vmbackups/templates/vmbackups/policies.html:16
|
||||
msgid "Daily at"
|
||||
msgstr "Her gün saat"
|
||||
|
||||
#: vmbackups/forms.py:58
|
||||
msgid "Backups to keep of each VM"
|
||||
msgstr "Her sanal makineden tutulacak yedek sayısı"
|
||||
|
||||
#: vmbackups/forms.py:59 vmbackups/templates/vmbackups/vm_tab.html:21
|
||||
msgid "Require frozen file systems"
|
||||
msgstr "Dosya sistemlerinin dondurulmasını zorunlu kıl"
|
||||
|
||||
#: vmbackups/forms.py:59 vmbackups/templates/vmbackups/policies.html:27
|
||||
msgid "Enabled"
|
||||
msgstr "Etkin"
|
||||
|
||||
#: vmbackups/forms.py:75
|
||||
msgid "Choose a compute or VMs, not both"
|
||||
msgstr "Bir sunucu ya da sanal makineler seçin, ikisini birden değil"
|
||||
|
||||
#: vmbackups/forms.py:80 vmbackups/jobs.py:57
|
||||
#, 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/forms.py:87
|
||||
msgid "Keep one backup at least"
|
||||
msgstr "En az bir yedek tutun"
|
||||
|
||||
#: vmbackups/jobs.py:67
|
||||
msgid "The VM must be running, paused or shut off to be backed up"
|
||||
msgstr ""
|
||||
|
|
@ -9993,6 +10040,12 @@ msgstr ""
|
|||
"hedeften kaldırılır."
|
||||
|
||||
#: vmbackups/templates/vmbackups/index.html:10
|
||||
#: vmbackups/templates/vmbackups/policies.html:9
|
||||
#: vmbackups/templates/vmbackups/policy.html:9
|
||||
msgid "Schedules"
|
||||
msgstr "Zamanlamalar"
|
||||
|
||||
#: vmbackups/templates/vmbackups/index.html:11
|
||||
#: vmbackups/templates/vmbackups/target.html:7
|
||||
#: vmbackups/templates/vmbackups/target.html:9
|
||||
#: vmbackups/templates/vmbackups/targets.html:6
|
||||
|
|
@ -10000,57 +10053,141 @@ msgstr ""
|
|||
msgid "Backup targets"
|
||||
msgstr "Yedek hedefleri"
|
||||
|
||||
#: vmbackups/templates/vmbackups/index.html:16
|
||||
#: vmbackups/templates/vmbackups/index.html:17
|
||||
msgid "VM name"
|
||||
msgstr "Sanal makine adı"
|
||||
|
||||
#: vmbackups/templates/vmbackups/index.html:19
|
||||
#: vmbackups/templates/vmbackups/index.html:44
|
||||
#: vmbackups/templates/vmbackups/vm_tab.html:36
|
||||
#: vmbackups/templates/vmbackups/index.html:20
|
||||
#: vmbackups/templates/vmbackups/index.html:46
|
||||
#: vmbackups/templates/vmbackups/policies.html:16
|
||||
#: vmbackups/templates/vmbackups/vm_tab.html:41
|
||||
msgid "Target"
|
||||
msgstr "Hedef"
|
||||
|
||||
#: vmbackups/templates/vmbackups/index.html:21
|
||||
#: vmbackups/templates/vmbackups/index.html:22
|
||||
msgid "All targets"
|
||||
msgstr "Tüm hedefler"
|
||||
|
||||
#: vmbackups/templates/vmbackups/index.html:29
|
||||
#: vmbackups/templates/vmbackups/index.html:30
|
||||
#: vmbackups/templates/vmbackups/state.html:1
|
||||
msgid "Ready"
|
||||
msgstr "Hazır"
|
||||
|
||||
#: vmbackups/templates/vmbackups/index.html:30
|
||||
#: vmbackups/templates/vmbackups/index.html:31
|
||||
#: vmbackups/templates/vmbackups/state.html:1
|
||||
msgid "Creating"
|
||||
msgstr "Oluşturuluyor"
|
||||
|
||||
#: vmbackups/templates/vmbackups/index.html:32
|
||||
#: vmbackups/templates/vmbackups/index.html:33
|
||||
#: vmbackups/templates/vmbackups/state.html:1
|
||||
msgid "Deleting"
|
||||
msgstr "Siliniyor"
|
||||
|
||||
#: vmbackups/templates/vmbackups/index.html:44
|
||||
#: vmbackups/templates/vmbackups/vm_tab.html:36
|
||||
#: vmbackups/templates/vmbackups/index.html:46
|
||||
#: vmbackups/templates/vmbackups/vm_tab.html:41
|
||||
msgid "Time"
|
||||
msgstr "Zaman"
|
||||
|
||||
#: vmbackups/templates/vmbackups/index.html:44
|
||||
#: vmbackups/templates/vmbackups/vm_tab.html:36
|
||||
#: vmbackups/templates/vmbackups/index.html:46
|
||||
#: vmbackups/templates/vmbackups/vm_tab.html:41
|
||||
msgid "Consistency"
|
||||
msgstr "Tutarlılık"
|
||||
|
||||
#: vmbackups/templates/vmbackups/index.html:53
|
||||
#: vmbackups/templates/vmbackups/index.html:46
|
||||
msgid "Schedule"
|
||||
msgstr "Zamanlama"
|
||||
|
||||
#: vmbackups/templates/vmbackups/index.html:55
|
||||
msgid "removed"
|
||||
msgstr "kaldırıldı"
|
||||
|
||||
#: vmbackups/templates/vmbackups/index.html:67
|
||||
#: vmbackups/templates/vmbackups/index.html:60
|
||||
msgid "By hand"
|
||||
msgstr "Elle"
|
||||
|
||||
#: vmbackups/templates/vmbackups/index.html:70
|
||||
msgid "No backup matches the filter."
|
||||
msgstr "Süzgece uyan yedek yok."
|
||||
|
||||
#: vmbackups/templates/vmbackups/index.html:69
|
||||
#: vmbackups/templates/vmbackups/index.html:72
|
||||
msgid "No backup yet. Back a VM up from its Backups tab."
|
||||
msgstr "Henüz yedek yok. Bir sanal makineyi Yedekler sekmesinden yedekleyin."
|
||||
|
||||
#: vmbackups/templates/vmbackups/policies.html:6
|
||||
#: vmbackups/templates/vmbackups/policy.html:6
|
||||
msgid "Backup schedules"
|
||||
msgstr "Yedekleme zamanlamaları"
|
||||
|
||||
#: vmbackups/templates/vmbackups/policies.html:17
|
||||
msgid "Backups kept"
|
||||
msgstr "Tutulan yedek"
|
||||
|
||||
#: vmbackups/templates/vmbackups/policies.html:23
|
||||
#, python-format
|
||||
msgid "Every VM of %(compute)s"
|
||||
msgstr "%(compute)s üzerindeki bütün sanal makineler"
|
||||
|
||||
#: vmbackups/templates/vmbackups/policies.html:27
|
||||
#: vmbackups/templates/vmbackups/vm_tab.html:34
|
||||
msgid "Disabled"
|
||||
msgstr "Devre dışı"
|
||||
|
||||
#: vmbackups/templates/vmbackups/policies.html:34
|
||||
msgid "No backup schedule yet."
|
||||
msgstr "Henüz yedekleme zamanlaması yok."
|
||||
|
||||
#: vmbackups/templates/vmbackups/policies.html:38
|
||||
msgid "Add a backup schedule"
|
||||
msgstr "Yedekleme zamanlaması ekle"
|
||||
|
||||
#: vmbackups/templates/vmbackups/policy.html:12
|
||||
#, python-format
|
||||
msgid "Its jobs run as %(owner)s, who saved it last."
|
||||
msgstr "İşleri, onu en son kaydeden %(owner)s olarak çalışır."
|
||||
|
||||
#: vmbackups/templates/vmbackups/policy.html:21
|
||||
msgid "Delete this schedule? Its backups are kept."
|
||||
msgstr "Bu zamanlama silinsin mi? Yedekleri tutulur."
|
||||
|
||||
#: vmbackups/templates/vmbackups/policy.html:21
|
||||
msgid "Delete schedule"
|
||||
msgstr "Zamanlamayı sil"
|
||||
|
||||
#: vmbackups/templates/vmbackups/policy.html:25
|
||||
msgid "Runs"
|
||||
msgstr "Çalışmalar"
|
||||
|
||||
#: vmbackups/templates/vmbackups/policy.html:29
|
||||
msgid "Day"
|
||||
msgstr "Gün"
|
||||
|
||||
#: vmbackups/templates/vmbackups/policy.html:36
|
||||
msgid "Backup job"
|
||||
msgstr "Yedekleme işi"
|
||||
|
||||
#: vmbackups/templates/vmbackups/policy.html:37
|
||||
msgid "Skipped"
|
||||
msgstr "Atlandı"
|
||||
|
||||
#: vmbackups/templates/vmbackups/policy.html:47
|
||||
msgid "No run yet."
|
||||
msgstr "Henüz çalışma yok."
|
||||
|
||||
#: vmbackups/templates/vmbackups/policy_form.html:12
|
||||
#, python-format
|
||||
msgid "Time zone: %(time_zone)s"
|
||||
msgstr "Saat dilimi: %(time_zone)s"
|
||||
|
||||
#: vmbackups/templates/vmbackups/policy_form.html:17
|
||||
msgid ""
|
||||
"Each VM is backed up once a day, starting at the time; a VM that has not "
|
||||
"started within 6 hours waits for the next day. Older backups of each VM "
|
||||
"beyond the number kept are deleted; backups taken by hand are not."
|
||||
msgstr ""
|
||||
"Her sanal makine günde bir kez, bu saatten başlayarak yedeklenir; 6 saat "
|
||||
"içinde başlamayan bir sanal makine ertesi günü bekler. Her sanal makinenin "
|
||||
"tutulan sayıyı aşan eski yedekleri silinir; elle alınan yedekler silinmez."
|
||||
|
||||
#: vmbackups/templates/vmbackups/restore.html:12
|
||||
#, python-format
|
||||
msgid ""
|
||||
|
|
@ -10060,6 +10197,10 @@ msgstr ""
|
|||
"%(vm)s sanal makinesinin %(time)s tarihli, %(target)s hedefindeki yedeği "
|
||||
"kendi UUID'si ve MAC adresleriyle yeni bir sanal makine olarak geri yüklenir."
|
||||
|
||||
#: vmbackups/templates/vmbackups/state.html:1
|
||||
msgid "Files of the backup are missing from the target"
|
||||
msgstr "Yedeğin dosyaları hedefte yok"
|
||||
|
||||
#: vmbackups/templates/vmbackups/target.html:13
|
||||
#, python-format
|
||||
msgid "%(counter)s backup."
|
||||
|
|
@ -10138,14 +10279,6 @@ msgstr "Yedek hedefi ekle"
|
|||
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 "
|
||||
|
|
@ -10156,11 +10289,15 @@ msgstr ""
|
|||
" 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:53
|
||||
#: vmbackups/templates/vmbackups/vm_tab.html:33
|
||||
msgid "Schedules:"
|
||||
msgstr "Zamanlamalar:"
|
||||
|
||||
#: 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
|
||||
#: vmbackups/utils.py:28
|
||||
#, python-format
|
||||
msgid ""
|
||||
"Volume %(volume)s belongs to a backup of %(vm)s; delete the backup on the "
|
||||
|
|
@ -10168,7 +10305,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"%(volume)s birimi %(vm)s yedeğine ait; yedeği Yedekler sayfasından silin"
|
||||
|
||||
#: vmbackups/utils.py:37
|
||||
#: vmbackups/utils.py:38
|
||||
#, python-format
|
||||
msgid ""
|
||||
"Storage pool %(pool)s is backup target %(target)s; remove it from the target "
|
||||
|
|
@ -10176,17 +10313,22 @@ msgid ""
|
|||
msgstr ""
|
||||
"%(pool)s depolama havuzu %(target)s yedek hedefidir; önce hedeften çıkarın"
|
||||
|
||||
#: vmbackups/utils.py:49
|
||||
#: vmbackups/utils.py:50
|
||||
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:85
|
||||
#: vmbackups/views.py:68 vmbackups/views.py:89
|
||||
#, 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:102
|
||||
#: vmbackups/views.py:71
|
||||
#, python-format
|
||||
msgid "Backup target %(target)s has schedules; delete them first"
|
||||
msgstr "%(target)s yedek hedefinin zamanlamaları var; önce onları silin"
|
||||
|
||||
#: vmbackups/views.py:106
|
||||
#, python-format
|
||||
msgid ""
|
||||
"Storage pool %(pool)s of %(compute)s is not the same directory as storage "
|
||||
|
|
@ -10195,7 +10337,7 @@ msgstr ""
|
|||
"%(compute)s sunucusunun %(pool)s depolama havuzu, %(other_compute)s "
|
||||
"sunucusunun %(other)s depolama havuzuyla aynı dizin değil"
|
||||
|
||||
#: vmbackups/views.py:134
|
||||
#: vmbackups/views.py:138
|
||||
msgid "Choose a backup target"
|
||||
msgstr "Bir yedek hedefi seçin"
|
||||
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -72,7 +72,8 @@ msgstr "无效的密钥"
|
|||
#: interfaces/templates/interface.html:119 networks/templates/network.html:145
|
||||
#: networks/templates/network.html:373 nwfilters/templates/nwfilters.html:29
|
||||
#: storages/templates/storage.html:123 virtsecrets/forms.py:34
|
||||
#: virtsecrets/forms.py:36 vmbackups/forms.py:22 vmbackups/forms.py:35
|
||||
#: virtsecrets/forms.py:36 vmbackups/forms.py:23 vmbackups/forms.py:36
|
||||
#: vmbackups/forms.py:57 vmbackups/templates/vmbackups/policies.html:16
|
||||
#: vmbackups/templates/vmbackups/targets.html:17
|
||||
msgid "Name"
|
||||
msgstr "名称"
|
||||
|
|
@ -215,7 +216,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:263
|
||||
#: instances/views.py:263 vmbackups/templates/vmbackups/policies.html:16
|
||||
msgid "VMs"
|
||||
msgstr "虚拟机"
|
||||
|
||||
|
|
@ -940,6 +941,7 @@ msgstr "消息"
|
|||
|
||||
#: admin/templates/admin/logs.html:43
|
||||
#: instances/templates/instances/stats_tab.html:72
|
||||
#: vmbackups/templates/vmbackups/policy.html:29
|
||||
msgid "Result"
|
||||
msgstr "结果"
|
||||
|
||||
|
|
@ -958,7 +960,8 @@ msgstr "完成"
|
|||
|
||||
#: admin/templates/admin/logs.html:56 admin/views.py:395 logs/views.py:18
|
||||
#: operations/templates/operations/job.html:107
|
||||
#: vmbackups/templates/vmbackups/index.html:31
|
||||
#: vmbackups/templates/vmbackups/index.html:32
|
||||
#: vmbackups/templates/vmbackups/policy.html:38
|
||||
#: vmbackups/templates/vmbackups/state.html:1
|
||||
msgid "Failed"
|
||||
msgstr "失败"
|
||||
|
|
@ -2353,6 +2356,7 @@ msgstr "无"
|
|||
#: networks/templates/network.html:337 networks/templates/network.html:379
|
||||
#: networks/templates/network.html:406 networks/templates/network.html:445
|
||||
#: nwfilters/templates/nwfilter.html:157 templates/common/form.html:28
|
||||
#: vmbackups/templates/vmbackups/policy_form.html:18
|
||||
msgid "Save"
|
||||
msgstr "保存"
|
||||
|
||||
|
|
@ -3750,7 +3754,7 @@ msgstr "主机存储池中已有的卷。"
|
|||
#: instances/templates/create_instance_w2.html:137
|
||||
#: instances/templates/create_instance_w2.html:165
|
||||
#: instances/templates/instances/move_disk.html:16
|
||||
#: instances/templates/instances/settings_tab.html:223 vmbackups/forms.py:13
|
||||
#: instances/templates/instances/settings_tab.html:223 vmbackups/forms.py:14
|
||||
msgid "Storage pool"
|
||||
msgstr "存储池"
|
||||
|
||||
|
|
@ -3762,8 +3766,8 @@ msgstr "字母、数字、点、短横线和下划线。"
|
|||
|
||||
#: instances/templates/add_instance_volume.html:44
|
||||
#: instances/templates/instances/settings_tab.html:851
|
||||
#: vmbackups/templates/vmbackups/index.html:45
|
||||
#: vmbackups/templates/vmbackups/vm_tab.html:36
|
||||
#: vmbackups/templates/vmbackups/index.html:47
|
||||
#: vmbackups/templates/vmbackups/vm_tab.html:41
|
||||
msgid "Size"
|
||||
msgstr "大小"
|
||||
|
||||
|
|
@ -3917,8 +3921,9 @@ msgstr "地址"
|
|||
|
||||
#: instances/templates/allinstances.html:105 instances/views.py:240
|
||||
#: interfaces/templates/interface.html:153 networks/templates/network.html:202
|
||||
#: vmbackups/templates/vmbackups/index.html:15
|
||||
#: vmbackups/templates/vmbackups/index.html:44
|
||||
#: vmbackups/templates/vmbackups/index.html:16
|
||||
#: vmbackups/templates/vmbackups/index.html:46
|
||||
#: vmbackups/templates/vmbackups/policy.html:29
|
||||
msgid "VM"
|
||||
msgstr "虚拟机"
|
||||
|
||||
|
|
@ -3938,6 +3943,7 @@ msgstr "折叠或展开 %(name)s"
|
|||
|
||||
#: instances/templates/allinstances_index_grouped.html:40
|
||||
#: nwfilters/templates/nwfilters.html:48
|
||||
#: vmbackups/templates/vmbackups/policies.html:23
|
||||
#, python-format
|
||||
msgid "%(counter)s VM"
|
||||
msgid_plural "%(counter)s VMs"
|
||||
|
|
@ -4341,6 +4347,7 @@ msgstr "统计"
|
|||
#: instances/templates/instance.html:112 templates/navbar.html:21
|
||||
#: vmbackups/templates/vmbackups/index.html:6
|
||||
#: vmbackups/templates/vmbackups/index.html:8
|
||||
#: vmbackups/templates/vmbackups/policies.html:9
|
||||
#: vmbackups/templates/vmbackups/restore.html:9
|
||||
#: vmbackups/templates/vmbackups/targets.html:17
|
||||
msgid "Backups"
|
||||
|
|
@ -6239,9 +6246,10 @@ msgstr "仍在运行的搜索过多;请稍后再试。"
|
|||
#: operations/templates/operations/jobs.html:38
|
||||
#: operations/templates/operations/jobs.html:62
|
||||
#: storages/templates/storage.html:91
|
||||
#: vmbackups/templates/vmbackups/index.html:26
|
||||
#: vmbackups/templates/vmbackups/index.html:45
|
||||
#: vmbackups/templates/vmbackups/vm_tab.html:36
|
||||
#: vmbackups/templates/vmbackups/index.html:27
|
||||
#: vmbackups/templates/vmbackups/index.html:47
|
||||
#: vmbackups/templates/vmbackups/policies.html:17
|
||||
#: vmbackups/templates/vmbackups/vm_tab.html:41
|
||||
msgid "State"
|
||||
msgstr "状态"
|
||||
|
||||
|
|
@ -7800,8 +7808,8 @@ msgstr "创建过滤器"
|
|||
|
||||
#: nwfilters/templates/nwfilter.html:15 nwfilters/templates/nwfilter.html:54
|
||||
#: operations/templates/operations/jobs.html:46
|
||||
#: vmbackups/templates/vmbackups/index.html:13
|
||||
#: vmbackups/templates/vmbackups/index.html:36
|
||||
#: vmbackups/templates/vmbackups/index.html:14
|
||||
#: vmbackups/templates/vmbackups/index.html:38
|
||||
msgid "Filter"
|
||||
msgstr "过滤器"
|
||||
|
||||
|
|
@ -7839,6 +7847,8 @@ msgid "Parameters"
|
|||
msgstr "参数"
|
||||
|
||||
#: nwfilters/templates/nwfilter.html:64
|
||||
#: vmbackups/templates/vmbackups/index.html:34
|
||||
#: vmbackups/templates/vmbackups/state.html:1
|
||||
msgid "Missing"
|
||||
msgstr "缺失"
|
||||
|
||||
|
|
@ -8072,6 +8082,7 @@ msgid "Resolution"
|
|||
msgstr "处理结论"
|
||||
|
||||
#: operations/templates/operations/job.html:81
|
||||
#: vmbackups/templates/vmbackups/policy.html:36
|
||||
msgid "Started"
|
||||
msgstr "开始时间"
|
||||
|
||||
|
|
@ -8132,7 +8143,7 @@ msgid "All kinds"
|
|||
msgstr "所有类型"
|
||||
|
||||
#: operations/templates/operations/jobs.html:39
|
||||
#: vmbackups/templates/vmbackups/index.html:28
|
||||
#: vmbackups/templates/vmbackups/index.html:29
|
||||
msgid "All states"
|
||||
msgstr "所有状态"
|
||||
|
||||
|
|
@ -9169,37 +9180,73 @@ msgid ""
|
|||
"encrypted anew."
|
||||
msgstr "新值会立即替换旧值;之前用口令加密的内容不会重新加密。"
|
||||
|
||||
#: vmbackups/forms.py:12 vmbackups/forms.py:36
|
||||
#: vmbackups/forms.py:13 vmbackups/forms.py:37
|
||||
msgid "Compute"
|
||||
msgstr "计算节点"
|
||||
|
||||
#: vmbackups/forms.py:28
|
||||
#: vmbackups/forms.py:29
|
||||
msgid "A backup target with this name exists"
|
||||
msgstr "已存在同名的备份目标"
|
||||
|
||||
#: vmbackups/forms.py:37
|
||||
#: vmbackups/forms.py:38
|
||||
msgid "Storage pool for the disks"
|
||||
msgstr "磁盘的存储池"
|
||||
|
||||
#: vmbackups/forms.py:38
|
||||
#: vmbackups/forms.py:39
|
||||
msgid "Connect the network"
|
||||
msgstr "连接网络"
|
||||
|
||||
#: vmbackups/forms.py:39
|
||||
#: vmbackups/forms.py:40
|
||||
msgid ""
|
||||
"The restored guest keeps the VM's addresses and host name: connected beside "
|
||||
"the VM, they clash."
|
||||
msgstr "恢复的客户机保留虚拟机的地址和主机名:与原虚拟机同时联网会发生冲突。"
|
||||
|
||||
#: vmbackups/forms.py:41
|
||||
#: vmbackups/forms.py:42
|
||||
msgid "Start after restore"
|
||||
msgstr "恢复后启动"
|
||||
|
||||
#: vmbackups/jobs.py:57
|
||||
#: vmbackups/forms.py:57 vmbackups/templates/vmbackups/vm_tab.html:13
|
||||
msgid "Backup target"
|
||||
msgstr "备份目标"
|
||||
|
||||
#: vmbackups/forms.py:57
|
||||
msgid "Every VM of a compute"
|
||||
msgstr "某计算节点的所有虚拟机"
|
||||
|
||||
#: vmbackups/forms.py:58
|
||||
msgid "Or these VMs"
|
||||
msgstr "或这些虚拟机"
|
||||
|
||||
#: vmbackups/forms.py:58 vmbackups/templates/vmbackups/policies.html:16
|
||||
msgid "Daily at"
|
||||
msgstr "每天时间"
|
||||
|
||||
#: vmbackups/forms.py:58
|
||||
msgid "Backups to keep of each VM"
|
||||
msgstr "每台虚拟机保留的备份数"
|
||||
|
||||
#: vmbackups/forms.py:59 vmbackups/templates/vmbackups/vm_tab.html:21
|
||||
msgid "Require frozen file systems"
|
||||
msgstr "要求冻结文件系统"
|
||||
|
||||
#: vmbackups/forms.py:59 vmbackups/templates/vmbackups/policies.html:27
|
||||
msgid "Enabled"
|
||||
msgstr "已启用"
|
||||
|
||||
#: vmbackups/forms.py:75
|
||||
msgid "Choose a compute or VMs, not both"
|
||||
msgstr "请选择一个计算节点或若干虚拟机,不能同时选择"
|
||||
|
||||
#: vmbackups/forms.py:80 vmbackups/jobs.py:57
|
||||
#, python-format
|
||||
msgid "Backup target %(target)s has no storage pool on %(compute)s"
|
||||
msgstr "备份目标 %(target)s 在 %(compute)s 上没有存储池"
|
||||
|
||||
#: vmbackups/forms.py:87
|
||||
msgid "Keep one backup at least"
|
||||
msgstr "至少保留一个备份"
|
||||
|
||||
#: vmbackups/jobs.py:67
|
||||
msgid "The VM must be running, paused or shut off to be backed up"
|
||||
msgstr "虚拟机必须处于运行、暂停或关闭状态才能备份"
|
||||
|
|
@ -9413,6 +9460,12 @@ msgid ""
|
|||
msgstr "要删除 %(vm)s 在 %(time)s 的备份吗?其文件将从目标中移除。"
|
||||
|
||||
#: vmbackups/templates/vmbackups/index.html:10
|
||||
#: vmbackups/templates/vmbackups/policies.html:9
|
||||
#: vmbackups/templates/vmbackups/policy.html:9
|
||||
msgid "Schedules"
|
||||
msgstr "计划"
|
||||
|
||||
#: vmbackups/templates/vmbackups/index.html:11
|
||||
#: vmbackups/templates/vmbackups/target.html:7
|
||||
#: vmbackups/templates/vmbackups/target.html:9
|
||||
#: vmbackups/templates/vmbackups/targets.html:6
|
||||
|
|
@ -9420,57 +9473,138 @@ msgstr "要删除 %(vm)s 在 %(time)s 的备份吗?其文件将从目标中移
|
|||
msgid "Backup targets"
|
||||
msgstr "备份目标"
|
||||
|
||||
#: vmbackups/templates/vmbackups/index.html:16
|
||||
#: vmbackups/templates/vmbackups/index.html:17
|
||||
msgid "VM name"
|
||||
msgstr "虚拟机名称"
|
||||
|
||||
#: vmbackups/templates/vmbackups/index.html:19
|
||||
#: vmbackups/templates/vmbackups/index.html:44
|
||||
#: vmbackups/templates/vmbackups/vm_tab.html:36
|
||||
#: vmbackups/templates/vmbackups/index.html:20
|
||||
#: vmbackups/templates/vmbackups/index.html:46
|
||||
#: vmbackups/templates/vmbackups/policies.html:16
|
||||
#: vmbackups/templates/vmbackups/vm_tab.html:41
|
||||
msgid "Target"
|
||||
msgstr "目标"
|
||||
|
||||
#: vmbackups/templates/vmbackups/index.html:21
|
||||
#: vmbackups/templates/vmbackups/index.html:22
|
||||
msgid "All targets"
|
||||
msgstr "所有目标"
|
||||
|
||||
#: vmbackups/templates/vmbackups/index.html:29
|
||||
#: vmbackups/templates/vmbackups/index.html:30
|
||||
#: vmbackups/templates/vmbackups/state.html:1
|
||||
msgid "Ready"
|
||||
msgstr "就绪"
|
||||
|
||||
#: vmbackups/templates/vmbackups/index.html:30
|
||||
#: vmbackups/templates/vmbackups/index.html:31
|
||||
#: vmbackups/templates/vmbackups/state.html:1
|
||||
msgid "Creating"
|
||||
msgstr "正在创建"
|
||||
|
||||
#: vmbackups/templates/vmbackups/index.html:32
|
||||
#: vmbackups/templates/vmbackups/index.html:33
|
||||
#: vmbackups/templates/vmbackups/state.html:1
|
||||
msgid "Deleting"
|
||||
msgstr "正在删除"
|
||||
|
||||
#: vmbackups/templates/vmbackups/index.html:44
|
||||
#: vmbackups/templates/vmbackups/vm_tab.html:36
|
||||
#: vmbackups/templates/vmbackups/index.html:46
|
||||
#: vmbackups/templates/vmbackups/vm_tab.html:41
|
||||
msgid "Time"
|
||||
msgstr "时间"
|
||||
|
||||
#: vmbackups/templates/vmbackups/index.html:44
|
||||
#: vmbackups/templates/vmbackups/vm_tab.html:36
|
||||
#: vmbackups/templates/vmbackups/index.html:46
|
||||
#: vmbackups/templates/vmbackups/vm_tab.html:41
|
||||
msgid "Consistency"
|
||||
msgstr "一致性"
|
||||
|
||||
#: vmbackups/templates/vmbackups/index.html:53
|
||||
#: vmbackups/templates/vmbackups/index.html:46
|
||||
msgid "Schedule"
|
||||
msgstr "计划"
|
||||
|
||||
#: vmbackups/templates/vmbackups/index.html:55
|
||||
msgid "removed"
|
||||
msgstr "已移除"
|
||||
|
||||
#: vmbackups/templates/vmbackups/index.html:67
|
||||
#: vmbackups/templates/vmbackups/index.html:60
|
||||
msgid "By hand"
|
||||
msgstr "手动"
|
||||
|
||||
#: vmbackups/templates/vmbackups/index.html:70
|
||||
msgid "No backup matches the filter."
|
||||
msgstr "没有符合筛选条件的备份。"
|
||||
|
||||
#: vmbackups/templates/vmbackups/index.html:69
|
||||
#: vmbackups/templates/vmbackups/index.html:72
|
||||
msgid "No backup yet. Back a VM up from its Backups tab."
|
||||
msgstr "还没有备份。请在虚拟机的备份选项卡中备份虚拟机。"
|
||||
|
||||
#: vmbackups/templates/vmbackups/policies.html:6
|
||||
#: vmbackups/templates/vmbackups/policy.html:6
|
||||
msgid "Backup schedules"
|
||||
msgstr "备份计划"
|
||||
|
||||
#: vmbackups/templates/vmbackups/policies.html:17
|
||||
msgid "Backups kept"
|
||||
msgstr "保留的备份数"
|
||||
|
||||
#: vmbackups/templates/vmbackups/policies.html:23
|
||||
#, python-format
|
||||
msgid "Every VM of %(compute)s"
|
||||
msgstr "%(compute)s 的所有虚拟机"
|
||||
|
||||
#: vmbackups/templates/vmbackups/policies.html:27
|
||||
#: vmbackups/templates/vmbackups/vm_tab.html:34
|
||||
msgid "Disabled"
|
||||
msgstr "已禁用"
|
||||
|
||||
#: vmbackups/templates/vmbackups/policies.html:34
|
||||
msgid "No backup schedule yet."
|
||||
msgstr "还没有备份计划。"
|
||||
|
||||
#: vmbackups/templates/vmbackups/policies.html:38
|
||||
msgid "Add a backup schedule"
|
||||
msgstr "添加备份计划"
|
||||
|
||||
#: vmbackups/templates/vmbackups/policy.html:12
|
||||
#, python-format
|
||||
msgid "Its jobs run as %(owner)s, who saved it last."
|
||||
msgstr "其作业以最后保存它的 %(owner)s 的身份运行。"
|
||||
|
||||
#: vmbackups/templates/vmbackups/policy.html:21
|
||||
msgid "Delete this schedule? Its backups are kept."
|
||||
msgstr "要删除此计划吗?其备份将保留。"
|
||||
|
||||
#: vmbackups/templates/vmbackups/policy.html:21
|
||||
msgid "Delete schedule"
|
||||
msgstr "删除计划"
|
||||
|
||||
#: vmbackups/templates/vmbackups/policy.html:25
|
||||
msgid "Runs"
|
||||
msgstr "运行记录"
|
||||
|
||||
#: vmbackups/templates/vmbackups/policy.html:29
|
||||
msgid "Day"
|
||||
msgstr "日期"
|
||||
|
||||
#: vmbackups/templates/vmbackups/policy.html:36
|
||||
msgid "Backup job"
|
||||
msgstr "备份作业"
|
||||
|
||||
#: vmbackups/templates/vmbackups/policy.html:37
|
||||
msgid "Skipped"
|
||||
msgstr "已跳过"
|
||||
|
||||
#: vmbackups/templates/vmbackups/policy.html:47
|
||||
msgid "No run yet."
|
||||
msgstr "还没有运行记录。"
|
||||
|
||||
#: vmbackups/templates/vmbackups/policy_form.html:12
|
||||
#, python-format
|
||||
msgid "Time zone: %(time_zone)s"
|
||||
msgstr "时区:%(time_zone)s"
|
||||
|
||||
#: vmbackups/templates/vmbackups/policy_form.html:17
|
||||
msgid ""
|
||||
"Each VM is backed up once a day, starting at the time; a VM that has not "
|
||||
"started within 6 hours waits for the next day. Older backups of each VM "
|
||||
"beyond the number kept are deleted; backups taken by hand are not."
|
||||
msgstr "每台虚拟机每天从该时间开始备份一次;6 小时内未开始的虚拟机将等待第二天。每台虚拟机超出保留数量的旧备份会被删除;手动创建的备份不会被删除。"
|
||||
|
||||
#: vmbackups/templates/vmbackups/restore.html:12
|
||||
#, python-format
|
||||
msgid ""
|
||||
|
|
@ -9478,6 +9612,10 @@ msgid ""
|
|||
"with its own UUID and MAC addresses."
|
||||
msgstr "%(vm)s 在 %(time)s 的备份(位于 %(target)s)将恢复为一台拥有自己 UUID 和 MAC 地址的新虚拟机。"
|
||||
|
||||
#: vmbackups/templates/vmbackups/state.html:1
|
||||
msgid "Files of the backup are missing from the target"
|
||||
msgstr "备份的文件在目标中缺失"
|
||||
|
||||
#: vmbackups/templates/vmbackups/target.html:13
|
||||
#, python-format
|
||||
msgid "%(counter)s backup."
|
||||
|
|
@ -9545,14 +9683,6 @@ msgstr "添加备份目标"
|
|||
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 "
|
||||
|
|
@ -9560,41 +9690,50 @@ msgid ""
|
|||
"backup is crash-consistent. Memory is not kept."
|
||||
msgstr "运行中的虚拟机会继续运行:其磁盘从同一时刻复制;客户机代理响应时,文件系统在该时刻被冻结,否则备份为崩溃一致。不保存内存。"
|
||||
|
||||
#: vmbackups/templates/vmbackups/vm_tab.html:53
|
||||
#: vmbackups/templates/vmbackups/vm_tab.html:33
|
||||
msgid "Schedules:"
|
||||
msgstr "计划:"
|
||||
|
||||
#: vmbackups/templates/vmbackups/vm_tab.html:58
|
||||
msgid "No backup of this VM yet."
|
||||
msgstr "此虚拟机还没有备份。"
|
||||
|
||||
#: vmbackups/utils.py:27
|
||||
#: vmbackups/utils.py:28
|
||||
#, 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:37
|
||||
#: vmbackups/utils.py:38
|
||||
#, python-format
|
||||
msgid ""
|
||||
"Storage pool %(pool)s is backup target %(target)s; remove it from the target "
|
||||
"first"
|
||||
msgstr "存储池 %(pool)s 是备份目标 %(target)s;请先将其从目标中移除"
|
||||
|
||||
#: vmbackups/utils.py:49
|
||||
#: vmbackups/utils.py:50
|
||||
msgid "No backup target has a storage pool on this VM's host."
|
||||
msgstr "没有备份目标在此虚拟机的主机上有存储池。"
|
||||
|
||||
#: vmbackups/views.py:67 vmbackups/views.py:85
|
||||
#: vmbackups/views.py:68 vmbackups/views.py:89
|
||||
#, python-format
|
||||
msgid "Backup target %(target)s has backups; delete them first"
|
||||
msgstr "备份目标 %(target)s 中有备份;请先删除它们"
|
||||
|
||||
#: vmbackups/views.py:102
|
||||
#: vmbackups/views.py:71
|
||||
#, python-format
|
||||
msgid "Backup target %(target)s has schedules; delete them first"
|
||||
msgstr "备份目标 %(target)s 有计划;请先删除它们"
|
||||
|
||||
#: vmbackups/views.py:106
|
||||
#, 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:134
|
||||
#: vmbackups/views.py:138
|
||||
msgid "Choose a backup target"
|
||||
msgstr "请选择备份目标"
|
||||
|
||||
|
|
|
|||
|
|
@ -2,8 +2,9 @@ from django import forms
|
|||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from computes.models import Compute
|
||||
from instances.models import Instance
|
||||
|
||||
from .models import BackupTarget
|
||||
from .models import BackupPolicy, BackupTarget
|
||||
|
||||
|
||||
class TargetPoolForm(forms.Form):
|
||||
|
|
@ -44,3 +45,43 @@ class RestoreForm(forms.Form):
|
|||
super().__init__(*args, **kwargs)
|
||||
self.fields["compute"].queryset = Compute.objects.filter(backuptargetpool__target=backup.target).order_by("name")
|
||||
self.fields["name"].initial = f"{backup.vm_name}-restored"
|
||||
|
||||
|
||||
class PolicyForm(forms.ModelForm):
|
||||
"""A backup schedule: a compute's VMs or chosen VMs, all on hosts that
|
||||
have a pool of its target."""
|
||||
|
||||
class Meta:
|
||||
model = BackupPolicy
|
||||
fields = ["name", "target", "compute", "instances", "time", "keep", "frozen", "enabled"]
|
||||
labels = {"name": _("Name"), "target": _("Backup target"), "compute": _("Every VM of a compute"),
|
||||
"instances": _("Or these VMs"), "time": _("Daily at"), "keep": _("Backups to keep of each VM"),
|
||||
"frozen": _("Require frozen file systems"), "enabled": _("Enabled")}
|
||||
widgets = {"time": forms.TimeInput(attrs={"type": "time"}, format="%H:%M"),
|
||||
"instances": forms.SelectMultiple(attrs={"data-searchable": "1"})}
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
self.fields["instances"].queryset = Instance.objects.filter(is_template=False).select_related("compute").order_by(
|
||||
"name")
|
||||
self.fields["instances"].label_from_instance = lambda vm: f"{vm.name} ({vm.compute.name})"
|
||||
self.fields["keep"].validators.append(_min_one)
|
||||
self.fields["keep"].widget.attrs["min"] = 1
|
||||
|
||||
def clean(self):
|
||||
data = super().clean()
|
||||
compute, vms, target = data.get("compute"), data.get("instances"), data.get("target")
|
||||
if bool(compute) == bool(vms):
|
||||
raise forms.ValidationError(_("Choose a compute or VMs, not both"))
|
||||
if target is not None:
|
||||
hosts = {compute} if compute else {vm.compute for vm in vms}
|
||||
for host in sorted(hosts, key=lambda c: c.name):
|
||||
if target.pool_on(host) is None:
|
||||
raise forms.ValidationError(_("Backup target %(target)s has no storage pool on %(compute)s"),
|
||||
params={"target": target.name, "compute": host.name})
|
||||
return data
|
||||
|
||||
|
||||
def _min_one(value):
|
||||
if value < 1:
|
||||
raise forms.ValidationError(_("Keep one backup at least"))
|
||||
|
|
|
|||
|
|
@ -7,7 +7,8 @@
|
|||
|
||||
{% block page_heading %}{% trans "Backups" %}{% endblock page_heading %}
|
||||
|
||||
{% block page_heading_extra %}<a class="btn btn-outline-primary btn-sm" href="{% url 'vmbackups:targets' %}">{% bs_icon 'hdd-network' %} {% trans "Backup targets" %}</a>{% endblock page_heading_extra %}
|
||||
{% block page_heading_extra %}<a class="btn btn-outline-primary btn-sm" href="{% url 'vmbackups:policies' %}">{% bs_icon 'list-task' %} {% trans "Schedules" %}</a>
|
||||
<a class="btn btn-outline-primary btn-sm" href="{% url 'vmbackups:targets' %}">{% bs_icon 'hdd-network' %} {% trans "Backup targets" %}</a>{% endblock page_heading_extra %}
|
||||
|
||||
{% block content %}
|
||||
<form method="get" class="row g-2 mb-3" aria-label="{% trans "Filter" %}">
|
||||
|
|
@ -30,6 +31,7 @@
|
|||
<option value="creating"{% if state == "creating" %} selected{% endif %}>{% trans "Creating" %}</option>
|
||||
<option value="failed"{% if state == "failed" %} selected{% endif %}>{% trans "Failed" %}</option>
|
||||
<option value="deleting"{% if state == "deleting" %} selected{% endif %}>{% trans "Deleting" %}</option>
|
||||
<option value="missing"{% if state == "missing" %} selected{% endif %}>{% trans "Missing" %}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-12 col-md-auto d-grid">
|
||||
|
|
@ -41,7 +43,7 @@
|
|||
<div class="table-responsive">
|
||||
<table class="table table-hover align-middle" id="backups">
|
||||
<thead>
|
||||
<tr><th>{% trans "Time" %}</th><th>{% trans "VM" %}</th><th>{% trans "Target" %}</th><th>{% trans "Consistency" %}</th>
|
||||
<tr><th>{% trans "Time" %}</th><th>{% trans "VM" %}</th><th>{% trans "Target" %}</th><th>{% trans "Consistency" %}</th><th>{% trans "Schedule" %}</th>
|
||||
<th class="text-end">{% trans "Size" %}</th><th>{% trans "State" %}</th><th></th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
|
@ -55,6 +57,7 @@
|
|||
</td>
|
||||
<td>{{ backup.target.name }}</td>
|
||||
<td>{% include "vmbackups/consistency.html" %}</td>
|
||||
<td>{% if backup.policy %}<a href="{% url 'vmbackups:policy' backup.policy_id %}">{{ backup.policy.name }}</a>{% else %}<span class="text-body-secondary">{% trans "By hand" %}</span>{% endif %}</td>
|
||||
<td class="text-end text-nowrap">{% if backup.size %}{{ backup.size|filesizeformat }}{% else %}–{% endif %}</td>
|
||||
<td>{% include "vmbackups/state.html" %}</td>
|
||||
<td class="text-end">{% include "vmbackups/delete_form.html" %}</td>
|
||||
|
|
|
|||
45
vmbackups/templates/vmbackups/policies.html
Normal file
45
vmbackups/templates/vmbackups/policies.html
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
{% extends "base.html" %}
|
||||
{% load i18n %}
|
||||
{% load static %}
|
||||
{% load bootstrap_icons %}
|
||||
|
||||
{% block title %}{% trans "Backup schedules" %}{% endblock %}
|
||||
{% block style %}<link href="{% static 'css/tom-select.bootstrap5.min.css' %}" rel="stylesheet">{% endblock %}
|
||||
|
||||
{% block page_heading %}<a href="{% url 'vmbackups:index' %}">{% trans "Backups" %}</a> / {% trans "Schedules" %}{% endblock page_heading %}
|
||||
|
||||
{% block content %}
|
||||
{% if policies %}
|
||||
<div class="table-responsive mb-4">
|
||||
<table class="table table-hover align-middle">
|
||||
<thead>
|
||||
<tr><th>{% trans "Name" %}</th><th>{% trans "VMs" %}</th><th>{% trans "Target" %}</th><th>{% trans "Daily at" %}</th>
|
||||
<th class="text-end">{% trans "Backups kept" %}</th><th>{% trans "State" %}</th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for policy in policies %}
|
||||
<tr>
|
||||
<td><a href="{% url 'vmbackups:policy' policy.id %}">{{ policy.name }}</a></td>
|
||||
<td>{% if policy.compute %}{% blocktrans with compute=policy.compute.name %}Every VM of {{ compute }}{% endblocktrans %}{% else %}{% blocktrans count counter=policy.vm_count %}{{ counter }} VM{% plural %}{{ counter }} VMs{% endblocktrans %}{% endif %}</td>
|
||||
<td>{{ policy.target.name }}</td>
|
||||
<td>{{ policy.time|time:"H:i" }}</td>
|
||||
<td class="text-end">{{ policy.keep }}</td>
|
||||
<td>{% if policy.enabled %}<span class="badge text-bg-success">{% trans "Enabled" %}</span>{% else %}<span class="badge text-bg-secondary">{% trans "Disabled" %}</span>{% endif %}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="alert alert-info">{% trans "No backup schedule yet." %}</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="card" style="max-width: 48rem;">
|
||||
<div class="card-header fw-semibold">{% trans "Add a backup schedule" %}</div>
|
||||
<div class="card-body">{% include "vmbackups/policy_form.html" %}</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% block script %}
|
||||
<script src="{% static 'js/tom-select.complete.min.js' %}"></script>
|
||||
<script src="{% static 'js/searchable_select.js' %}"></script>
|
||||
{% endblock %}
|
||||
55
vmbackups/templates/vmbackups/policy.html
Normal file
55
vmbackups/templates/vmbackups/policy.html
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
{% extends "base.html" %}
|
||||
{% load i18n %}
|
||||
{% load static %}
|
||||
{% load bootstrap_icons %}
|
||||
|
||||
{% block title %}{{ policy.name }} - {% trans "Backup schedules" %}{% endblock %}
|
||||
{% block style %}<link href="{% static 'css/tom-select.bootstrap5.min.css' %}" rel="stylesheet">{% endblock %}
|
||||
|
||||
{% block page_heading %}<a href="{% url 'vmbackups:policies' %}">{% trans "Schedules" %}</a> / {{ policy.name }}{% endblock page_heading %}
|
||||
|
||||
{% block content %}
|
||||
<p class="text-body-secondary">{% blocktrans with owner=policy.owner.username|default:"–" %}Its jobs run as {{ owner }}, who saved it last.{% endblocktrans %}</p>
|
||||
<div class="row g-4">
|
||||
<div class="col-lg-6">
|
||||
<div class="card">
|
||||
<div class="card-body">{% include "vmbackups/policy_form.html" %}</div>
|
||||
</div>
|
||||
<form method="post" class="mt-3">
|
||||
{% csrf_token %}
|
||||
<button type="submit" name="delete" value="1" class="btn btn-outline-danger"
|
||||
data-confirm="{% trans "Delete this schedule? Its backups are kept." %}">{% bs_icon 'trash' %} {% trans "Delete schedule" %}</button>
|
||||
</form>
|
||||
</div>
|
||||
<div class="col-lg-6">
|
||||
<h2 class="h6">{% trans "Runs" %}</h2>
|
||||
{% if runs %}
|
||||
<div class="table-responsive">
|
||||
<table class="table table-sm align-middle">
|
||||
<thead><tr><th>{% trans "Day" %}</th><th>{% trans "VM" %}</th><th>{% trans "Result" %}</th></tr></thead>
|
||||
<tbody>
|
||||
{% for run in runs %}
|
||||
<tr>
|
||||
<td class="text-nowrap">{{ run.day|date:"Y-m-d" }}</td>
|
||||
<td><a href="{% url 'instances:instance' run.instance_id %}">{{ run.instance.name }}</a></td>
|
||||
<td>
|
||||
{% if run.state == "submitted" %}{% if run.operation_id %}<a href="{% url 'operations:job' run.operation_id %}">{% trans "Backup job" %}</a>{% else %}{% trans "Started" %}{% endif %}
|
||||
{% elif run.state == "skipped" %}<span class="badge text-bg-secondary">{% trans "Skipped" %}</span>
|
||||
{% else %}<span class="badge text-bg-danger">{% trans "Failed" %}</span>{% endif %}
|
||||
{% if run.note %}<div class="small text-body-secondary">{% trans run.note %}</div>{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{% else %}
|
||||
<p class="text-body-secondary">{% trans "No run yet." %}</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% block script %}
|
||||
<script src="{% static 'js/tom-select.complete.min.js' %}"></script>
|
||||
<script src="{% static 'js/searchable_select.js' %}"></script>
|
||||
{% endblock %}
|
||||
19
vmbackups/templates/vmbackups/policy_form.html
Normal file
19
vmbackups/templates/vmbackups/policy_form.html
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
{% load i18n %}{% load django_bootstrap5 %}
|
||||
<form method="post">
|
||||
{% csrf_token %}
|
||||
{% bootstrap_form_errors form type="non_fields" %}
|
||||
{% bootstrap_field form.name %}
|
||||
{% bootstrap_field form.target %}
|
||||
<div class="row g-2">
|
||||
<div class="col-md-5">{% bootstrap_field form.compute %}</div>
|
||||
<div class="col-md-7">{% bootstrap_field form.instances %}</div>
|
||||
</div>
|
||||
<div class="row g-2">
|
||||
<div class="col-6">{% blocktrans asvar zone_help %}Time zone: {{ time_zone }}{% endblocktrans %}{% bootstrap_field form.time help_text=zone_help %}</div>
|
||||
<div class="col-6">{% bootstrap_field form.keep %}</div>
|
||||
</div>
|
||||
{% bootstrap_field form.frozen %}
|
||||
{% bootstrap_field form.enabled %}
|
||||
<p class="small text-body-secondary">{% trans "Each VM is backed up once a day, starting at the time; a VM that has not started within 6 hours waits for the next day. Older backups of each VM beyond the number kept are deleted; backups taken by hand are not." %}</p>
|
||||
<button type="submit" class="btn btn-primary">{% trans "Save" %}</button>
|
||||
</form>
|
||||
|
|
@ -1 +1 @@
|
|||
{% load i18n %}{% if backup.state == "ready" %}<span class="badge text-bg-success">{% trans "Ready" %}</span>{% elif backup.state == "creating" %}<span class="badge text-bg-info">{% trans "Creating" %}</span>{% elif backup.state == "deleting" %}<span class="badge text-bg-warning">{% trans "Deleting" %}</span>{% else %}<span class="badge text-bg-danger">{% trans "Failed" %}</span>{% endif %}{% if backup.operation_id %} <a class="small" href="{% url 'operations:job' backup.operation_id %}">{% trans "Job" %}</a>{% endif %}
|
||||
{% load i18n %}{% if backup.state == "ready" %}<span class="badge text-bg-success">{% trans "Ready" %}</span>{% elif backup.state == "creating" %}<span class="badge text-bg-info">{% trans "Creating" %}</span>{% elif backup.state == "deleting" %}<span class="badge text-bg-warning">{% trans "Deleting" %}</span>{% elif backup.state == "missing" %}<span class="badge text-bg-danger" title="{% trans "Files of the backup are missing from the target" %}">{% trans "Missing" %}</span>{% else %}<span class="badge text-bg-danger">{% trans "Failed" %}</span>{% endif %}{% if backup.operation_id %} <a class="small" href="{% url 'operations:job' backup.operation_id %}">{% trans "Job" %}</a>{% endif %}
|
||||
|
|
|
|||
|
|
@ -29,6 +29,11 @@
|
|||
</form>
|
||||
{% endif %}
|
||||
|
||||
{% if backups.schedules %}
|
||||
<p class="small mt-3 mb-0">{% trans "Schedules:" %}
|
||||
{% for policy in backups.schedules %}<a href="{% url 'vmbackups:policy' policy.id %}">{{ policy.name }}</a> ({{ policy.time|time:"H:i" }}){% if not policy.enabled %} <span class="badge text-bg-secondary">{% trans "Disabled" %}</span>{% endif %}{% if not forloop.last %}, {% endif %}{% endfor %}
|
||||
</p>
|
||||
{% endif %}
|
||||
{% if backups.rows %}
|
||||
<div class="table-responsive mt-3">
|
||||
<table class="table table-sm align-middle mb-0">
|
||||
|
|
|
|||
135
vmbackups/tests/test_policies.py
Normal file
135
vmbackups/tests/test_policies.py
Normal file
|
|
@ -0,0 +1,135 @@
|
|||
"""The Schedules pages: add, edit, delete a backup schedule; its runs."""
|
||||
|
||||
import datetime
|
||||
from unittest.mock import patch
|
||||
|
||||
from django.contrib.auth import get_user_model
|
||||
from django.test import TestCase
|
||||
from django.urls import reverse
|
||||
from lxml import html as lxml_html
|
||||
|
||||
from computes.models import Compute
|
||||
from instances.models import Instance
|
||||
from instances.tests.test_page_controls import PageControls
|
||||
from logs.models import Logs
|
||||
from vmbackups.models import Backup, BackupPolicy, BackupRun, BackupTarget, BackupTargetPool
|
||||
|
||||
|
||||
class PolicyPageTests(TestCase):
|
||||
def setUp(self):
|
||||
self.admin = get_user_model().objects.create_superuser("pp_admin", "a@example.com", "pw")
|
||||
self.client.force_login(self.admin)
|
||||
self.c1 = Compute.objects.create(name="h1", hostname="192.0.2.81", login="u", password="p", type=1)
|
||||
self.c2 = Compute.objects.create(name="h2", hostname="192.0.2.82", login="u", password="p", type=1)
|
||||
self.vm1 = Instance.objects.create(compute=self.c1, name="vm1", uuid="81818181-0000-4000-8000-000000000001")
|
||||
self.vm3 = Instance.objects.create(compute=self.c2, name="vm3", uuid="81818181-0000-4000-8000-000000000003")
|
||||
self.target = BackupTarget.objects.create(name="nfs1")
|
||||
BackupTargetPool.objects.create(target=self.target, compute=self.c1, pool="b1", pool_uuid="u")
|
||||
|
||||
def post(self, **fields):
|
||||
data = {"name": "nightly", "target": self.target.pk, "time": "02:00", "keep": "7", "enabled": "on", **fields}
|
||||
return self.client.post(reverse("vmbackups:policies"), data)
|
||||
|
||||
def test_a_schedule_of_chosen_vms(self):
|
||||
response = self.post(instances=[self.vm1.pk])
|
||||
policy = BackupPolicy.objects.get()
|
||||
self.assertRedirects(response, reverse("vmbackups:policy", args=[policy.pk]), fetch_redirect_response=False)
|
||||
self.assertEqual((list(policy.instances.all()), policy.compute, policy.time, policy.keep, policy.owner),
|
||||
([self.vm1], None, datetime.time(2), 7, self.admin))
|
||||
self.assertTrue(Logs.objects.filter(message__contains="Backup schedule nightly").exists())
|
||||
|
||||
def test_a_schedule_of_a_compute(self):
|
||||
self.post(compute=self.c1.pk)
|
||||
self.assertEqual(BackupPolicy.objects.get().compute, self.c1)
|
||||
|
||||
def test_compute_or_vms_not_both_nor_neither(self):
|
||||
for fields in ({}, {"compute": self.c1.pk, "instances": [self.vm1.pk]}):
|
||||
with self.subTest(fields):
|
||||
response = self.post(**fields)
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertContains(response, "Choose a compute or VMs")
|
||||
self.assertFalse(BackupPolicy.objects.exists())
|
||||
|
||||
def test_vms_on_a_host_without_the_target_are_refused(self):
|
||||
response = self.post(instances=[self.vm3.pk])
|
||||
self.assertContains(response, "has no storage pool on h2")
|
||||
response = self.post(compute=self.c2.pk)
|
||||
self.assertContains(response, "has no storage pool on h2")
|
||||
self.assertFalse(BackupPolicy.objects.exists())
|
||||
|
||||
def test_keep_at_least_one(self):
|
||||
self.assertEqual(self.post(instances=[self.vm1.pk], keep="0").status_code, 200)
|
||||
self.assertFalse(BackupPolicy.objects.exists())
|
||||
|
||||
def schedule(self):
|
||||
policy = BackupPolicy.objects.create(name="nightly", target=self.target, time=datetime.time(2), keep=7,
|
||||
owner=self.admin)
|
||||
policy.instances.add(self.vm1)
|
||||
return policy
|
||||
|
||||
def test_edit_and_the_runs(self):
|
||||
policy = self.schedule()
|
||||
BackupRun.objects.create(policy=policy, instance=self.vm1, day=datetime.date.today(), state=BackupRun.SKIPPED,
|
||||
note="The host was in maintenance")
|
||||
url = reverse("vmbackups:policy", args=[policy.pk])
|
||||
page = self.client.get(url)
|
||||
self.assertContains(page, "The host was in maintenance")
|
||||
self.client.post(url, {"name": "nightly", "target": self.target.pk, "time": "03:30", "keep": "3",
|
||||
"instances": [self.vm1.pk]})
|
||||
policy.refresh_from_db()
|
||||
self.assertEqual((policy.time, policy.keep, policy.enabled), (datetime.time(3, 30), 3, False))
|
||||
|
||||
def test_delete_keeps_the_backups(self):
|
||||
policy = self.schedule()
|
||||
backup = Backup.objects.create(target=self.target, instance=self.vm1, vm_uuid=self.vm1.uuid, vm_name="vm1",
|
||||
compute_name="h1", state=Backup.READY, policy=policy)
|
||||
response = self.client.post(reverse("vmbackups:policy", args=[policy.pk]), {"delete": "1"})
|
||||
self.assertRedirects(response, reverse("vmbackups:policies"), fetch_redirect_response=False)
|
||||
self.assertFalse(BackupPolicy.objects.exists())
|
||||
self.assertTrue(Backup.objects.filter(pk=backup.pk, policy=None).exists())
|
||||
|
||||
def test_the_list_and_the_backups_page(self):
|
||||
policy = self.schedule()
|
||||
Backup.objects.create(target=self.target, instance=self.vm1, vm_uuid=self.vm1.uuid, vm_name="vm1",
|
||||
compute_name="h1", state=Backup.MISSING, policy=policy)
|
||||
page = lxml_html.fromstring(self.client.get(reverse("vmbackups:policies")).content)
|
||||
self.assertIn("nightly", page.xpath("string(//table)"))
|
||||
index = lxml_html.fromstring(self.client.get(reverse("vmbackups:index")).content)
|
||||
row = index.xpath("string(//table[@id='backups']/tbody/tr)")
|
||||
self.assertIn("nightly", row)
|
||||
self.assertIn("Missing", row)
|
||||
self.assertFalse(index.xpath("//a[contains(@href, '/restore/')]")) # a missing backup is not restored
|
||||
|
||||
def test_a_target_with_a_schedule_is_not_deleted(self):
|
||||
self.schedule()
|
||||
url = reverse("vmbackups:target", args=[self.target.pk])
|
||||
from django.contrib.messages import get_messages
|
||||
|
||||
response = self.client.post(url, {"delete": "1"})
|
||||
self.assertRedirects(response, url, fetch_redirect_response=False)
|
||||
self.assertIn("Backup target nfs1 has schedules; delete them first",
|
||||
[str(m) for m in get_messages(response.wsgi_request)])
|
||||
self.assertTrue(BackupTarget.objects.filter(pk=self.target.pk).exists())
|
||||
|
||||
def test_only_superusers(self):
|
||||
policy = self.schedule()
|
||||
get_user_model().objects.create_user("pp_user", password="pw")
|
||||
self.client.force_login(get_user_model().objects.get(username="pp_user"))
|
||||
self.assertEqual(self.client.get(reverse("vmbackups:policies")).status_code, 403)
|
||||
self.assertEqual(self.client.get(reverse("vmbackups:policy", args=[policy.pk])).status_code, 403)
|
||||
|
||||
|
||||
class PolicyTabTests(PageControls, TestCase):
|
||||
def test_the_vm_tab_names_its_schedules(self):
|
||||
admin = get_user_model().objects.create_superuser("pt-admin", "a@example.com", "x")
|
||||
target = BackupTarget.objects.create(name="nfs1")
|
||||
BackupTargetPool.objects.create(target=target, compute=self.compute, pool="b1", pool_uuid="u")
|
||||
chosen = BackupPolicy.objects.create(name="chosen", target=target, time=datetime.time(2), keep=2, owner=admin)
|
||||
chosen.instances.add(self.instance)
|
||||
BackupPolicy.objects.create(name="whole-host", target=target, compute=self.compute, time=datetime.time(3), keep=2,
|
||||
owner=admin)
|
||||
with patch("vmbackups.utils.wvmBackup"):
|
||||
self.controls(admin)
|
||||
tab = lxml_html.fromstring(self.last_page).xpath("string(//div[@id='backups'])")
|
||||
self.assertIn("chosen", tab)
|
||||
self.assertIn("whole-host", tab)
|
||||
|
|
@ -8,6 +8,8 @@ urlpatterns = [
|
|||
path("", views.index, name="index"),
|
||||
path("<uuid:uuid>/delete/", views.delete, name="delete"),
|
||||
path("<uuid:uuid>/restore/", views.restore, name="restore"),
|
||||
path("schedules/", views.policies, name="policies"),
|
||||
path("schedules/<int:policy_id>/", views.policy, name="policy"),
|
||||
path("targets/", views.targets, name="targets"),
|
||||
path("targets/<int:target_id>/", views.target, name="target"),
|
||||
path("vm/<int:instance_id>/create/", views.create, name="create"),
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
from django.db.models import Q
|
||||
from django.utils.translation import gettext, gettext_noop
|
||||
from libvirt import libvirtError
|
||||
from lxml import etree
|
||||
|
|
@ -6,7 +7,7 @@ from storages.forms import inside
|
|||
from vrtManager.backup import wvmBackup
|
||||
from vrtManager.util import InUse
|
||||
|
||||
from .models import Backup, BackupTarget, BackupTargetPool
|
||||
from .models import Backup, BackupPolicy, BackupTarget, BackupTargetPool
|
||||
|
||||
|
||||
def inside_vm_pool(conn, pool):
|
||||
|
|
@ -53,4 +54,6 @@ def vm_tab(instance):
|
|||
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}
|
||||
schedules = BackupPolicy.objects.filter(Q(instances=instance) | Q(compute=instance.compute_id)).distinct()
|
||||
return {"rows": instance.backups.select_related("target", "operation"), "targets": targets, "problem": problem,
|
||||
"schedules": schedules.order_by("name")}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
from django.contrib import messages
|
||||
from django.db import transaction
|
||||
from django.conf import settings
|
||||
from django.db.models import Count
|
||||
from django.shortcuts import get_object_or_404, redirect, render
|
||||
from django.urls import reverse
|
||||
|
|
@ -18,8 +19,8 @@ from vrtManager.backup import pool_space, target_pool
|
|||
from vrtManager.connection import wvmConnect
|
||||
from vrtManager.util import OperationError
|
||||
|
||||
from .forms import RestoreForm, TargetForm, TargetPoolForm
|
||||
from .models import Backup, BackupTarget
|
||||
from .forms import PolicyForm, RestoreForm, TargetForm, TargetPoolForm
|
||||
from .models import Backup, BackupPolicy, BackupTarget
|
||||
from .utils import inside_vm_pool
|
||||
|
||||
|
||||
|
|
@ -66,6 +67,9 @@ def target(request, target_id):
|
|||
if target.backups.exists():
|
||||
messages.error(request, _("Backup target %(target)s has backups; delete them first") % {"target": target.name})
|
||||
return redirect("vmbackups:target", target.id)
|
||||
if target.policies.exists():
|
||||
messages.error(request, _("Backup target %(target)s has schedules; delete them first") % {"target": target.name})
|
||||
return redirect("vmbackups:target", target.id)
|
||||
with audit(request, None, subject, "delete"):
|
||||
target.delete()
|
||||
return redirect("vmbackups:targets")
|
||||
|
|
@ -140,7 +144,7 @@ def create(request, instance_id):
|
|||
@superuser_only
|
||||
def index(request):
|
||||
"""Every backup, newest first; filtered by VM name, target and state."""
|
||||
rows = Backup.objects.select_related("target", "instance")
|
||||
rows = Backup.objects.select_related("target", "instance", "policy")
|
||||
vm, target, state = request.GET.get("vm", "").strip(), request.GET.get("target", ""), request.GET.get("state", "")
|
||||
if vm:
|
||||
rows = rows.filter(vm_name__icontains=vm)
|
||||
|
|
@ -189,3 +193,40 @@ def restore(request, uuid):
|
|||
else:
|
||||
return redirect("operations:job", op.pk)
|
||||
return render(request, "vmbackups/restore.html", {"backup": backup, "form": form})
|
||||
|
||||
|
||||
@superuser_only
|
||||
def policies(request):
|
||||
"""The backup schedules, and a new one; the superuser who saves one is its owner, whom its jobs run as."""
|
||||
form = PolicyForm(request.POST or None)
|
||||
if form.is_valid():
|
||||
with audit(request, None, f"Backup schedule {form.cleaned_data['name']}", "add"):
|
||||
policy = form.save(commit=False)
|
||||
policy.owner = request.user
|
||||
policy.save()
|
||||
form.save_m2m()
|
||||
return redirect("vmbackups:policy", policy.pk)
|
||||
rows = BackupPolicy.objects.select_related("target", "compute", "owner").annotate(vm_count=Count("instances"))
|
||||
return render(request, "vmbackups/policies.html", {"policies": rows.order_by("name"), "form": form,
|
||||
"time_zone": settings.TIME_ZONE})
|
||||
|
||||
|
||||
@superuser_only
|
||||
def policy(request, policy_id):
|
||||
policy = get_object_or_404(BackupPolicy.objects.select_related("target", "compute", "owner"), pk=policy_id)
|
||||
subject = f"Backup schedule {policy.name}"
|
||||
if request.method == "POST" and "delete" in request.POST:
|
||||
with audit(request, None, subject, "delete"): # its backups stay, without a schedule
|
||||
policy.delete()
|
||||
return redirect("vmbackups:policies")
|
||||
form = PolicyForm(request.POST or None, instance=policy)
|
||||
if form.is_valid():
|
||||
with audit(request, None, subject, "change"):
|
||||
policy = form.save(commit=False)
|
||||
policy.owner = request.user
|
||||
policy.save()
|
||||
form.save_m2m()
|
||||
return redirect("vmbackups:policy", policy.pk)
|
||||
runs = policy.runs.select_related("instance", "operation").order_by("-day", "instance__name")[:200]
|
||||
return render(request, "vmbackups/policy.html", {"policy": policy, "form": form, "runs": runs,
|
||||
"time_zone": settings.TIME_ZONE})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue