1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-12-03 17:36:05 +00:00

feat(vmbackups): back up a shut-off VM's TPM state

A VM with the panel's emulated TPM 2.0 is backed up when it is shut off:
each state file of libvirt's swtpm directory for the VM, read through a
transient pool on it, becomes a small file of the backup (role tpm),
written and read back like the NVRAM file. A running or paused VM with a
TPM is refused, and so is a TPM with its own settings (encryption, a
state path, another backend). The manifest says whether the TPM state was
copied or never written.
This commit is contained in:
catborise 2026-11-17 13:47:40 +03:00
parent a145c07601
commit 52b6096efe
11 changed files with 371 additions and 166 deletions

Binary file not shown.

View file

@ -11,7 +11,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-11-17 08:38+0000\n" "POT-Creation-Date: 2026-11-17 10:54+0000\n"
"PO-Revision-Date: 2020-11-04 12:00+0000\n" "PO-Revision-Date: 2020-11-04 12:00+0000\n"
"Last-Translator: catborise <muhammetalisag@gmail.com>, 2020\n" "Last-Translator: catborise <muhammetalisag@gmail.com>, 2020\n"
"Language-Team: Turkish (https://www.transifex.com/catborise/teams/110663/tr/)\n" "Language-Team: Turkish (https://www.transifex.com/catborise/teams/110663/tr/)\n"
@ -3291,17 +3291,17 @@ msgstr "Klonun adını boş adlar listesinden seçin"
msgid "%(quota)s: cannot create '%(clone_name)s'." msgid "%(quota)s: cannot create '%(clone_name)s'."
msgstr "%(quota)s: '%(clone_name)s' oluşturulamıyor." msgstr "%(quota)s: '%(clone_name)s' oluşturulamıyor."
#: instances/jobs.py:206 instances/jobs.py:646 vmbackups/jobs.py:539 #: instances/jobs.py:206 instances/jobs.py:646 vmbackups/jobs.py:548
#, python-format #, python-format
msgid "Instance '%(clone_name)s' already exists!" msgid "Instance '%(clone_name)s' already exists!"
msgstr "'%(clone_name)s' sanal makinesi zaten mevcut!" msgstr "'%(clone_name)s' sanal makinesi zaten mevcut!"
#: instances/jobs.py:208 vmbackups/jobs.py:541 #: instances/jobs.py:208 vmbackups/jobs.py:550
#, python-format #, python-format
msgid "Instance name '%(clone_name)s' is longer than 64 characters" msgid "Instance name '%(clone_name)s' is longer than 64 characters"
msgstr "'%(clone_name)s' sanal makine adı 64 karakterden uzun" msgstr "'%(clone_name)s' sanal makine adı 64 karakterden uzun"
#: instances/jobs.py:211 vmbackups/jobs.py:543 #: instances/jobs.py:211 vmbackups/jobs.py:552
#, python-format #, python-format
msgid "Instance name '%(clone_name)s' contains invalid characters!" msgid "Instance name '%(clone_name)s' contains invalid characters!"
msgstr "Sanal makine adı '%(clone_name)s' geçersiz karakterler içermektedir!" msgstr "Sanal makine adı '%(clone_name)s' geçersiz karakterler içermektedir!"
@ -3458,11 +3458,11 @@ msgid "Clone VM"
msgstr "Sanal makineyi klonla" msgstr "Sanal makineyi klonla"
#: instances/jobs.py:656 instances/jobs.py:663 instances/jobs.py:1005 #: instances/jobs.py:656 instances/jobs.py:663 instances/jobs.py:1005
#: vmbackups/jobs.py:234 vmbackups/jobs.py:643 #: vmbackups/jobs.py:243 vmbackups/jobs.py:652
msgid "Copying disks" msgid "Copying disks"
msgstr "Diskler kopyalanıyor" msgstr "Diskler kopyalanıyor"
#: instances/jobs.py:715 vmbackups/jobs.py:310 #: instances/jobs.py:715 vmbackups/jobs.py:319
msgid "libvirt has no result of the copy" msgid "libvirt has no result of the copy"
msgstr "libvirt'te kopyanın sonucu yok" msgstr "libvirt'te kopyanın sonucu yok"
@ -3475,7 +3475,7 @@ msgstr ""
"Kopyalama başarısız oldu: %(error)s. Konuğun dosya sistemleri çözülemedi " "Kopyalama başarısız oldu: %(error)s. Konuğun dosya sistemleri çözülemedi "
"(%(thaw)s); şununla çözün: virsh domfsthaw %(vm)s" "(%(thaw)s); şununla çözün: virsh domfsthaw %(vm)s"
#: instances/jobs.py:729 instances/jobs.py:821 vmbackups/jobs.py:316 #: instances/jobs.py:729 instances/jobs.py:821 vmbackups/jobs.py:325
msgid "The copy failed" msgid "The copy failed"
msgstr "Kopyalama başarısız oldu" msgstr "Kopyalama başarısız oldu"
@ -3497,11 +3497,11 @@ msgstr ""
"Klonun bir birimi oluşturuluyordu; şu birimleri kontrol edin, sonra bu işi " "Klonun bir birimi oluşturuluyordu; şu birimleri kontrol edin, sonra bu işi "
"çözün: %(volumes)s" "çözün: %(volumes)s"
#: instances/jobs.py:801 vmbackups/jobs.py:353 #: instances/jobs.py:801 vmbackups/jobs.py:362
msgid "The job stopped before the copy started" msgid "The job stopped before the copy started"
msgstr "İş, kopyalama başlamadan durdu" msgstr "İş, kopyalama başlamadan durdu"
#: instances/jobs.py:808 vmbackups/jobs.py:401 #: instances/jobs.py:808 vmbackups/jobs.py:410
msgid "libvirt is still copying the disks" msgid "libvirt is still copying the disks"
msgstr "libvirt diskleri hâlâ kopyalıyor" msgstr "libvirt diskleri hâlâ kopyalıyor"
@ -3542,12 +3542,12 @@ msgstr ""
msgid "Each network card needs a network" msgid "Each network card needs a network"
msgstr "Her ağ kartının bir ağı olmalı" msgstr "Her ağ kartının bir ağı olmalı"
#: instances/jobs.py:868 vrtManager/backup.py:260 vrtManager/instance.py:2871 #: instances/jobs.py:868 vrtManager/backup.py:276 vrtManager/instance.py:2871
#, python-format #, python-format
msgid "This host has no network %(name)s" msgid "This host has no network %(name)s"
msgstr "Bu sunucuda %(name)s ağı yok" msgstr "Bu sunucuda %(name)s ağı yok"
#: instances/jobs.py:870 vrtManager/backup.py:264 vrtManager/instance.py:2873 #: instances/jobs.py:870 vrtManager/backup.py:280 vrtManager/instance.py:2873
#, python-format #, python-format
msgid "This host has no network filter %(name)s" msgid "This host has no network filter %(name)s"
msgstr "Bu sunucuda %(name)s ağ filtresi yok" msgstr "Bu sunucuda %(name)s ağ filtresi yok"
@ -9832,30 +9832,30 @@ msgstr ""
"Sanal makinenin NVRAM dosyası yedeklenirken değişti; sanal makineyi yeniden " "Sanal makinenin NVRAM dosyası yedeklenirken değişti; sanal makineyi yeniden "
"yedekleyin" "yedekleyin"
#: vmbackups/jobs.py:186 #: vmbackups/jobs.py:195
msgid "Back up VM" msgid "Back up VM"
msgstr "Sanal makineyi yedekle" msgstr "Sanal makineyi yedekle"
#: vmbackups/jobs.py:221 #: vmbackups/jobs.py:230
msgid "The schedule's window ended before the backup could start" msgid "The schedule's window ended before the backup could start"
msgstr "Yedek başlayamadan zamanlamanın penceresi bitti" msgstr "Yedek başlayamadan zamanlamanın penceresi bitti"
#: vmbackups/jobs.py:223 #: vmbackups/jobs.py:232
#, python-format #, python-format
msgid "" msgid ""
"%(compute)s went into maintenance before the scheduled backup could start" "%(compute)s went into maintenance before the scheduled backup could start"
msgstr "Zamanlanmış yedek başlayamadan %(compute)s bakıma alındı" msgstr "Zamanlanmış yedek başlayamadan %(compute)s bakıma alındı"
#: vmbackups/jobs.py:250 vmbackups/jobs.py:317 #: vmbackups/jobs.py:259 vmbackups/jobs.py:326
msgid "Writing the backup's files" msgid "Writing the backup's files"
msgstr "Yedeğin dosyaları yazılıyor" msgstr "Yedeğin dosyaları yazılıyor"
#: vmbackups/jobs.py:329 #: vmbackups/jobs.py:338
msgid "The guest's file systems could not be thawed; trying again" msgid "The guest's file systems could not be thawed; trying again"
msgstr "" msgstr ""
"Konuğun dosya sistemlerinin dondurulması kaldırılamadı; yeniden deneniyor" "Konuğun dosya sistemlerinin dondurulması kaldırılamadı; yeniden deneniyor"
#: vmbackups/jobs.py:378 #: vmbackups/jobs.py:387
#, python-format #, python-format
msgid "" msgid ""
"The VM is no longer on the compute the job ran on; check these volumes of the" "The VM is no longer on the compute the job ran on; check these volumes of the"
@ -9864,7 +9864,7 @@ msgstr ""
"Sanal makine artık işin çalıştığı sunucuda değil; yedek hedefindeki şu " "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" "birimleri kontrol edin, sonra bu işi çözün: %(volumes)s"
#: vmbackups/jobs.py:395 #: vmbackups/jobs.py:404
#, python-format #, python-format
msgid "" msgid ""
"A disk was being copied when the job stopped; check these volumes of the " "A disk was being copied when the job stopped; check these volumes of the "
@ -9873,7 +9873,7 @@ msgstr ""
"İş durduğunda bir disk kopyalanıyordu; yedek hedefindeki şu birimleri kontrol" "İş durduğunda bir disk kopyalanıyordu; yedek hedefindeki şu birimleri kontrol"
" edin, sonra bu işi çözün: %(volumes)s" " edin, sonra bu işi çözün: %(volumes)s"
#: vmbackups/jobs.py:405 #: vmbackups/jobs.py:414
#, python-format #, python-format
msgid "" msgid ""
"Another backup runs on the VM; check these volumes of the backup target, then" "Another backup runs on the VM; check these volumes of the backup target, then"
@ -9882,7 +9882,7 @@ msgstr ""
"Sanal makinede başka bir yedekleme çalışıyor; yedek hedefindeki şu birimleri " "Sanal makinede başka bir yedekleme çalışıyor; yedek hedefindeki şu birimleri "
"kontrol edin, sonra bu işi çözün: %(volumes)s" "kontrol edin, sonra bu işi çözün: %(volumes)s"
#: vmbackups/jobs.py:411 #: vmbackups/jobs.py:420
#, python-format #, python-format
msgid "" msgid ""
"libvirt has no result of the copy; check these volumes of the backup target, " "libvirt has no result of the copy; check these volumes of the backup target, "
@ -9891,72 +9891,72 @@ msgstr ""
"libvirt'te kopyanın sonucu yok; yedek hedefindeki şu birimleri kontrol edin, " "libvirt'te kopyanın sonucu yok; yedek hedefindeki şu birimleri kontrol edin, "
"sonra bu işi çözün: %(volumes)s" "sonra bu işi çözün: %(volumes)s"
#: vmbackups/jobs.py:419 #: vmbackups/jobs.py:428
msgid "The job stopped before the copy ended" msgid "The job stopped before the copy ended"
msgstr "İş, kopyalama bitmeden durdu" msgstr "İş, kopyalama bitmeden durdu"
#: vmbackups/jobs.py:426 #: vmbackups/jobs.py:435
#, python-format #, python-format
msgid "The backup's files could not be written: %(error)s" msgid "The backup's files could not be written: %(error)s"
msgstr "Yedeğin dosyaları yazılamadı: %(error)s" msgstr "Yedeğin dosyaları yazılamadı: %(error)s"
#: vmbackups/jobs.py:446 #: vmbackups/jobs.py:455
#, python-format #, python-format
msgid "No compute of backup target %(target)s reaches its storage pool" msgid "No compute of backup target %(target)s reaches its storage pool"
msgstr "" msgstr ""
"%(target)s yedek hedefinin hiçbir sunucusu depolama havuzuna erişemiyor" "%(target)s yedek hedefinin hiçbir sunucusu depolama havuzuna erişemiyor"
#: vmbackups/jobs.py:480 #: vmbackups/jobs.py:489
msgid "Delete backup" msgid "Delete backup"
msgstr "Yedeği sil" msgstr "Yedeği sil"
#: vmbackups/jobs.py:491 #: vmbackups/jobs.py:500
msgid "This backup is being made; cancel its job to stop it" msgid "This backup is being made; cancel its job to stop it"
msgstr "Bu yedek alınıyor; durdurmak için işini iptal edin" msgstr "Bu yedek alınıyor; durdurmak için işini iptal edin"
#: vmbackups/jobs.py:504 #: vmbackups/jobs.py:513
msgid "The backup is no longer beyond what its schedule keeps; it is kept" msgid "The backup is no longer beyond what its schedule keeps; it is kept"
msgstr "Yedek artık zamanlamasının tuttuğu sayının dışında değil; tutuluyor" msgstr "Yedek artık zamanlamasının tuttuğu sayının dışında değil; tutuluyor"
#: vmbackups/jobs.py:556 #: vmbackups/jobs.py:565
#, python-format #, python-format
msgid "The backup's file %(name)s is missing from the target" msgid "The backup's file %(name)s is missing from the target"
msgstr "Yedeğin %(name)s dosyası hedefte yok" msgstr "Yedeğin %(name)s dosyası hedefte yok"
#: vmbackups/jobs.py:559 vmbackups/jobs.py:561 #: vmbackups/jobs.py:568 vmbackups/jobs.py:570
#, python-format #, python-format
msgid "The backup's file %(name)s differs from the one written" msgid "The backup's file %(name)s differs from the one written"
msgstr "Yedeğin %(name)s dosyası yazılandan farklı" msgstr "Yedeğin %(name)s dosyası yazılandan farklı"
#: vmbackups/jobs.py:571 vmbackups/templates/vmbackups/restore.html:7 #: vmbackups/jobs.py:580 vmbackups/templates/vmbackups/restore.html:7
msgid "Restore backup" msgid "Restore backup"
msgstr "Yedeği geri yükle" msgstr "Yedeği geri yükle"
#: vmbackups/jobs.py:584 #: vmbackups/jobs.py:593
msgid "Only a ready backup is restored" msgid "Only a ready backup is restored"
msgstr "Yalnızca hazır bir yedek geri yüklenir" msgstr "Yalnızca hazır bir yedek geri yüklenir"
#: vmbackups/jobs.py:614 #: vmbackups/jobs.py:623
#, python-format #, python-format
msgid "A VM named %(name)s exists on %(compute)s" msgid "A VM named %(name)s exists on %(compute)s"
msgstr "%(compute)s üzerinde %(name)s adlı bir sanal makine var" msgstr "%(compute)s üzerinde %(name)s adlı bir sanal makine var"
#: vmbackups/jobs.py:622 #: vmbackups/jobs.py:631
#, python-format #, python-format
msgid "This host has no active directory storage pool %(pool)s" msgid "This host has no active directory storage pool %(pool)s"
msgstr "Bu sunucuda %(pool)s adlı etkin bir dizin depolama havuzu yok" msgstr "Bu sunucuda %(pool)s adlı etkin bir dizin depolama havuzu yok"
#: vmbackups/jobs.py:639 #: vmbackups/jobs.py:648
#, python-format #, python-format
msgid "The NVRAM file %(path)s exists already" msgid "The NVRAM file %(path)s exists already"
msgstr "%(path)s NVRAM dosyası zaten var" msgstr "%(path)s NVRAM dosyası zaten var"
#: vmbackups/jobs.py:670 #: vmbackups/jobs.py:679
#, python-format #, python-format
msgid "The VM was restored; it did not start: %(error)s" msgid "The VM was restored; it did not start: %(error)s"
msgstr "Sanal makine geri yüklendi; başlamadı: %(error)s" msgstr "Sanal makine geri yüklendi; başlamadı: %(error)s"
#: vmbackups/jobs.py:692 #: vmbackups/jobs.py:701
#, python-format #, python-format
msgid "" msgid ""
"A disk was being copied when the job stopped; check this volume, then resolve" "A disk was being copied when the job stopped; check this volume, then resolve"
@ -9965,7 +9965,7 @@ msgstr ""
"İş durduğunda bir disk kopyalanıyordu; bu birimi kontrol edin, sonra bu işi " "İş durduğunda bir disk kopyalanıyordu; bu birimi kontrol edin, sonra bu işi "
"çözün: %(volumes)s" "çözün: %(volumes)s"
#: vmbackups/jobs.py:697 #: vmbackups/jobs.py:706
#, python-format #, python-format
msgid "" msgid ""
"Storage pool %(pool)s is not active; the restore's copies in it are removed " "Storage pool %(pool)s is not active; the restore's copies in it are removed "
@ -9974,15 +9974,15 @@ msgstr ""
"%(pool)s depolama havuzu etkin değil; geri yüklemenin içindeki kopyaları " "%(pool)s depolama havuzu etkin değil; geri yüklemenin içindeki kopyaları "
"havuz etkin olunca kaldırılır" "havuz etkin olunca kaldırılır"
#: vmbackups/jobs.py:706 #: vmbackups/jobs.py:715
msgid "The VM was not defined; its copies were removed" msgid "The VM was not defined; its copies were removed"
msgstr "Sanal makine tanımlanmadı; kopyaları kaldırıldı" msgstr "Sanal makine tanımlanmadı; kopyaları kaldırıldı"
#: vmbackups/jobs.py:725 vmbackups/templates/vmbackups/target.html:18 #: vmbackups/jobs.py:734 vmbackups/templates/vmbackups/target.html:18
msgid "Read backups from target" msgid "Read backups from target"
msgstr "Yedekleri hedeften oku" msgstr "Yedekleri hedeften oku"
#: vmbackups/jobs.py:773 #: vmbackups/jobs.py:782
#, python-format #, python-format
msgid "" msgid ""
"Not read, as a file of the backup is missing, changed or unreadable: " "Not read, as a file of the backup is missing, changed or unreadable: "
@ -9991,11 +9991,11 @@ msgstr ""
"Yedeğin bir dosyası eksik, değişmiş ya da okunamaz olduğu için okunmadı: " "Yedeğin bir dosyası eksik, değişmiş ya da okunamaz olduğu için okunmadı: "
"%(names)s" "%(names)s"
#: vmbackups/jobs.py:789 #: vmbackups/jobs.py:798
msgid "Check backup target" msgid "Check backup target"
msgstr "Yedek hedefini denetle" msgstr "Yedek hedefini denetle"
#: vmbackups/jobs.py:816 #: vmbackups/jobs.py:825
#, python-format #, python-format
msgid "Files of these backups are missing from the target: %(backups)s" msgid "Files of these backups are missing from the target: %(backups)s"
msgstr "Şu yedeklerin dosyaları hedefte yok: %(backups)s" msgstr "Şu yedeklerin dosyaları hedefte yok: %(backups)s"
@ -10350,62 +10350,71 @@ msgstr ""
"%(pool)s depolama havuzu bu sunucuda etkin bir dizin veya NFS havuzu değil ya" "%(pool)s depolama havuzu bu sunucuda etkin bir dizin veya NFS havuzu değil ya"
" da yedek hedefinin kaydettiği havuz değil" " da yedek hedefinin kaydettiği havuz değil"
#: vrtManager/backup.py:62 #: vrtManager/backup.py:63
#, python-format #, python-format
msgid "%(vm)s has a saved state; start it or remove the saved state first" msgid "%(vm)s has a saved state; start it or remove the saved state first"
msgstr "" msgstr ""
"%(vm)s kaydedilmiş bir durum taşıyor; önce başlatın veya kaydedilmiş durumu " "%(vm)s kaydedilmiş bir durum taşıyor; önce başlatın veya kaydedilmiş durumu "
"kaldırın" "kaldırın"
#: vrtManager/backup.py:64
#, python-format
msgid "%(vm)s has TPM state; TPM backups come later"
msgstr "%(vm)s TPM durumu taşıyor; TPM yedekleri sonra gelecek"
#: vrtManager/backup.py:66 #: vrtManager/backup.py:66
#, python-format #, python-format
msgid ""
"%(vm)s has a TPM of its own settings (encryption, a state path or another "
"backend); it cannot be backed up"
msgstr ""
"%(vm)s kendi ayarlarına sahip bir TPM taşıyor (şifreleme, durum yolu ya da "
"başka bir arka uç); yedeklenemez"
#: vrtManager/backup.py:69
#, python-format
msgid "%(vm)s has TPM state; shut it down to back it up"
msgstr "%(vm)s TPM durumu taşıyor; yedeklemek için kapatın"
#: vrtManager/backup.py:71
#, python-format
msgid "%(vm)s shares a host directory (filesystem); it cannot be backed up" msgid "%(vm)s shares a host directory (filesystem); it cannot be backed up"
msgstr "%(vm)s bir sunucu dizinini paylaşıyor (filesystem); yedeklenemez" msgstr "%(vm)s bir sunucu dizinini paylaşıyor (filesystem); yedeklenemez"
#: vrtManager/backup.py:68 #: vrtManager/backup.py:73
#, python-format #, python-format
msgid "%(vm)s boots a kernel file of the host; it cannot be backed up" msgid "%(vm)s boots a kernel file of the host; it cannot be backed up"
msgstr "%(vm)s sunucudaki bir çekirdek dosyasıyla açılıyor; yedeklenemez" msgstr "%(vm)s sunucudaki bir çekirdek dosyasıyla açılıyor; yedeklenemez"
#: vrtManager/backup.py:70 #: vrtManager/backup.py:75
#, python-format #, python-format
msgid "%(vm)s has a host device; it cannot be backed up" msgid "%(vm)s has a host device; it cannot be backed up"
msgstr "%(vm)s bir sunucu aygıtı kullanıyor; yedeklenemez" msgstr "%(vm)s bir sunucu aygıtı kullanıyor; yedeklenemez"
#: vrtManager/backup.py:76 #: vrtManager/backup.py:81
msgid "CD-ROM: not copied" msgid "CD-ROM: not copied"
msgstr "CD-ROM: kopyalanmaz" msgstr "CD-ROM: kopyalanmaz"
#: vrtManager/backup.py:76 #: vrtManager/backup.py:81
msgid "Floppy: not copied" msgid "Floppy: not copied"
msgstr "Disket: kopyalanmaz" msgstr "Disket: kopyalanmaz"
#: vrtManager/backup.py:80 #: vrtManager/backup.py:85
#, python-format #, python-format
msgid "Disk %(dev)s is encrypted; it cannot be backed up" msgid "Disk %(dev)s is encrypted; it cannot be backed up"
msgstr "%(dev)s diski şifreli; yedeklenemez" msgstr "%(dev)s diski şifreli; yedeklenemez"
#: vrtManager/backup.py:83 #: vrtManager/backup.py:88
#, python-format #, python-format
msgid "Disk %(dev)s is not a file; it cannot be backed up" msgid "Disk %(dev)s is not a file; it cannot be backed up"
msgstr "%(dev)s diski bir dosya değil; yedeklenemez" msgstr "%(dev)s diski bir dosya değil; yedeklenemez"
#: vrtManager/backup.py:85 #: vrtManager/backup.py:90
#, python-format #, python-format
msgid "Disk %(dev)s is shareable; it cannot be backed up" msgid "Disk %(dev)s is shareable; it cannot be backed up"
msgstr "%(dev)s diski paylaşılabilir; yedeklenemez" msgstr "%(dev)s diski paylaşılabilir; yedeklenemez"
#: vrtManager/backup.py:88 #: vrtManager/backup.py:93
#, python-format #, python-format
msgid "Disk %(dev)s is %(format)s; only qcow2 and raw disks are backed up" msgid "Disk %(dev)s is %(format)s; only qcow2 and raw disks are backed up"
msgstr "%(dev)s diski %(format)s; yalnızca qcow2 ve raw diskler yedeklenir" msgstr "%(dev)s diski %(format)s; yalnızca qcow2 ve raw diskler yedeklenir"
#: vrtManager/backup.py:95 #: vrtManager/backup.py:100
#, python-format #, python-format
msgid "" msgid ""
"Disk %(dev)s (%(path)s) is in no storage pool of the host; it cannot be " "Disk %(dev)s (%(path)s) is in no storage pool of the host; it cannot be "
@ -10414,7 +10423,7 @@ msgstr ""
"%(dev)s diski (%(path)s) sunucunun hiçbir depolama havuzunda değil; " "%(dev)s diski (%(path)s) sunucunun hiçbir depolama havuzunda değil; "
"yedeklenemez" "yedeklenemez"
#: vrtManager/backup.py:108 #: vrtManager/backup.py:113
#, python-format #, python-format
msgid "" msgid ""
"Disks %(devs)s change at the next start; back the VM up after it restarts" "Disks %(devs)s change at the next start; back the VM up after it restarts"
@ -10422,7 +10431,7 @@ msgstr ""
"%(devs)s diskleri sonraki başlatmada değişiyor; sanal makineyi yeniden " "%(devs)s diskleri sonraki başlatmada değişiyor; sanal makineyi yeniden "
"başladıktan sonra yedekleyin" "başladıktan sonra yedekleyin"
#: vrtManager/backup.py:113 vrtManager/instance.py:494 #: vrtManager/backup.py:118 vrtManager/instance.py:494
#, python-format #, python-format
msgid "" msgid ""
"The NVRAM file %(path)s is not in libvirt's NVRAM directory %(dir)s and " "The NVRAM file %(path)s is not in libvirt's NVRAM directory %(dir)s and "
@ -10431,7 +10440,7 @@ msgstr ""
"%(path)s NVRAM dosyası libvirt'in NVRAM dizini %(dir)s içinde değil ve " "%(path)s NVRAM dosyası libvirt'in NVRAM dizini %(dir)s içinde değil ve "
"kopyalanamaz" "kopyalanamaz"
#: vrtManager/backup.py:164 #: vrtManager/backup.py:180
#, python-format #, python-format
msgid "" msgid ""
"Storage pool %(pool)s has %(free).1f GiB free; the backup needs %(size).1f " "Storage pool %(pool)s has %(free).1f GiB free; the backup needs %(size).1f "
@ -10441,14 +10450,14 @@ msgstr ""
" gerektiriyor (kopyalanan diskler, artı bunların %%%(percent)g kadarı, en az " " gerektiriyor (kopyalanan diskler, artı bunların %%%(percent)g kadarı, en az "
"%(minimum)g GiB)" "%(minimum)g GiB)"
#: vrtManager/backup.py:177 #: vrtManager/backup.py:193
#, python-format #, python-format
msgid "" msgid ""
"The file %(name)s read back from the backup target differs from the one " "The file %(name)s read back from the backup target differs from the one "
"written" "written"
msgstr "Yedek hedefinden geri okunan %(name)s dosyası yazılandan farklı" msgstr "Yedek hedefinden geri okunan %(name)s dosyası yazılandan farklı"
#: vrtManager/backup.py:254 #: vrtManager/backup.py:270
#, python-format #, python-format
msgid "" msgid ""
"This host cannot run the VM's emulator %(emulator)s with machine type " "This host cannot run the VM's emulator %(emulator)s with machine type "
@ -10457,33 +10466,33 @@ msgstr ""
"Bu sunucu sanal makinenin %(emulator)s öykünücüsünü %(machine)s makine " "Bu sunucu sanal makinenin %(emulator)s öykünücüsünü %(machine)s makine "
"türüyle çalıştıramıyor: %(error)s" "türüyle çalıştıramıyor: %(error)s"
#: vrtManager/backup.py:258 #: vrtManager/backup.py:274
#, python-format #, python-format
msgid "This host has no firmware %(loader)s" msgid "This host has no firmware %(loader)s"
msgstr "Bu sunucuda %(loader)s firmware'i yok" msgstr "Bu sunucuda %(loader)s firmware'i yok"
#: vrtManager/backup.py:262 #: vrtManager/backup.py:278
#, python-format #, python-format
msgid "This host has no bridge %(name)s" msgid "This host has no bridge %(name)s"
msgstr "Bu sunucuda %(name)s köprüsü yok" msgstr "Bu sunucuda %(name)s köprüsü yok"
#: vrtManager/connection.py:45 #: vrtManager/connection.py:46
msgid "Connection closed (error)" msgid "Connection closed (error)"
msgstr "Bağlantı kapandı (hata)" msgstr "Bağlantı kapandı (hata)"
#: vrtManager/connection.py:46 #: vrtManager/connection.py:47
msgid "Connection closed (end of file)" msgid "Connection closed (end of file)"
msgstr "Bağlantı kapandı (dosya sonu)" msgstr "Bağlantı kapandı (dosya sonu)"
#: vrtManager/connection.py:47 #: vrtManager/connection.py:48
msgid "Connection closed (keepalive timeout)" msgid "Connection closed (keepalive timeout)"
msgstr "Bağlantı kapandı (canlı tutma zaman aşımı)" msgstr "Bağlantı kapandı (canlı tutma zaman aşımı)"
#: vrtManager/connection.py:48 #: vrtManager/connection.py:49
msgid "Connection closed (client closed)" msgid "Connection closed (client closed)"
msgstr "Bağlantı kapandı (istemci kapattı)" msgstr "Bağlantı kapandı (istemci kapattı)"
#: vrtManager/connection.py:155 #: vrtManager/connection.py:156
#, python-format #, python-format
msgid "" msgid ""
"Connection Failed: %(host)s does not answer: %(requests)s requests still wait" "Connection Failed: %(host)s does not answer: %(requests)s requests still wait"
@ -10492,36 +10501,36 @@ msgstr ""
"Bağlantı başarısız: %(host)s yanıt vermiyor: %(requests)s istek hâlâ onu " "Bağlantı başarısız: %(host)s yanıt vermiyor: %(requests)s istek hâlâ onu "
"bekliyor" "bekliyor"
#: vrtManager/connection.py:250 #: vrtManager/connection.py:253
#, python-format #, python-format
msgid "Connection Failed: %(host)s did not answer within %(seconds)s s" msgid "Connection Failed: %(host)s did not answer within %(seconds)s s"
msgstr "Bağlantı başarısız: %(host)s %(seconds)s sn içinde yanıt vermedi" msgstr "Bağlantı başarısız: %(host)s %(seconds)s sn içinde yanıt vermedi"
#: vrtManager/connection.py:261 #: vrtManager/connection.py:264
msgid "the connection closed right after opening" msgid "the connection closed right after opening"
msgstr "bağlantı açıldıktan hemen sonra kapandı" msgstr "bağlantı açıldıktan hemen sonra kapandı"
#: vrtManager/connection.py:274 #: vrtManager/connection.py:277
#, python-format #, python-format
msgid "Connection Failed: %(error)s" msgid "Connection Failed: %(error)s"
msgstr "Bağlantı başarısız: %(error)s" msgstr "Bağlantı başarısız: %(error)s"
#: vrtManager/connection.py:343 #: vrtManager/connection.py:346
#, python-format #, python-format
msgid "Connection closed (%(reason)s)" msgid "Connection closed (%(reason)s)"
msgstr "Bağlantı kapandı (%(reason)s)" msgstr "Bağlantı kapandı (%(reason)s)"
#: vrtManager/connection.py:495 #: vrtManager/connection.py:498
#, python-format #, python-format
msgid "Connection Failed: %(host)s is not connected" msgid "Connection Failed: %(host)s is not connected"
msgstr "Bağlantı başarısız: %(host)s bağlı değil" msgstr "Bağlantı başarısız: %(host)s bağlı değil"
#: vrtManager/connection.py:547 #: vrtManager/connection.py:550
#, python-format #, python-format
msgid "This host has no architecture %(arch)s" msgid "This host has no architecture %(arch)s"
msgstr "Bu sunucuda %(arch)s mimarisi yok" msgstr "Bu sunucuda %(arch)s mimarisi yok"
#: vrtManager/connection.py:1233 #: vrtManager/connection.py:1265
#, python-format #, python-format
msgid "" msgid ""
"Pool %(pool)s is not active: the files the disks of the VMs in it are made " "Pool %(pool)s is not active: the files the disks of the VMs in it are made "

Binary file not shown.

View file

@ -7,7 +7,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: \n" "Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-11-17 08:38+0000\n" "POT-Creation-Date: 2026-11-17 10:54+0000\n"
"PO-Revision-Date: \n" "PO-Revision-Date: \n"
"Last-Translator: \n" "Last-Translator: \n"
"Language-Team: \n" "Language-Team: \n"
@ -3136,17 +3136,17 @@ msgstr "请从可用名称列表中选择克隆的名称"
msgid "%(quota)s: cannot create '%(clone_name)s'." msgid "%(quota)s: cannot create '%(clone_name)s'."
msgstr "%(quota)s:无法创建“%(clone_name)s”。" msgstr "%(quota)s:无法创建“%(clone_name)s”。"
#: instances/jobs.py:206 instances/jobs.py:646 vmbackups/jobs.py:539 #: instances/jobs.py:206 instances/jobs.py:646 vmbackups/jobs.py:548
#, python-format #, python-format
msgid "Instance '%(clone_name)s' already exists!" msgid "Instance '%(clone_name)s' already exists!"
msgstr "虚拟机 '%(clone_name)s' 已存在!" msgstr "虚拟机 '%(clone_name)s' 已存在!"
#: instances/jobs.py:208 vmbackups/jobs.py:541 #: instances/jobs.py:208 vmbackups/jobs.py:550
#, python-format #, python-format
msgid "Instance name '%(clone_name)s' is longer than 64 characters" msgid "Instance name '%(clone_name)s' is longer than 64 characters"
msgstr "虚拟机名称“%(clone_name)s”超过 64 个字符" msgstr "虚拟机名称“%(clone_name)s”超过 64 个字符"
#: instances/jobs.py:211 vmbackups/jobs.py:543 #: instances/jobs.py:211 vmbackups/jobs.py:552
#, python-format #, python-format
msgid "Instance name '%(clone_name)s' contains invalid characters!" msgid "Instance name '%(clone_name)s' contains invalid characters!"
msgstr "虚拟机名称 '%(clone_name)s' 包含无效字符!" msgstr "虚拟机名称 '%(clone_name)s' 包含无效字符!"
@ -3288,11 +3288,11 @@ msgid "Clone VM"
msgstr "克隆虚拟机" msgstr "克隆虚拟机"
#: instances/jobs.py:656 instances/jobs.py:663 instances/jobs.py:1005 #: instances/jobs.py:656 instances/jobs.py:663 instances/jobs.py:1005
#: vmbackups/jobs.py:234 vmbackups/jobs.py:643 #: vmbackups/jobs.py:243 vmbackups/jobs.py:652
msgid "Copying disks" msgid "Copying disks"
msgstr "正在复制磁盘" msgstr "正在复制磁盘"
#: instances/jobs.py:715 vmbackups/jobs.py:310 #: instances/jobs.py:715 vmbackups/jobs.py:319
msgid "libvirt has no result of the copy" msgid "libvirt has no result of the copy"
msgstr "libvirt 没有复制的结果" msgstr "libvirt 没有复制的结果"
@ -3303,7 +3303,7 @@ msgid ""
"(%(thaw)s); thaw them with: virsh domfsthaw %(vm)s" "(%(thaw)s); thaw them with: virsh domfsthaw %(vm)s"
msgstr "复制失败:%(error)s。无法解冻客户机的文件系统(%(thaw)s);请用以下命令解冻:virsh domfsthaw %(vm)s" msgstr "复制失败:%(error)s。无法解冻客户机的文件系统(%(thaw)s);请用以下命令解冻:virsh domfsthaw %(vm)s"
#: instances/jobs.py:729 instances/jobs.py:821 vmbackups/jobs.py:316 #: instances/jobs.py:729 instances/jobs.py:821 vmbackups/jobs.py:325
msgid "The copy failed" msgid "The copy failed"
msgstr "复制失败" msgstr "复制失败"
@ -3321,11 +3321,11 @@ msgid ""
"this job: %(volumes)s" "this job: %(volumes)s"
msgstr "克隆的一个卷正在创建中;请检查这些卷,然后处理此任务:%(volumes)s" msgstr "克隆的一个卷正在创建中;请检查这些卷,然后处理此任务:%(volumes)s"
#: instances/jobs.py:801 vmbackups/jobs.py:353 #: instances/jobs.py:801 vmbackups/jobs.py:362
msgid "The job stopped before the copy started" msgid "The job stopped before the copy started"
msgstr "任务在复制开始前停止" msgstr "任务在复制开始前停止"
#: instances/jobs.py:808 vmbackups/jobs.py:401 #: instances/jobs.py:808 vmbackups/jobs.py:410
msgid "libvirt is still copying the disks" msgid "libvirt is still copying the disks"
msgstr "libvirt 仍在复制磁盘" msgstr "libvirt 仍在复制磁盘"
@ -3358,12 +3358,12 @@ msgstr "镜像已存在。请检查卷或更改虚拟机名称"
msgid "Each network card needs a network" msgid "Each network card needs a network"
msgstr "每个网卡都需要一个网络" msgstr "每个网卡都需要一个网络"
#: instances/jobs.py:868 vrtManager/backup.py:260 vrtManager/instance.py:2871 #: instances/jobs.py:868 vrtManager/backup.py:276 vrtManager/instance.py:2871
#, python-format #, python-format
msgid "This host has no network %(name)s" msgid "This host has no network %(name)s"
msgstr "此主机没有网络 %(name)s" msgstr "此主机没有网络 %(name)s"
#: instances/jobs.py:870 vrtManager/backup.py:264 vrtManager/instance.py:2873 #: instances/jobs.py:870 vrtManager/backup.py:280 vrtManager/instance.py:2873
#, python-format #, python-format
msgid "This host has no network filter %(name)s" msgid "This host has no network filter %(name)s"
msgstr "此主机没有网络过滤器 %(name)s" msgstr "此主机没有网络过滤器 %(name)s"
@ -9270,154 +9270,154 @@ msgid ""
"The VM's NVRAM file changed while it was backed up; back the VM up again" "The VM's NVRAM file changed while it was backed up; back the VM up again"
msgstr "虚拟机的 NVRAM 文件在备份期间发生了变化;请重新备份该虚拟机" msgstr "虚拟机的 NVRAM 文件在备份期间发生了变化;请重新备份该虚拟机"
#: vmbackups/jobs.py:186 #: vmbackups/jobs.py:195
msgid "Back up VM" msgid "Back up VM"
msgstr "备份虚拟机" msgstr "备份虚拟机"
#: vmbackups/jobs.py:221 #: vmbackups/jobs.py:230
msgid "The schedule's window ended before the backup could start" msgid "The schedule's window ended before the backup could start"
msgstr "备份开始前计划的时间窗口已结束" msgstr "备份开始前计划的时间窗口已结束"
#: vmbackups/jobs.py:223 #: vmbackups/jobs.py:232
#, python-format #, python-format
msgid "" msgid ""
"%(compute)s went into maintenance before the scheduled backup could start" "%(compute)s went into maintenance before the scheduled backup could start"
msgstr "计划的备份开始前 %(compute)s 已进入维护" msgstr "计划的备份开始前 %(compute)s 已进入维护"
#: vmbackups/jobs.py:250 vmbackups/jobs.py:317 #: vmbackups/jobs.py:259 vmbackups/jobs.py:326
msgid "Writing the backup's files" msgid "Writing the backup's files"
msgstr "正在写入备份文件" msgstr "正在写入备份文件"
#: vmbackups/jobs.py:329 #: vmbackups/jobs.py:338
msgid "The guest's file systems could not be thawed; trying again" msgid "The guest's file systems could not be thawed; trying again"
msgstr "无法解冻客户机的文件系统;正在重试" msgstr "无法解冻客户机的文件系统;正在重试"
#: vmbackups/jobs.py:378 #: vmbackups/jobs.py:387
#, python-format #, python-format
msgid "" msgid ""
"The VM is no longer on the compute the job ran on; check these volumes of the" "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" " backup target, then resolve this job: %(volumes)s"
msgstr "虚拟机已不在作业运行的计算节点上;请检查备份目标中的这些卷,然后解决此作业:%(volumes)s" msgstr "虚拟机已不在作业运行的计算节点上;请检查备份目标中的这些卷,然后解决此作业:%(volumes)s"
#: vmbackups/jobs.py:395 #: vmbackups/jobs.py:404
#, python-format #, python-format
msgid "" msgid ""
"A disk was being copied when the job stopped; check these volumes of the " "A disk was being copied when the job stopped; check these volumes of the "
"backup target, then resolve this job: %(volumes)s" "backup target, then resolve this job: %(volumes)s"
msgstr "作业停止时正在复制磁盘;请检查备份目标中的这些卷,然后解决此作业:%(volumes)s" msgstr "作业停止时正在复制磁盘;请检查备份目标中的这些卷,然后解决此作业:%(volumes)s"
#: vmbackups/jobs.py:405 #: vmbackups/jobs.py:414
#, python-format #, python-format
msgid "" msgid ""
"Another backup runs on the VM; check these volumes of the backup target, then" "Another backup runs on the VM; check these volumes of the backup target, then"
" resolve this job: %(volumes)s" " resolve this job: %(volumes)s"
msgstr "虚拟机上正在运行另一个备份;请检查备份目标中的这些卷,然后解决此作业:%(volumes)s" msgstr "虚拟机上正在运行另一个备份;请检查备份目标中的这些卷,然后解决此作业:%(volumes)s"
#: vmbackups/jobs.py:411 #: vmbackups/jobs.py:420
#, python-format #, python-format
msgid "" msgid ""
"libvirt has no result of the copy; check these volumes of the backup target, " "libvirt has no result of the copy; check these volumes of the backup target, "
"then resolve this job: %(volumes)s" "then resolve this job: %(volumes)s"
msgstr "libvirt 没有复制的结果;请检查备份目标中的这些卷,然后解决此作业:%(volumes)s" msgstr "libvirt 没有复制的结果;请检查备份目标中的这些卷,然后解决此作业:%(volumes)s"
#: vmbackups/jobs.py:419 #: vmbackups/jobs.py:428
msgid "The job stopped before the copy ended" msgid "The job stopped before the copy ended"
msgstr "作业在复制结束前停止" msgstr "作业在复制结束前停止"
#: vmbackups/jobs.py:426 #: vmbackups/jobs.py:435
#, python-format #, python-format
msgid "The backup's files could not be written: %(error)s" msgid "The backup's files could not be written: %(error)s"
msgstr "无法写入备份文件:%(error)s" msgstr "无法写入备份文件:%(error)s"
#: vmbackups/jobs.py:446 #: vmbackups/jobs.py:455
#, python-format #, python-format
msgid "No compute of backup target %(target)s reaches its storage pool" msgid "No compute of backup target %(target)s reaches its storage pool"
msgstr "备份目标 %(target)s 的计算节点都无法访问其存储池" msgstr "备份目标 %(target)s 的计算节点都无法访问其存储池"
#: vmbackups/jobs.py:480 #: vmbackups/jobs.py:489
msgid "Delete backup" msgid "Delete backup"
msgstr "删除备份" msgstr "删除备份"
#: vmbackups/jobs.py:491 #: vmbackups/jobs.py:500
msgid "This backup is being made; cancel its job to stop it" msgid "This backup is being made; cancel its job to stop it"
msgstr "此备份正在创建;要停止它,请取消其作业" msgstr "此备份正在创建;要停止它,请取消其作业"
#: vmbackups/jobs.py:504 #: vmbackups/jobs.py:513
msgid "The backup is no longer beyond what its schedule keeps; it is kept" msgid "The backup is no longer beyond what its schedule keeps; it is kept"
msgstr "该备份已不再超出其计划保留的数量;予以保留" msgstr "该备份已不再超出其计划保留的数量;予以保留"
#: vmbackups/jobs.py:556 #: vmbackups/jobs.py:565
#, python-format #, python-format
msgid "The backup's file %(name)s is missing from the target" msgid "The backup's file %(name)s is missing from the target"
msgstr "目标中缺少备份文件 %(name)s" msgstr "目标中缺少备份文件 %(name)s"
#: vmbackups/jobs.py:559 vmbackups/jobs.py:561 #: vmbackups/jobs.py:568 vmbackups/jobs.py:570
#, python-format #, python-format
msgid "The backup's file %(name)s differs from the one written" msgid "The backup's file %(name)s differs from the one written"
msgstr "备份文件 %(name)s 与写入的不同" msgstr "备份文件 %(name)s 与写入的不同"
#: vmbackups/jobs.py:571 vmbackups/templates/vmbackups/restore.html:7 #: vmbackups/jobs.py:580 vmbackups/templates/vmbackups/restore.html:7
msgid "Restore backup" msgid "Restore backup"
msgstr "恢复备份" msgstr "恢复备份"
#: vmbackups/jobs.py:584 #: vmbackups/jobs.py:593
msgid "Only a ready backup is restored" msgid "Only a ready backup is restored"
msgstr "只能恢复就绪的备份" msgstr "只能恢复就绪的备份"
#: vmbackups/jobs.py:614 #: vmbackups/jobs.py:623
#, python-format #, python-format
msgid "A VM named %(name)s exists on %(compute)s" msgid "A VM named %(name)s exists on %(compute)s"
msgstr "%(compute)s 上已存在名为 %(name)s 的虚拟机" msgstr "%(compute)s 上已存在名为 %(name)s 的虚拟机"
#: vmbackups/jobs.py:622 #: vmbackups/jobs.py:631
#, python-format #, python-format
msgid "This host has no active directory storage pool %(pool)s" msgid "This host has no active directory storage pool %(pool)s"
msgstr "此主机没有名为 %(pool)s 的活动目录存储池" msgstr "此主机没有名为 %(pool)s 的活动目录存储池"
#: vmbackups/jobs.py:639 #: vmbackups/jobs.py:648
#, python-format #, python-format
msgid "The NVRAM file %(path)s exists already" msgid "The NVRAM file %(path)s exists already"
msgstr "NVRAM 文件 %(path)s 已存在" msgstr "NVRAM 文件 %(path)s 已存在"
#: vmbackups/jobs.py:670 #: vmbackups/jobs.py:679
#, python-format #, python-format
msgid "The VM was restored; it did not start: %(error)s" msgid "The VM was restored; it did not start: %(error)s"
msgstr "虚拟机已恢复;但未能启动:%(error)s" msgstr "虚拟机已恢复;但未能启动:%(error)s"
#: vmbackups/jobs.py:692 #: vmbackups/jobs.py:701
#, python-format #, python-format
msgid "" msgid ""
"A disk was being copied when the job stopped; check this volume, then resolve" "A disk was being copied when the job stopped; check this volume, then resolve"
" this job: %(volumes)s" " this job: %(volumes)s"
msgstr "作业停止时正在复制磁盘;请检查此卷,然后解决此作业:%(volumes)s" msgstr "作业停止时正在复制磁盘;请检查此卷,然后解决此作业:%(volumes)s"
#: vmbackups/jobs.py:697 #: vmbackups/jobs.py:706
#, python-format #, python-format
msgid "" msgid ""
"Storage pool %(pool)s is not active; the restore's copies in it are removed " "Storage pool %(pool)s is not active; the restore's copies in it are removed "
"when it is" "when it is"
msgstr "存储池 %(pool)s 未激活;其中恢复的副本将在其激活后删除" msgstr "存储池 %(pool)s 未激活;其中恢复的副本将在其激活后删除"
#: vmbackups/jobs.py:706 #: vmbackups/jobs.py:715
msgid "The VM was not defined; its copies were removed" msgid "The VM was not defined; its copies were removed"
msgstr "虚拟机未定义;其副本已删除" msgstr "虚拟机未定义;其副本已删除"
#: vmbackups/jobs.py:725 vmbackups/templates/vmbackups/target.html:18 #: vmbackups/jobs.py:734 vmbackups/templates/vmbackups/target.html:18
msgid "Read backups from target" msgid "Read backups from target"
msgstr "从目标读取备份" msgstr "从目标读取备份"
#: vmbackups/jobs.py:773 #: vmbackups/jobs.py:782
#, python-format #, python-format
msgid "" msgid ""
"Not read, as a file of the backup is missing, changed or unreadable: " "Not read, as a file of the backup is missing, changed or unreadable: "
"%(names)s" "%(names)s"
msgstr "由于备份的某个文件缺失、已更改或无法读取,未读取:%(names)s" msgstr "由于备份的某个文件缺失、已更改或无法读取,未读取:%(names)s"
#: vmbackups/jobs.py:789 #: vmbackups/jobs.py:798
msgid "Check backup target" msgid "Check backup target"
msgstr "检查备份目标" msgstr "检查备份目标"
#: vmbackups/jobs.py:816 #: vmbackups/jobs.py:825
#, python-format #, python-format
msgid "Files of these backups are missing from the target: %(backups)s" msgid "Files of these backups are missing from the target: %(backups)s"
msgstr "以下备份的文件在目标中缺失:%(backups)s" msgstr "以下备份的文件在目标中缺失:%(backups)s"
@ -9744,80 +9744,87 @@ msgid ""
" not the one the backup target registered" " not the one the backup target registered"
msgstr "存储池 %(pool)s 不是此主机上活动的目录或 NFS 存储池,或不是备份目标登记的那个存储池" msgstr "存储池 %(pool)s 不是此主机上活动的目录或 NFS 存储池,或不是备份目标登记的那个存储池"
#: vrtManager/backup.py:62 #: vrtManager/backup.py:63
#, python-format #, python-format
msgid "%(vm)s has a saved state; start it or remove the saved state first" msgid "%(vm)s has a saved state; start it or remove the saved state first"
msgstr "%(vm)s 有已保存的状态;请先启动它或删除已保存的状态" msgstr "%(vm)s 有已保存的状态;请先启动它或删除已保存的状态"
#: vrtManager/backup.py:64
#, python-format
msgid "%(vm)s has TPM state; TPM backups come later"
msgstr "%(vm)s 有 TPM 状态;TPM 备份将在以后支持"
#: vrtManager/backup.py:66 #: vrtManager/backup.py:66
#, python-format #, python-format
msgid ""
"%(vm)s has a TPM of its own settings (encryption, a state path or another "
"backend); it cannot be backed up"
msgstr "%(vm)s 的 TPM 有自己的设置(加密、状态路径或其他后端);无法备份"
#: vrtManager/backup.py:69
#, python-format
msgid "%(vm)s has TPM state; shut it down to back it up"
msgstr "%(vm)s 有 TPM 状态;请将其关机后再备份"
#: vrtManager/backup.py:71
#, python-format
msgid "%(vm)s shares a host directory (filesystem); it cannot be backed up" msgid "%(vm)s shares a host directory (filesystem); it cannot be backed up"
msgstr "%(vm)s 共享主机目录(filesystem);无法备份" msgstr "%(vm)s 共享主机目录(filesystem);无法备份"
#: vrtManager/backup.py:68 #: vrtManager/backup.py:73
#, python-format #, python-format
msgid "%(vm)s boots a kernel file of the host; it cannot be backed up" msgid "%(vm)s boots a kernel file of the host; it cannot be backed up"
msgstr "%(vm)s 从主机上的内核文件启动;无法备份" msgstr "%(vm)s 从主机上的内核文件启动;无法备份"
#: vrtManager/backup.py:70 #: vrtManager/backup.py:75
#, python-format #, python-format
msgid "%(vm)s has a host device; it cannot be backed up" msgid "%(vm)s has a host device; it cannot be backed up"
msgstr "%(vm)s 有主机设备;无法备份" msgstr "%(vm)s 有主机设备;无法备份"
#: vrtManager/backup.py:76 #: vrtManager/backup.py:81
msgid "CD-ROM: not copied" msgid "CD-ROM: not copied"
msgstr "CD-ROM:不复制" msgstr "CD-ROM:不复制"
#: vrtManager/backup.py:76 #: vrtManager/backup.py:81
msgid "Floppy: not copied" msgid "Floppy: not copied"
msgstr "软盘:不复制" msgstr "软盘:不复制"
#: vrtManager/backup.py:80 #: vrtManager/backup.py:85
#, python-format #, python-format
msgid "Disk %(dev)s is encrypted; it cannot be backed up" msgid "Disk %(dev)s is encrypted; it cannot be backed up"
msgstr "磁盘 %(dev)s 已加密;无法备份" msgstr "磁盘 %(dev)s 已加密;无法备份"
#: vrtManager/backup.py:83 #: vrtManager/backup.py:88
#, python-format #, python-format
msgid "Disk %(dev)s is not a file; it cannot be backed up" msgid "Disk %(dev)s is not a file; it cannot be backed up"
msgstr "磁盘 %(dev)s 不是文件;无法备份" msgstr "磁盘 %(dev)s 不是文件;无法备份"
#: vrtManager/backup.py:85 #: vrtManager/backup.py:90
#, python-format #, python-format
msgid "Disk %(dev)s is shareable; it cannot be backed up" msgid "Disk %(dev)s is shareable; it cannot be backed up"
msgstr "磁盘 %(dev)s 可共享;无法备份" msgstr "磁盘 %(dev)s 可共享;无法备份"
#: vrtManager/backup.py:88 #: vrtManager/backup.py:93
#, python-format #, python-format
msgid "Disk %(dev)s is %(format)s; only qcow2 and raw disks are backed up" msgid "Disk %(dev)s is %(format)s; only qcow2 and raw disks are backed up"
msgstr "磁盘 %(dev)s 是 %(format)s 格式;只备份 qcow2 和 raw 磁盘" msgstr "磁盘 %(dev)s 是 %(format)s 格式;只备份 qcow2 和 raw 磁盘"
#: vrtManager/backup.py:95 #: vrtManager/backup.py:100
#, python-format #, python-format
msgid "" msgid ""
"Disk %(dev)s (%(path)s) is in no storage pool of the host; it cannot be " "Disk %(dev)s (%(path)s) is in no storage pool of the host; it cannot be "
"backed up" "backed up"
msgstr "磁盘 %(dev)s(%(path)s)不在主机的任何存储池中;无法备份" msgstr "磁盘 %(dev)s(%(path)s)不在主机的任何存储池中;无法备份"
#: vrtManager/backup.py:108 #: vrtManager/backup.py:113
#, python-format #, python-format
msgid "" msgid ""
"Disks %(devs)s change at the next start; back the VM up after it restarts" "Disks %(devs)s change at the next start; back the VM up after it restarts"
msgstr "磁盘 %(devs)s 将在下次启动时更改;请在虚拟机重启后再备份" msgstr "磁盘 %(devs)s 将在下次启动时更改;请在虚拟机重启后再备份"
#: vrtManager/backup.py:113 vrtManager/instance.py:494 #: vrtManager/backup.py:118 vrtManager/instance.py:494
#, python-format #, python-format
msgid "" msgid ""
"The NVRAM file %(path)s is not in libvirt's NVRAM directory %(dir)s and " "The NVRAM file %(path)s is not in libvirt's NVRAM directory %(dir)s and "
"cannot be copied" "cannot be copied"
msgstr "NVRAM 文件 %(path)s 不在 libvirt 的 NVRAM 目录 %(dir)s 中,无法复制" msgstr "NVRAM 文件 %(path)s 不在 libvirt 的 NVRAM 目录 %(dir)s 中,无法复制"
#: vrtManager/backup.py:164 #: vrtManager/backup.py:180
#, python-format #, python-format
msgid "" msgid ""
"Storage pool %(pool)s has %(free).1f GiB free; the backup needs %(size).1f " "Storage pool %(pool)s has %(free).1f GiB free; the backup needs %(size).1f "
@ -9826,83 +9833,83 @@ msgstr ""
"存储池 %(pool)s 有 %(free).1f GiB 可用空间;备份需要 %(size).1f GiB(复制的磁盘,加上其 " "存储池 %(pool)s 有 %(free).1f GiB 可用空间;备份需要 %(size).1f GiB(复制的磁盘,加上其 "
"%(percent)g%%,至少 %(minimum)g GiB)" "%(percent)g%%,至少 %(minimum)g GiB)"
#: vrtManager/backup.py:177 #: vrtManager/backup.py:193
#, python-format #, python-format
msgid "" msgid ""
"The file %(name)s read back from the backup target differs from the one " "The file %(name)s read back from the backup target differs from the one "
"written" "written"
msgstr "从备份目标读回的文件 %(name)s 与写入的不同" msgstr "从备份目标读回的文件 %(name)s 与写入的不同"
#: vrtManager/backup.py:254 #: vrtManager/backup.py:270
#, python-format #, python-format
msgid "" msgid ""
"This host cannot run the VM's emulator %(emulator)s with machine type " "This host cannot run the VM's emulator %(emulator)s with machine type "
"%(machine)s: %(error)s" "%(machine)s: %(error)s"
msgstr "此主机无法以机器类型 %(machine)s 运行虚拟机的模拟器 %(emulator)s:%(error)s" msgstr "此主机无法以机器类型 %(machine)s 运行虚拟机的模拟器 %(emulator)s:%(error)s"
#: vrtManager/backup.py:258 #: vrtManager/backup.py:274
#, python-format #, python-format
msgid "This host has no firmware %(loader)s" msgid "This host has no firmware %(loader)s"
msgstr "此主机没有固件 %(loader)s" msgstr "此主机没有固件 %(loader)s"
#: vrtManager/backup.py:262 #: vrtManager/backup.py:278
#, python-format #, python-format
msgid "This host has no bridge %(name)s" msgid "This host has no bridge %(name)s"
msgstr "此主机没有网桥 %(name)s" msgstr "此主机没有网桥 %(name)s"
#: vrtManager/connection.py:45 #: vrtManager/connection.py:46
msgid "Connection closed (error)" msgid "Connection closed (error)"
msgstr "连接已关闭(错误)" msgstr "连接已关闭(错误)"
#: vrtManager/connection.py:46 #: vrtManager/connection.py:47
msgid "Connection closed (end of file)" msgid "Connection closed (end of file)"
msgstr "连接已关闭(文件结束)" msgstr "连接已关闭(文件结束)"
#: vrtManager/connection.py:47 #: vrtManager/connection.py:48
msgid "Connection closed (keepalive timeout)" msgid "Connection closed (keepalive timeout)"
msgstr "连接已关闭(保活超时)" msgstr "连接已关闭(保活超时)"
#: vrtManager/connection.py:48 #: vrtManager/connection.py:49
msgid "Connection closed (client closed)" msgid "Connection closed (client closed)"
msgstr "连接已关闭(客户端已关闭)" msgstr "连接已关闭(客户端已关闭)"
#: vrtManager/connection.py:155 #: vrtManager/connection.py:156
#, python-format #, python-format
msgid "" msgid ""
"Connection Failed: %(host)s does not answer: %(requests)s requests still wait" "Connection Failed: %(host)s does not answer: %(requests)s requests still wait"
" for it" " for it"
msgstr "连接失败:%(host)s 无响应:仍有 %(requests)s 个请求在等待它" msgstr "连接失败:%(host)s 无响应:仍有 %(requests)s 个请求在等待它"
#: vrtManager/connection.py:250 #: vrtManager/connection.py:253
#, python-format #, python-format
msgid "Connection Failed: %(host)s did not answer within %(seconds)s s" msgid "Connection Failed: %(host)s did not answer within %(seconds)s s"
msgstr "连接失败:%(host)s 在 %(seconds)s 秒内未响应" msgstr "连接失败:%(host)s 在 %(seconds)s 秒内未响应"
#: vrtManager/connection.py:261 #: vrtManager/connection.py:264
msgid "the connection closed right after opening" msgid "the connection closed right after opening"
msgstr "连接在打开后立即关闭" msgstr "连接在打开后立即关闭"
#: vrtManager/connection.py:274 #: vrtManager/connection.py:277
#, python-format #, python-format
msgid "Connection Failed: %(error)s" msgid "Connection Failed: %(error)s"
msgstr "连接失败:%(error)s" msgstr "连接失败:%(error)s"
#: vrtManager/connection.py:343 #: vrtManager/connection.py:346
#, python-format #, python-format
msgid "Connection closed (%(reason)s)" msgid "Connection closed (%(reason)s)"
msgstr "连接已关闭(%(reason)s)" msgstr "连接已关闭(%(reason)s)"
#: vrtManager/connection.py:495 #: vrtManager/connection.py:498
#, python-format #, python-format
msgid "Connection Failed: %(host)s is not connected" msgid "Connection Failed: %(host)s is not connected"
msgstr "连接失败:%(host)s 未连接" msgstr "连接失败:%(host)s 未连接"
#: vrtManager/connection.py:547 #: vrtManager/connection.py:550
#, python-format #, python-format
msgid "This host has no architecture %(arch)s" msgid "This host has no architecture %(arch)s"
msgstr "此主机没有 %(arch)s 架构" msgstr "此主机没有 %(arch)s 架构"
#: vrtManager/connection.py:1233 #: vrtManager/connection.py:1265
#, python-format #, python-format
msgid "" msgid ""
"Pool %(pool)s is not active: the files the disks of the VMs in it are made " "Pool %(pool)s is not active: the files the disks of the VMs in it are made "

View file

@ -141,6 +141,12 @@ def _publish(op, proxy, pool):
if nvram is not None: if nvram is not None:
files.append({"role": BackupFile.NVRAM, "dev": "", "volume": names["nvram"], "format": "raw", 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())}) "capacity": len(nvram), "size": len(nvram), "sha256": put_file(proxy, pool, names["nvram"], nvram, _owner())})
# a shut-off VM's (a running one with a TPM is refused); a secret: no other user reads it
tpm = proxy.read_tpm() if plan["tpm"] else None
for name, data in (tpm or {}).items():
files.append({"role": BackupFile.TPM, "dev": name, "volume": names["tpm"] + name, "format": "raw",
"capacity": len(data), "size": len(data),
"sha256": put_file(proxy, pool, names["tpm"] + name, data, _owner(), mode="0600")})
definition = plan["definition"].encode() definition = plan["definition"].encode()
files.append({"role": BackupFile.DOMAIN, "dev": "", "volume": names["domain"], "format": "", "capacity": len(definition), 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())}) "size": len(definition), "sha256": put_file(proxy, pool, names["domain"], definition, _owner())})
@ -152,6 +158,7 @@ def _publish(op, proxy, pool):
"created_at": backup.created_at.isoformat(), "created_at": backup.created_at.isoformat(),
"consistency": op.intent["consistency"], "consistency": op.intent["consistency"],
"nvram": "copied" if nvram is not None else ("never written" if plan["nvram"] else "none"), "nvram": "copied" if nvram is not None else ("never written" if plan["nvram"] else "none"),
"tpm": "copied" if tpm else ("never written" if tpm == {} else "none"),
"files": files, "files": files,
"left_out": plan["left_out"], "left_out": plan["left_out"],
"libvirt": proxy.wvm.getLibVersion(), "libvirt": proxy.wvm.getLibVersion(),
@ -173,7 +180,9 @@ def _publish(op, proxy, pool):
def _discard(op, pool): def _discard(op, pool):
"""The job's files removed, its row failed.""" """The job's files removed, its row failed."""
remove_files(pool, _all_names(op.intent["names"])) pool.refresh(0) # the TPM state files are named by what the VM had
names = op.intent["names"]
remove_files(pool, [*_all_names(names), *(n for n in pool.listVolumes() if n.startswith(names["tpm"]))])
Backup.objects.filter(uuid=op.intent["backup"]).update(state=Backup.FAILED, finished_at=timezone.now()) Backup.objects.filter(uuid=op.intent["backup"]).update(state=Backup.FAILED, finished_at=timezone.now())

View file

@ -0,0 +1,18 @@
# Generated by Django 5.2.18 on 2026-11-17 10:46
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('vmbackups', '0002_schedules'),
]
operations = [
migrations.AlterField(
model_name='backupfile',
name='role',
field=models.CharField(choices=[('disk', 'disk'), ('nvram', 'nvram'), ('tpm', 'tpm'), ('domain', 'domain'), ('manifest', 'manifest')], max_length=16),
),
]

View file

@ -115,12 +115,12 @@ class Backup(models.Model):
class BackupFile(models.Model): class BackupFile(models.Model):
DISK, NVRAM, DOMAIN, MANIFEST = "disk", "nvram", "domain", "manifest" DISK, NVRAM, TPM, DOMAIN, MANIFEST = "disk", "nvram", "tpm", "domain", "manifest"
ROLES = [(DISK, "disk"), (NVRAM, "nvram"), (DOMAIN, "domain"), (MANIFEST, "manifest")] ROLES = [(DISK, "disk"), (NVRAM, "nvram"), (TPM, "tpm"), (DOMAIN, "domain"), (MANIFEST, "manifest")]
backup = models.ForeignKey(Backup, on_delete=models.CASCADE, related_name="files") backup = models.ForeignKey(Backup, on_delete=models.CASCADE, related_name="files")
role = models.CharField(max_length=16, choices=ROLES) role = models.CharField(max_length=16, choices=ROLES)
dev = models.CharField(max_length=32, blank=True) dev = models.CharField(max_length=32, blank=True) # a disk's target, a TPM state file's name
volume = models.CharField(max_length=255) volume = models.CharField(max_length=255)
format = models.CharField(max_length=16, blank=True) format = models.CharField(max_length=16, blank=True)
capacity = models.BigIntegerField(default=0) capacity = models.BigIntegerField(default=0)

View file

@ -31,11 +31,12 @@ def libvirt_error(text="x"):
return libvirt.libvirtError(text) return libvirt.libvirtError(text)
def plan(nvram=None): def plan(nvram=None, tpm=False):
return { return {
"definition": "<domain><name>vm1</name></domain>", "definition": "<domain><name>vm1</name></domain>",
"disks": [{"dev": "vda", "path": "/pool/a.qcow2", "pool": "default", "format": "qcow2", "capacity": GIB}], "disks": [{"dev": "vda", "path": "/pool/a.qcow2", "pool": "default", "format": "qcow2", "capacity": GIB}],
"nvram": nvram, "nvram": nvram,
"tpm": tpm,
"left_out": [{"dev": "sda", "why": "CD-ROM: not copied"}], "left_out": [{"dev": "sda", "why": "CD-ROM: not copied"}],
} }
@ -53,6 +54,7 @@ def proxy(status=libvirt.VIR_DOMAIN_SHUTOFF, nvram=None):
p.backup_progress.return_value = None p.backup_progress.return_value = None
p.backup_result.return_value = (True, "") p.backup_result.return_value = (True, "")
p.read_nvram.return_value = b"vars" p.read_nvram.return_value = b"vars"
p.read_tpm.return_value = {"tpm2-00.permall": b"state"}
return p return p
@ -75,11 +77,12 @@ class CreateBackupTests(TransactionTestCase):
self.proxy = proxy() self.proxy = proxy()
self.pool = target_pool() self.pool = target_pool()
self.written = [] self.written = []
self.modes = {}
self.removed = [] self.removed = []
for name, value in ( for name, value in (
("vmbackups.jobs.wvmBackup", MagicMock(return_value=self.proxy)), ("vmbackups.jobs.wvmBackup", MagicMock(return_value=self.proxy)),
("vmbackups.jobs.target_pool", MagicMock(return_value=self.pool)), ("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.put_file", MagicMock(side_effect=self.put_file)),
("vmbackups.jobs.remove_files", MagicMock(side_effect=lambda pool, names: self.removed.extend(names))), ("vmbackups.jobs.remove_files", MagicMock(side_effect=lambda pool, names: self.removed.extend(names))),
("vmbackups.jobs.NVRAM_WAIT", 0), ("vmbackups.jobs.NVRAM_WAIT", 0),
("vmbackups.jobs.PROGRESS_EVERY", 0), ("vmbackups.jobs.PROGRESS_EVERY", 0),
@ -88,6 +91,15 @@ class CreateBackupTests(TransactionTestCase):
patcher.start() patcher.start()
self.addCleanup(patcher.stop) self.addCleanup(patcher.stop)
fail_on = None
def put_file(self, conn, pool, name, data, owner, mode="0644"):
if self.fail_on and name.endswith(self.fail_on):
raise libvirt_error("No space left on device")
self.written.append(name)
self.modes[name] = mode
return "sha"
def submit(self, frozen=False): def submit(self, frozen=False):
op = jobs.submit("backup.create", self.admin, {"instance": self.vm.pk, "target": self.target.pk, "frozen": frozen}, op = jobs.submit("backup.create", self.admin, {"instance": self.vm.pk, "target": self.target.pk, "frozen": frozen},
f"key-{uuid4().hex[:12]}") f"key-{uuid4().hex[:12]}")
@ -123,6 +135,37 @@ class CreateBackupTests(TransactionTestCase):
self.assertEqual((files["disk"].dev, files["disk"].capacity, files["disk"].size), ("vda", GIB, GIB // 2)) 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["left_out"], plan()["left_out"])
self.assertEqual(backup.manifest["consistency"], "offline") self.assertEqual(backup.manifest["consistency"], "offline")
self.assertEqual(backup.manifest["tpm"], "none")
def test_a_shut_off_vms_tpm_state_is_kept(self):
self.proxy.backup_plan.return_value = plan(tpm=True)
op = self.submit()
self.run_job(op)
prefix = f"wvc-{op.intent['backup']}"
self.assertEqual(self.written, [f"{prefix}-tpm-tpm2-00.permall", f"{prefix}-domain.xml", f"{prefix}-manifest.json"])
self.assertEqual(self.modes[f"{prefix}-tpm-tpm2-00.permall"], "0600") # a secret
tpm = self.backup(op).files.get(role=BackupFile.TPM)
self.assertEqual((tpm.dev, tpm.volume, tpm.size, tpm.sha256), ("tpm2-00.permall", f"{prefix}-tpm-tpm2-00.permall", 5, "sha"))
self.assertEqual(self.backup(op).manifest["tpm"], "copied")
def test_a_tpm_that_never_started_is_said_so(self):
self.proxy.backup_plan.return_value = plan(tpm=True)
self.proxy.read_tpm.return_value = {}
op = self.submit()
self.run_job(op)
self.assertEqual(self.backup(op).manifest["tpm"], "never written")
self.assertFalse(self.backup(op).files.filter(role=BackupFile.TPM).exists())
def test_a_failed_backup_removes_the_tpm_files_it_wrote(self):
self.proxy.backup_plan.return_value = plan(tpm=True)
op = self.submit()
prefix = f"wvc-{op.intent['backup']}"
self.pool.listVolumes.return_value = [f"{prefix}-tpm-tpm2-00.permall", "wvc-00000000-0000-4000-8000-000000000009-tpm-x"]
self.fail_on = "-domain.xml" # once the TPM file is written
op = self.interrupted(op)
self.assertEqual(CreateBackup().reconcile(op).state, Operation.FAILED)
self.assertIn(f"{prefix}-tpm-tpm2-00.permall", self.removed)
self.assertNotIn("wvc-00000000-0000-4000-8000-000000000009-tpm-x", self.removed)
def test_a_running_vm_is_frozen_backed_up_and_thawed(self): def test_a_running_vm_is_frozen_backed_up_and_thawed(self):
self.proxy.get_status.return_value = libvirt.VIR_DOMAIN_RUNNING self.proxy.get_status.return_value = libvirt.VIR_DOMAIN_RUNNING

View file

@ -54,14 +54,19 @@ class wvmBackup(wvmInstance):
def backup_plan(self): def backup_plan(self):
"""What a backup of the VM copies, from its persistent definition: """What a backup of the VM copies, from its persistent definition:
{"definition", "disks": [{dev, path, pool, format, capacity}], {"definition", "disks": [{dev, path, pool, format, capacity}],
"nvram": path or None, "left_out": [{dev, why}]}. Refuses, naming "nvram": path or None, "tpm": whether it has a TPM (shut off: its
state is read by the job), "left_out": [{dev, why}]}. Refuses, naming
why, a VM whose backup could not be restored as it is.""" why, a VM whose backup could not be restored as it is."""
tree = etree.fromstring(self._XMLDesc(PERSISTENT_XML)) tree = etree.fromstring(self._XMLDesc(PERSISTENT_XML))
name = self.instance.name() name = self.instance.name()
if self.instance.hasManagedSaveImage(0): if self.instance.hasManagedSaveImage(0):
raise OperationError(gettext_noop("%(vm)s has a saved state; start it or remove the saved state first"), vm=name) raise OperationError(gettext_noop("%(vm)s has a saved state; start it or remove the saved state first"), vm=name)
if tree.find("devices/tpm") is not None: tpm = self.get_tpm()
raise OperationError(gettext_noop("%(vm)s has TPM state; TPM backups come later"), vm=name) if tpm == "custom":
raise OperationError(gettext_noop("%(vm)s has a TPM of its own settings (encryption, a state path or "
"another backend); it cannot be backed up"), vm=name)
if tpm and self.instance.state()[0] != libvirt.VIR_DOMAIN_SHUTOFF:
raise OperationError(gettext_noop("%(vm)s has TPM state; shut it down to back it up"), vm=name)
if tree.find("devices/filesystem") is not None: if tree.find("devices/filesystem") is not None:
raise OperationError(gettext_noop("%(vm)s shares a host directory (filesystem); it cannot be backed up"), vm=name) raise OperationError(gettext_noop("%(vm)s shares a host directory (filesystem); it cannot be backed up"), vm=name)
if tree.xpath("os/kernel|os/initrd|os/dtb"): if tree.xpath("os/kernel|os/initrd|os/dtb"):
@ -112,7 +117,8 @@ class wvmBackup(wvmInstance):
if nvram and os.path.dirname(nvram) != NVRAM_DIR: if nvram and os.path.dirname(nvram) != NVRAM_DIR:
raise OperationError(gettext_noop("The NVRAM file %(path)s is not in libvirt's NVRAM directory %(dir)s and cannot be copied"), raise OperationError(gettext_noop("The NVRAM file %(path)s is not in libvirt's NVRAM directory %(dir)s and cannot be copied"),
path=nvram, dir=NVRAM_DIR) path=nvram, dir=NVRAM_DIR)
return {"definition": etree.tostring(tree).decode(), "disks": disks, "nvram": nvram, "left_out": left_out} return {"definition": etree.tostring(tree).decode(), "disks": disks, "nvram": nvram, "tpm": bool(tpm),
"left_out": left_out}
def copy_disk_offline(self, disk, pool, name, owner_uid, owner_gid): def copy_disk_offline(self, disk, pool, name, owner_uid, owner_gid):
"""A shut-off VM's disk copied into the target pool, flat, in its """A shut-off VM's disk copied into the target pool, flat, in its
@ -140,6 +146,15 @@ class wvmBackup(wvmInstance):
vol = self._find_volume(pool, os.path.basename(path)) vol = self._find_volume(pool, os.path.basename(path))
return None if vol is None else self.download_volume(vol) return None if vol is None else self.download_volume(vol)
def read_tpm(self):
"""The shut-off VM's TPM state files: {name: bytes}, {} when it never
started. swtpm's .lock is not state."""
with self._tpm_pool(self.instance.UUIDString()) as pool:
if pool is None:
return {}
return {name: self.download_volume(pool.storageVolLookupByName(name))
for name in sorted(pool.listVolumes()) if not name.startswith(".")}
def backup_file_names(uuid, disks, nvram): def backup_file_names(uuid, disks, nvram):
"""The names of a backup's files in the target pool, from its UUID only.""" """The names of a backup's files in the target pool, from its UUID only."""
@ -147,6 +162,7 @@ def backup_file_names(uuid, disks, nvram):
return { return {
"disks": {d["dev"]: f"{prefix}-{d['dev']}.{'qcow2' if d['format'] == 'qcow2' else 'raw'}" for d in disks}, "disks": {d["dev"]: f"{prefix}-{d['dev']}.{'qcow2' if d['format'] == 'qcow2' else 'raw'}" for d in disks},
"nvram": f"{prefix}-nvram.fd" if nvram else None, "nvram": f"{prefix}-nvram.fd" if nvram else None,
"tpm": f"{prefix}-tpm-", # and the state file's name
"domain": f"{prefix}-domain.xml", "domain": f"{prefix}-domain.xml",
"manifest": f"{prefix}-manifest.json", "manifest": f"{prefix}-manifest.json",
} }
@ -166,12 +182,12 @@ def check_target_space(pool, disks, free_percent, free_min_gib):
pool=pool.name(), free=free / 1024**3, size=needed / 1024**3, percent=free_percent, minimum=free_min_gib) pool=pool.name(), free=free / 1024**3, size=needed / 1024**3, percent=free_percent, minimum=free_min_gib)
def put_file(conn, pool, name, data, owner): def put_file(conn, pool, name, data, owner, mode="0644"):
"""Writes a small file of a backup into the target pool as owner (uid, """Writes a small file of a backup into the target pool as owner (uid,
gid), replacing one of that name, and reads it back. Returns its gid) with mode, replacing one of that name, and reads it back. Returns
SHA-256.""" its SHA-256."""
remove_files(pool, [name]) remove_files(pool, [name])
vol = conn.upload_volume(pool, name, data, owner=owner) vol = conn.upload_volume(pool, name, data, owner=owner, mode=mode)
if conn.download_volume(vol) != data: if conn.download_volume(vol) != data:
vol.delete(0) vol.delete(0)
raise OperationError(gettext_noop("The file %(name)s read back from the backup target differs from the one written"), name=name) raise OperationError(gettext_noop("The file %(name)s read back from the backup target differs from the one written"), name=name)

View file

@ -1,5 +1,6 @@
from django.utils.translation import gettext_noop from django.utils.translation import gettext_noop
import contextlib import contextlib
import errno
import io import io
import logging import logging
import os import os
@ -188,6 +189,8 @@ request_finished.connect(_request_finished, dispatch_uid="vrtManager.connection.
# libvirt's per-host directory of the VMs' UEFI variables (NVRAM) # libvirt's per-host directory of the VMs' UEFI variables (NVRAM)
NVRAM_DIR = "/var/lib/libvirt/qemu/nvram" NVRAM_DIR = "/var/lib/libvirt/qemu/nvram"
# libvirt's per-host directory of the emulated TPMs' state: <vm uuid>/tpm2/
SWTPM_DIR = "/var/lib/libvirt/swtpm"
# the files and devices of a definition's disks that may grow from others; a # the files and devices of a definition's disks that may grow from others; a
# raw one does not # raw one does not
UNREAD_DISKS = etree.XPath("devices/disk[@device='disk'][not(driver/@type='raw')]/source/@file|" UNREAD_DISKS = etree.XPath("devices/disk[@device='disk'][not(driver/@type='raw')]/source/@file|"
@ -1072,6 +1075,35 @@ class wvmConnect(object):
with contextlib.suppress(libvirtError): with contextlib.suppress(libvirtError):
pool.destroy() pool.destroy()
@contextlib.contextmanager
def _tpm_pool(self, vm_uuid, build=False):
"""An active, refreshed pool on the TPM 2.0 state directory of the VM
vm_uuid, destroyed after; None when the directory does not exist (the
VM never started) and build is false; build makes it. Used only by
the worker's jobs that hold the VM: the pool a stopped worker left on
the directory is taken, as libvirt refuses a second one."""
path = f"{SWTPM_DIR}/{vm_uuid}/tpm2"
pool = self.pool_at(path)
if pool is not None:
pool.refresh(0)
else:
try:
pool = self.wvm.storagePoolCreateXML(
f"<pool type='dir'><name>webvirtcloud-tpm-{uuid.uuid4().hex[:8]}</name>"
f"<target><path>{path}</path></target></pool>",
libvirt.VIR_STORAGE_POOL_CREATE_WITH_BUILD if build else 0,
)
except libvirtError as err:
if build or err.get_error_code() != libvirt.VIR_ERR_SYSTEM_ERROR or err.get_int1() != errno.ENOENT:
raise
yield None
return
try:
yield pool
finally:
with contextlib.suppress(libvirtError):
pool.destroy()
def upload_volume(self, pool, name, data, owner=None, mode="0644"): def upload_volume(self, pool, name, data, owner=None, mode="0644"):
"""A new raw volume in pool holding data, written through a libvirt """A new raw volume in pool holding data, written through a libvirt
stream, which every connection type carries; owner: (uid, gid) of stream, which every connection type carries; owner: (uid, gid) of

View file

@ -2,6 +2,7 @@
names and space, and the small files' upload read back.""" names and space, and the small files' upload read back."""
import unittest import unittest
from contextlib import nullcontext
from unittest.mock import MagicMock from unittest.mock import MagicMock
import libvirt import libvirt
@ -13,6 +14,7 @@ from vrtManager.instance import PERSISTENT_XML
GIB = 1024**3 GIB = 1024**3
QCOW = "<disk type='file' device='disk'><driver name='qemu' type='qcow2'/><source file='/pool/a.qcow2'/><target dev='vda'/></disk>" QCOW = "<disk type='file' device='disk'><driver name='qemu' type='qcow2'/><source file='/pool/a.qcow2'/><target dev='vda'/></disk>"
RAW = "<disk type='file' device='disk'><driver name='qemu' type='raw'/><source file='/pool/b.img'/><target dev='vdb'/></disk>" RAW = "<disk type='file' device='disk'><driver name='qemu' type='raw'/><source file='/pool/b.img'/><target dev='vdb'/></disk>"
TPM = "<tpm model='tpm-crb'><backend type='emulator' version='2.0'/></tpm>"
CDROM = "<disk type='file' device='cdrom'><source file='/iso/x.iso'/><target dev='sda'/></disk>" CDROM = "<disk type='file' device='cdrom'><source file='/iso/x.iso'/><target dev='sda'/></disk>"
@ -34,6 +36,7 @@ def proxy(xml=None, live=None, state=libvirt.VIR_DOMAIN_SHUTOFF, managed_save=Fa
p.wvm = MagicMock() p.wvm = MagicMock()
p.instance = MagicMock() p.instance = MagicMock()
p.instance.name.return_value = "vm1" p.instance.name.return_value = "vm1"
p.instance.UUIDString.return_value = "u"
p.instance.state.return_value = [state, 0] p.instance.state.return_value = [state, 0]
p.instance.hasManagedSaveImage.return_value = managed_save p.instance.hasManagedSaveImage.return_value = managed_save
persistent = xml or domain() persistent = xml or domain()
@ -103,7 +106,12 @@ class BackupPlanTestCase(unittest.TestCase):
"host device": (QCOW + "<hostdev mode='subsystem' type='pci'/>", ("host device",)), "host device": (QCOW + "<hostdev mode='subsystem' type='pci'/>", ("host device",)),
"host device NIC": (QCOW + "<interface type='hostdev'><mac address='52:54:00:00:00:09'/></interface>", "host device NIC": (QCOW + "<interface type='hostdev'><mac address='52:54:00:00:00:09'/></interface>",
("host device",)), ("host device",)),
"tpm": (QCOW + "<tpm model='tpm-crb'><backend type='emulator'/></tpm>", ("vm1", "TPM")), "encrypted tpm": (QCOW + "<tpm model='tpm-crb'><backend type='emulator' version='2.0'>"
"<encryption secret='33333333-3333-4333-8333-333333333333'/></backend></tpm>", ("vm1", "TPM")),
"tpm state path": (QCOW + "<tpm model='tpm-crb'><backend type='emulator' version='2.0'>"
"<source type='dir' path='/srv/tpm'/></backend></tpm>", ("vm1", "TPM")),
"host tpm": (QCOW + "<tpm model='tpm-tis'><backend type='passthrough'><device path='/dev/tpm0'/></backend></tpm>",
("vm1", "TPM")),
} }
for name, (devices, texts) in cases.items(): for name, (devices, texts) in cases.items():
with self.subTest(name): with self.subTest(name):
@ -112,6 +120,33 @@ class BackupPlanTestCase(unittest.TestCase):
with self.subTest(tag): with self.subTest(tag):
self.refused(proxy(domain(os_extra=f"<{tag}>/boot/x</{tag}>")), "kernel") self.refused(proxy(domain(os_extra=f"<{tag}>/boot/x</{tag}>")), "kernel")
def test_a_shut_off_vms_tpm_is_backed_up_and_its_state_read_by_the_job(self):
p = proxy(domain(QCOW + TPM))
p._tpm_pool = MagicMock()
self.assertTrue(p.backup_plan()["tpm"])
p._tpm_pool.assert_not_called() # the plan runs in pages too: only the worker reads the state
self.assertFalse(proxy(domain(QCOW)).backup_plan()["tpm"])
def test_the_tpm_state_files_are_read_without_swtpms_lock(self):
p = proxy(domain(QCOW + TPM))
state = MagicMock()
state.listVolumes.return_value = [".lock", "tpm2-00.permall"]
p._tpm_pool = MagicMock(return_value=nullcontext(state))
p.download_volume = MagicMock(return_value=b"state")
self.assertEqual(p.read_tpm(), {"tpm2-00.permall": b"state"})
p._tpm_pool.assert_called_once_with("u")
state.storageVolLookupByName.assert_called_once_with("tpm2-00.permall")
def test_a_tpm_that_never_started_has_no_files(self):
p = proxy(domain(QCOW + TPM))
p._tpm_pool = MagicMock(return_value=nullcontext(None))
self.assertEqual(p.read_tpm(), {})
def test_a_running_or_paused_vm_with_a_tpm_is_refused(self):
for state in (libvirt.VIR_DOMAIN_RUNNING, libvirt.VIR_DOMAIN_PAUSED):
with self.subTest(state):
self.refused(proxy(domain(QCOW + TPM), state=state), "vm1", "TPM", "shut it down")
def test_a_saved_state_is_refused(self): def test_a_saved_state_is_refused(self):
self.refused(proxy(managed_save=True), "saved state") self.refused(proxy(managed_save=True), "saved state")
@ -145,6 +180,7 @@ class FilesTestCase(unittest.TestCase):
{ {
"disks": {"vda": f"wvc-{uuid}-vda.qcow2", "vdb": f"wvc-{uuid}-vdb.raw"}, "disks": {"vda": f"wvc-{uuid}-vda.qcow2", "vdb": f"wvc-{uuid}-vdb.raw"},
"nvram": f"wvc-{uuid}-nvram.fd", "nvram": f"wvc-{uuid}-nvram.fd",
"tpm": f"wvc-{uuid}-tpm-",
"domain": f"wvc-{uuid}-domain.xml", "domain": f"wvc-{uuid}-domain.xml",
"manifest": f"wvc-{uuid}-manifest.json", "manifest": f"wvc-{uuid}-manifest.json",
}, },
@ -181,7 +217,42 @@ class FilesTestCase(unittest.TestCase):
) )
old.delete.assert_called_once_with(0) old.delete.assert_called_once_with(0)
# written as QEMU's user: an NFS export that squashes root refuses root's files # written as QEMU's user: an NFS export that squashes root refuses root's files
conn.upload_volume.assert_called_once_with(pool, "wvc-x-domain.xml", b"data", owner=(107, 108)) conn.upload_volume.assert_called_once_with(pool, "wvc-x-domain.xml", b"data", owner=(107, 108), mode="0644")
def test_a_tpm_directory_that_does_not_exist_gives_no_pool(self):
import errno
from vrtManager.connection import wvmConnect
conn = wvmConnect.__new__(wvmConnect)
conn.wvm = MagicMock()
missing = libvirt.libvirtError("cannot open directory")
missing.err = (libvirt.VIR_ERR_SYSTEM_ERROR, 0, "", 2, None, None, None, errno.ENOENT, -1)
conn.wvm.storagePoolCreateXML.side_effect = missing
conn.wvm.listAllStoragePools.return_value = []
with conn._tpm_pool("u") as pool:
self.assertIsNone(pool)
self.assertIn("/var/lib/libvirt/swtpm/u/tpm2", conn.wvm.storagePoolCreateXML.call_args.args[0])
conn.wvm.listAllStoragePools.return_value = []
with self.assertRaises(libvirt.libvirtError), conn._tpm_pool("u", build=True):
pass
missing.err = (libvirt.VIR_ERR_SYSTEM_ERROR, 0, "", 2, None, None, None, errno.EACCES, -1)
with self.assertRaises(libvirt.libvirtError), conn._tpm_pool("u"):
pass
def test_a_tpm_pool_a_stopped_worker_left_is_taken_and_destroyed(self):
from vrtManager.connection import wvmConnect
conn = wvmConnect.__new__(wvmConnect)
conn.wvm = MagicMock()
left = MagicMock()
left.XMLDesc.return_value = "<pool><target><path>/var/lib/libvirt/swtpm/u/tpm2</path></target></pool>"
conn.wvm.listAllStoragePools.return_value = [left]
with conn._tpm_pool("u") as pool:
self.assertIs(pool, left)
conn.wvm.storagePoolCreateXML.assert_not_called()
left.refresh.assert_called_once_with(0)
left.destroy.assert_called_once_with()
def test_upload_volume_sets_the_owner(self): def test_upload_volume_sets_the_owner(self):
from lxml import etree from lxml import etree