1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-12-02 17:06:09 +00:00

feat(vmbackups): what a VM's backup holds and the target files

wvmBackup.backup_plan reads a VM's persistent definition and says what a
backup copies: each file disk (qcow2 or raw) with its pool and virtual
size, the NVRAM file, and what is left out (CD-ROMs, floppies). It
refuses, naming the reason, what a backup could not restore as it is:
encrypted, block, network, volume, directory and shareable disks, other
disk formats, a disk in no storage pool, shared host directories, a
kernel file boot, host devices, a saved state, TPM state (a later
layer), an NVRAM file outside libvirt's directory, and a running VM
whose disks change at its next start.

The target side: the files' names from the backup's UUID only, the free
space check (virtual size plus the snapshots' margin), small files
written and read back with their SHA-256, read, removed and the
manifests listed. download_volume is taken out of copy_nvram for both.
Every user of the NVRAM pool runs in the worker, so its process lock
holds.

A push backup target of a raw disk (live backup or live clone) is made
without qcow2's compat and features, which libvirt refuses for raw.
This commit is contained in:
catborise 2026-11-17 07:44:36 +03:00
parent 022737f143
commit 89835f2b06
10 changed files with 785 additions and 239 deletions

Binary file not shown.

View file

@ -11,7 +11,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-11-17 04:36+0000\n"
"POT-Creation-Date: 2026-11-17 05:39+0000\n"
"PO-Revision-Date: 2020-11-04 12:00+0000\n"
"Last-Translator: catborise <muhammetalisag@gmail.com>, 2020\n"
"Language-Team: Turkish (https://www.transifex.com/catborise/teams/110663/tr/)\n"
@ -3243,7 +3243,7 @@ msgstr ""
msgid "A password takes no line breaks or other control characters."
msgstr "Parola satır sonu ya da başka denetim karakteri içeremez."
#: instances/forms.py:114 vrtManager/instance.py:1667
#: instances/forms.py:114 vrtManager/instance.py:1657
msgid ""
"The console listens on no address (on a network, a socket or nowhere); change"
" it in the XML editor"
@ -3337,7 +3337,7 @@ msgstr ""
msgid "Delete snapshot"
msgstr "Anlık görüntüyü sil"
#: instances/jobs.py:357 vrtManager/instance.py:2426
#: instances/jobs.py:357 vrtManager/instance.py:2416
#, python-format
msgid "The VM has no external snapshot named %(name)s"
msgstr "Sanal makinede %(name)s adında harici anlık görüntü yok"
@ -3372,7 +3372,7 @@ msgstr "Sanal makine artık işin çalıştığı sunucuda değil"
msgid "Take snapshot"
msgstr "Anlık görüntü al"
#: instances/jobs.py:425 instances/jobs.py:434 vrtManager/instance.py:2017
#: instances/jobs.py:425 instances/jobs.py:434 vrtManager/instance.py:2007
#, python-format
msgid "A snapshot named %(name)s already exists"
msgstr "%(name)s adında bir anlık görüntü zaten var"
@ -3534,12 +3534,12 @@ msgstr ""
msgid "Each network card needs a network"
msgstr "Her ağ kartının bir ağı olmalı"
#: instances/jobs.py:868 vrtManager/instance.py:2858
#: instances/jobs.py:868 vrtManager/instance.py:2849
#, python-format
msgid "This host has no network %(name)s"
msgstr "Bu sunucuda %(name)s ağı yok"
#: instances/jobs.py:870 vrtManager/instance.py:2860
#: instances/jobs.py:870 vrtManager/instance.py:2851
#, python-format
msgid "This host has no network filter %(name)s"
msgstr "Bu sunucuda %(name)s ağ filtresi yok"
@ -3613,7 +3613,7 @@ msgstr "cloud-init tohumu, disk için bir dizin depolama havuzu gerektirir"
msgid "This host offers no firmware %(firmware)s"
msgstr "Bu sunucu %(firmware)s firmware'ini sunmuyor"
#: instances/jobs.py:957 vrtManager/instance.py:3207
#: instances/jobs.py:957 vrtManager/instance.py:3198
msgid "This host offers no TPM 2.0: install swtpm on it"
msgstr "Bu sunucu TPM 2.0 sunmuyor: üzerine swtpm kurun"
@ -4911,7 +4911,7 @@ msgid "Add USB device"
msgstr "USB aygıtı ekle"
#: instances/templates/instances/host_devices_form.html:18
#: vrtManager/instance.py:3111
#: vrtManager/instance.py:3102
msgid ""
"A VM with a saved state does not change its USB devices: start it, or start "
"it without its saved state"
@ -6926,7 +6926,7 @@ msgstr "Birim başarıyla değiştirildi."
msgid "Disk %(dev)s is not a storage volume of this instance"
msgstr "%(dev)s diski bu sanal makinenin bir depolama birimi değil"
#: instances/views.py:1598 vrtManager/instance.py:2436
#: instances/views.py:1598 vrtManager/instance.py:2426
msgid "The VM has a saved state; start it or remove the saved state first"
msgstr ""
"Sanal makinenin kaydedilmiş durumu var; önce başlatın veya kaydedilmiş durumu"
@ -6988,7 +6988,7 @@ msgstr "Anlık görüntü silinmedi: %(err)s"
msgid "Add at least one device to the boot order."
msgstr "Ön yükleme sırasına en az bir aygıt ekleyin."
#: instances/views.py:1911 vrtManager/instance.py:1208
#: instances/views.py:1911 vrtManager/instance.py:1198
msgid "Invalid Device Type for boot order"
msgstr "Ön yükleme sırası için geçersiz aygıt türü"
@ -9815,7 +9815,7 @@ msgstr ""
"%(compute)s sunucusunun %(pool)s depolama havuzu, %(other_compute)s "
"sunucusunun %(other)s depolama havuzuyla aynı dizin değil"
#: vrtManager/backup.py:30
#: vrtManager/backup.py:35
#, python-format
msgid ""
"Storage pool %(pool)s is not an active directory or NFS pool of this host, or"
@ -9824,6 +9824,104 @@ msgstr ""
"%(pool)s depolama havuzu bu sunucuda etkin bir dizin veya NFS havuzu değil ya"
" da yedek hedefinin kaydettiği havuz değil"
#: vrtManager/backup.py:62
#, python-format
msgid "%(vm)s has a saved state; start it or remove the saved state first"
msgstr ""
"%(vm)s kaydedilmiş bir durum taşıyor; önce başlatın veya kaydedilmiş durumu "
"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
#, python-format
msgid "%(vm)s shares a host directory (filesystem); it cannot be backed up"
msgstr "%(vm)s bir sunucu dizinini paylaşıyor (filesystem); yedeklenemez"
#: vrtManager/backup.py:68
#, python-format
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"
#: vrtManager/backup.py:70
#, python-format
msgid "%(vm)s has a host device; it cannot be backed up"
msgstr "%(vm)s bir sunucu aygıtı kullanıyor; yedeklenemez"
#: vrtManager/backup.py:76
msgid "CD-ROM: not copied"
msgstr "CD-ROM: kopyalanmaz"
#: vrtManager/backup.py:76
msgid "Floppy: not copied"
msgstr "Disket: kopyalanmaz"
#: vrtManager/backup.py:80
#, python-format
msgid "Disk %(dev)s is encrypted; it cannot be backed up"
msgstr "%(dev)s diski şifreli; yedeklenemez"
#: vrtManager/backup.py:83
#, python-format
msgid "Disk %(dev)s is not a file; it cannot be backed up"
msgstr "%(dev)s diski bir dosya değil; yedeklenemez"
#: vrtManager/backup.py:85
#, python-format
msgid "Disk %(dev)s is shareable; it cannot be backed up"
msgstr "%(dev)s diski paylaşılabilir; yedeklenemez"
#: vrtManager/backup.py:88
#, python-format
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"
#: vrtManager/backup.py:95
#, python-format
msgid ""
"Disk %(dev)s (%(path)s) is in no storage pool of the host; it cannot be "
"backed up"
msgstr ""
"%(dev)s diski (%(path)s) sunucunun hiçbir depolama havuzunda değil; "
"yedeklenemez"
#: vrtManager/backup.py:108
#, python-format
msgid ""
"Disks %(devs)s change at the next start; back the VM up after it restarts"
msgstr ""
"%(devs)s diskleri sonraki başlatmada değişiyor; sanal makineyi yeniden "
"başladıktan sonra yedekleyin"
#: vrtManager/backup.py:113 vrtManager/instance.py:494
#, python-format
msgid ""
"The NVRAM file %(path)s is not in libvirt's NVRAM directory %(dir)s and "
"cannot be copied"
msgstr ""
"%(path)s NVRAM dosyası libvirt'in NVRAM dizini %(dir)s içinde değil ve "
"kopyalanamaz"
#: vrtManager/backup.py:164
#, python-format
msgid ""
"Storage pool %(pool)s has %(free).1f GiB free; the backup needs %(size).1f "
"GiB (the copied disks, plus %(percent)g%% of them, at least %(minimum)g GiB)"
msgstr ""
"%(pool)s depolama havuzunda %(free).1f GiB boş alan var; yedek %(size).1f GiB"
" gerektiriyor (kopyalanan diskler, artı bunların %%%(percent)g kadarı, en az "
"%(minimum)g GiB)"
#: vrtManager/backup.py:177
#, python-format
msgid ""
"The file %(name)s read back from the backup target differs from the one "
"written"
msgstr "Yedek hedefinden geri okunan %(name)s dosyası yazılandan farklı"
#: vrtManager/connection.py:45
msgid "Connection closed (error)"
msgstr "Bağlantı kapandı (hata)"
@ -9849,36 +9947,36 @@ msgstr ""
"Bağlantı başarısız: %(host)s yanıt vermiyor: %(requests)s istek hâlâ onu "
"bekliyor"
#: vrtManager/connection.py:248
#: vrtManager/connection.py:250
#, python-format
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"
#: vrtManager/connection.py:259
#: vrtManager/connection.py:261
msgid "the connection closed right after opening"
msgstr "bağlantı açıldıktan hemen sonra kapandı"
#: vrtManager/connection.py:272
#: vrtManager/connection.py:274
#, python-format
msgid "Connection Failed: %(error)s"
msgstr "Bağlantı başarısız: %(error)s"
#: vrtManager/connection.py:341
#: vrtManager/connection.py:343
#, python-format
msgid "Connection closed (%(reason)s)"
msgstr "Bağlantı kapandı (%(reason)s)"
#: vrtManager/connection.py:493
#: vrtManager/connection.py:495
#, python-format
msgid "Connection Failed: %(host)s is not connected"
msgstr "Bağlantı başarısız: %(host)s bağlı değil"
#: vrtManager/connection.py:545
#: vrtManager/connection.py:547
#, python-format
msgid "This host has no architecture %(arch)s"
msgstr "Bu sunucuda %(arch)s mimarisi yok"
#: vrtManager/connection.py:1214
#: vrtManager/connection.py:1233
#, python-format
msgid ""
"Pool %(pool)s is not active: the files the disks of the VMs in it are made "
@ -10038,35 +10136,26 @@ msgid ""
msgstr ""
"%(error)s; yarım kalan disk kopyalarını hedef sunucudan kaldırın: %(left)s"
#: vrtManager/instance.py:494
#, python-format
msgid ""
"The NVRAM file %(path)s is not in libvirt's NVRAM directory %(dir)s and "
"cannot be copied"
msgstr ""
"%(path)s NVRAM dosyası libvirt'in NVRAM dizini %(dir)s içinde değil ve "
"kopyalanamaz"
#: vrtManager/instance.py:503
#, python-format
msgid "The destination host cannot see the NVRAM file %(path)s"
msgstr "Hedef sunucu %(path)s NVRAM dosyasını göremiyor"
#: vrtManager/instance.py:594
#: vrtManager/instance.py:584
#, python-format
msgid "%(type)s disk, cannot be checked"
msgstr "%(type)s disk, kontrol edilemiyor"
#: vrtManager/instance.py:634
#: vrtManager/instance.py:624
#, python-format
msgid "The destination host already has a VM %(key)s"
msgstr "Hedef sunucuda zaten %(key)s sanal makinesi var"
#: vrtManager/instance.py:656
#: vrtManager/instance.py:646
msgid "The VM was started on the source host during the migration"
msgstr "Sanal makine taşıma sırasında kaynak sunucuda başlatıldı"
#: vrtManager/instance.py:672
#: vrtManager/instance.py:662
#, python-format
msgid ""
"%(error)s; the VM may now be defined only on the destination host: check both"
@ -10075,7 +10164,7 @@ msgstr ""
"%(error)s; sanal makine artık yalnızca hedef sunucuda tanımlı olabilir: iki "
"sunucuyu da kontrol edin"
#: vrtManager/instance.py:678
#: vrtManager/instance.py:668
#, python-format
msgid ""
"%(error)s; the VM is now defined on both hosts, remove it from the "
@ -10084,7 +10173,7 @@ msgstr ""
"%(error)s; sanal makine artık iki sunucuda da tanımlı, hedeften kaldırın: "
"%(undo_error)s"
#: vrtManager/instance.py:684
#: vrtManager/instance.py:674
msgid ""
"Snapshot names are 1-64 letters, digits, '.', '_' or '-' and do not start "
"with '.'"
@ -10092,7 +10181,7 @@ msgstr ""
"Anlık görüntü adları 1-64 harf, rakam, '.', '_' veya '-' karakterinden oluşur"
" ve '.' ile başlamaz"
#: vrtManager/instance.py:1196
#: vrtManager/instance.py:1186
msgid ""
"A device other than a disk or NIC is in the boot order: change it in the XML "
"editor"
@ -10100,47 +10189,47 @@ msgstr ""
"Önyükleme sırasında disk veya NIC dışında bir aygıt var: bunu XML "
"düzenleyicide değiştirin"
#: vrtManager/instance.py:1211
#: vrtManager/instance.py:1201
#, python-format
msgid "Boot device %(dev)s is not in the definition"
msgstr "Ön yükleme aygıtı %(dev)s tanımda yok"
#: vrtManager/instance.py:1231
#: vrtManager/instance.py:1221
#, python-format
msgid "CD-ROM %(dev)s is not in the running definition"
msgstr "CD-ROM %(dev)s çalışan tanımda yok"
#: vrtManager/instance.py:1232
#: vrtManager/instance.py:1222
#, python-format
msgid "CD-ROM %(dev)s is not in the persistent definition"
msgstr "CD-ROM %(dev)s kalıcı tanımda yok"
#: vrtManager/instance.py:1245
#: vrtManager/instance.py:1235
#, python-format
msgid "Media of %(dev)s changed in the running VM only: %(err)s"
msgstr "%(dev)s ortamı yalnızca çalışan sanal makinede değişti: %(err)s"
#: vrtManager/instance.py:1256
#: vrtManager/instance.py:1246
#, python-format
msgid "ISO image %(image)s was not found"
msgstr "ISO imajı %(image)s bulunamadı"
#: vrtManager/instance.py:1258
#: vrtManager/instance.py:1248
#, python-format
msgid "ISO image %(image)s is in more than one storage pool"
msgstr "ISO imajı %(image)s birden fazla depolama havuzunda var"
#: vrtManager/instance.py:1353
#: vrtManager/instance.py:1343
#, python-format
msgid "Disk %(target_dev)s is not in the VM's definition"
msgstr "Disk %(target_dev)s sanal makinenin tanımında yok"
#: vrtManager/instance.py:1485
#: vrtManager/instance.py:1475
msgid "Please shutdown the instance then try to enable vCPU hotplug"
msgstr ""
"vCPU hotplug özelliğini etkinleştirmek için önce sanal makineyi kapatın"
#: vrtManager/instance.py:1688
#: vrtManager/instance.py:1678
#, python-format
msgid ""
"The serial console is a %(type)s one, the browser opens only a pty one; "
@ -10149,11 +10238,11 @@ msgstr ""
"Seri konsol %(type)s türünde, tarayıcı yalnızca pty türünü açar; bunu XML "
"düzenleyicide değiştirin"
#: vrtManager/instance.py:1799
#: vrtManager/instance.py:1789
msgid "The VM has no video card"
msgstr "Sanal makinede ekran kartı yok"
#: vrtManager/instance.py:1809
#: vrtManager/instance.py:1799
#, python-format
msgid ""
"The VM's CPU topology has %(count)s vCPUs: change it in the XML editor to set"
@ -10162,62 +10251,62 @@ msgstr ""
"VM'nin CPU topolojisi %(count)s vCPU içeriyor: başka bir en fazla değer için "
"onu XML düzenleyicide değiştirin"
#: vrtManager/instance.py:1835
#: vrtManager/instance.py:1825
#, python-format
msgid "The VM's next start has a maximum memory of %(max)s MiB"
msgstr ""
"Sanal makinenin bir sonraki başlangıcındaki en yüksek bellek %(max)s MiB"
#: vrtManager/instance.py:1976
#: vrtManager/instance.py:1966
msgid ""
"The VM has external snapshots; internal snapshots cannot be mixed with them"
msgstr ""
"Sanal makinenin harici anlık görüntüleri var; dahili anlık görüntüler "
"bunlarla karıştırılamaz"
#: vrtManager/instance.py:2008
#: vrtManager/instance.py:1998
msgid "A snapshot with memory is not quiesced; it keeps the whole guest state"
msgstr ""
"Bellekli bir anlık görüntüde dosya sistemleri dondurulmaz; tüm konuk durumunu"
" saklar"
#: vrtManager/instance.py:2010
#: vrtManager/instance.py:2000
msgid "Only a running VM's file systems can be frozen"
msgstr "Yalnızca çalışan bir sanal makinenin dosya sistemleri dondurulabilir"
#: vrtManager/instance.py:2012
#: vrtManager/instance.py:2002
msgid "The QEMU guest agent is not connected; it freezes the file systems"
msgstr "QEMU konuk aracısı bağlı değil; dosya sistemlerini o dondurur"
#: vrtManager/instance.py:2015
#: vrtManager/instance.py:2005
msgid ""
"The VM has internal snapshots; external snapshots cannot be mixed with them"
msgstr ""
"Sanal makinenin dahili anlık görüntüleri var; harici anlık görüntüler "
"bunlarla karıştırılamaz"
#: vrtManager/instance.py:2020
#: vrtManager/instance.py:2010
msgid "Newer snapshots exist after the last revert; delete them first"
msgstr ""
"Son geri dönüşten sonra daha yeni anlık görüntüler var; önce onları silin"
#: vrtManager/instance.py:2023
#: vrtManager/instance.py:2013
msgid "No snapshot is current; revert to a snapshot first"
msgstr "Geçerli anlık görüntü yok; önce bir anlık görüntüye geri dönün"
#: vrtManager/instance.py:2029
#: vrtManager/instance.py:2019
#, python-format
msgid "Eject the media from %(dev)s first"
msgstr "Önce %(dev)s içindeki ortamı çıkarın"
#: vrtManager/instance.py:2031
#: vrtManager/instance.py:2021
#, python-format
msgid "Disk %(dev)s is not a file; external snapshots need file disks"
msgstr ""
"Disk %(dev)s bir dosya değil; harici anlık görüntüler dosya diskleri "
"gerektirir"
#: vrtManager/instance.py:2039
#: vrtManager/instance.py:2029
#, python-format
msgid ""
"The storage pools could not be refreshed, so their free space is unknown: "
@ -10225,21 +10314,21 @@ msgid ""
msgstr ""
"Depolama havuzları yenilenemedi, bu yüzden boş alanları bilinmiyor: %(err)s"
#: vrtManager/instance.py:2060
#: vrtManager/instance.py:2050
msgid "Memory is saved only from a running VM"
msgstr "Bellek yalnızca çalışan bir sanal makineden kaydedilir"
#: vrtManager/instance.py:2062
#: vrtManager/instance.py:2052
msgid "The VM has no disk to keep its memory next to"
msgstr "Sanal makinenin, belleğinin yanına kaydedileceği bir diski yok"
#: vrtManager/instance.py:2066
#: vrtManager/instance.py:2056
#, python-format
msgid "%(disk)s is not in a storage pool; memory is saved only into one"
msgstr ""
"%(disk)s bir depolama havuzunda değil; bellek yalnızca bir havuza kaydedilir"
#: vrtManager/instance.py:2097
#: vrtManager/instance.py:2087
#, python-format
msgid ""
"Storage pool %(pool)s has %(free).1f GiB free; the snapshot needs %(size).1f "
@ -10250,7 +10339,7 @@ msgstr ""
"%(size).1f GiB gerektiriyor (sanal makinenin oradaki disklerinin "
"%%%(percent)g kadarı, en az %(minimum)g GiB, ve kaydediliyorsa bellek)"
#: vrtManager/instance.py:2115
#: vrtManager/instance.py:2105
msgid ""
"This snapshot was taken by an older version on a UEFI VM and cannot be "
"reverted; delete it instead"
@ -10258,7 +10347,7 @@ msgstr ""
"Bu anlık görüntü UEFI bir sanal makinede eski bir sürümle alındı ve geri "
"dönülemez; bunun yerine silin"
#: vrtManager/instance.py:2145
#: vrtManager/instance.py:2135
#, python-format
msgid ""
"The revert failed twice; try again in a moment (%(error)s). The VM is "
@ -10267,7 +10356,7 @@ msgstr ""
"Geri dönüş iki kez başarısız oldu; biraz sonra tekrar deneyin (%(error)s). "
"Sanal makine çalışıyor."
#: vrtManager/instance.py:2147
#: vrtManager/instance.py:2137
#, python-format
msgid ""
"The revert failed twice; try again in a moment (%(error)s). The VM is shut "
@ -10276,13 +10365,13 @@ msgstr ""
"Geri dönüş iki kez başarısız oldu; biraz sonra tekrar deneyin (%(error)s). "
"Sanal makine kapalı."
#: vrtManager/instance.py:2315
#: vrtManager/instance.py:2305
msgid "A disk moves when its VM is defined and running, paused or shut off"
msgstr ""
"Bir disk, sanal makinesi tanımlıyken ve çalışırken, duraklatılmışken veya "
"kapalıyken taşınır"
#: vrtManager/instance.py:2317
#: vrtManager/instance.py:2307
msgid ""
"A disk of a VM with snapshots, a saved state or a running block job does not "
"move"
@ -10290,7 +10379,7 @@ msgstr ""
"Anlık görüntüleri, kaydedilmiş durumu veya çalışan bir blok işi olan sanal "
"makinenin diski taşınmaz"
#: vrtManager/instance.py:2325
#: vrtManager/instance.py:2315
#, python-format
msgid ""
"%(dev)s is not a disk file of the VM, the same in its running and next "
@ -10299,127 +10388,127 @@ msgstr ""
"%(dev)s, sanal makinenin çalışan ve sonraki başlatma tanımlarında aynı olan "
"bir disk dosyası değil"
#: vrtManager/instance.py:2330
#: vrtManager/instance.py:2320
#, python-format
msgid "%(dev)s does not move: only writable raw and qcow2 disks do"
msgstr "%(dev)s taşınmaz: yalnızca yazılabilir raw ve qcow2 diskler taşınır"
#: vrtManager/instance.py:2337
#: vrtManager/instance.py:2327
#, python-format
msgid "%(dev)s does not move: no storage pool has %(path)s"
msgstr "%(dev)s taşınmaz: hiçbir depolama havuzunda %(path)s yok"
#: vrtManager/instance.py:2339
#: vrtManager/instance.py:2329
#, python-format
msgid "%(dev)s does not move: it has a backing file"
msgstr "%(dev)s taşınmaz: temel (backing) dosyası var"
#: vrtManager/instance.py:2342
#: vrtManager/instance.py:2332
#, python-format
msgid "%(pool_name)s is not an active pool of disk files of this host"
msgstr "%(pool_name)s bu sunucunun etkin bir disk dosyası havuzu değil"
#: vrtManager/instance.py:2345
#: vrtManager/instance.py:2335
#, python-format
msgid "%(dev)s is in pool %(pool_name)s already"
msgstr "%(dev)s zaten %(pool_name)s havuzunda"
#: vrtManager/instance.py:2349
#: vrtManager/instance.py:2339
#, python-format
msgid "Pool %(pool_name)s already has a file %(name)s"
msgstr "%(pool_name)s havuzunda zaten %(name)s dosyası var"
#: vrtManager/instance.py:2373
#: vrtManager/instance.py:2363
#, python-format
msgid "The copy of %(dev)s ended before it was complete"
msgstr "%(dev)s kopyası tamamlanmadan sona erdi"
#: vrtManager/instance.py:2418
#: vrtManager/instance.py:2408
#, python-format
msgid "%(error)s; remove %(dest)s if it is there: %(cleanup_error)s"
msgstr "%(error)s; varsa %(dest)s dosyasını kaldırın: %(cleanup_error)s"
#: vrtManager/instance.py:2420
#: vrtManager/instance.py:2410
#, python-format
msgid "%(error)s; the VM may use %(dest)s now: check its disk %(dev)s"
msgstr ""
"%(error)s; sanal makine şu anda %(dest)s dosyasını kullanıyor olabilir: "
"%(dev)s diskini kontrol edin"
#: vrtManager/instance.py:2427
#: vrtManager/instance.py:2417
#, python-format
msgid "The VM has no internal snapshot named %(name)s"
msgstr "Sanal makinenin %(name)s adlı dahili anlık görüntüsü yok"
#: vrtManager/instance.py:2438
#: vrtManager/instance.py:2428
msgid "A snapshot job is still running on this VM; try again when it ends"
msgstr ""
"Bu sanal makinede hâlâ bir anlık görüntü işi çalışıyor; bittiğinde tekrar "
"deneyin"
#: vrtManager/instance.py:2448
#: vrtManager/instance.py:2438
msgid "Shut the VM down to revert to an internal snapshot"
msgstr "Dahili bir anlık görüntüye geri dönmek için sanal makineyi kapatın"
#: vrtManager/instance.py:2535
#: vrtManager/instance.py:2525
msgid "A VM with a host's or an external TPM is not cloned; remove it first"
msgstr ""
"Ana makinenin ya da harici bir TPM'i olan sanal makine klonlanmaz; önce onu "
"kaldırın"
#: vrtManager/instance.py:2566
#: vrtManager/instance.py:2556
msgid "Cannot clone a VM whose NVRAM is not a file"
msgstr "NVRAM'i dosya olmayan bir sanal makine klonlanamaz"
#: vrtManager/instance.py:2636
#: vrtManager/instance.py:2627
#, python-format
msgid "Clone failed (%(err)s); remove these copies by hand: %(path)s"
msgstr ""
"Klonlama başarısız oldu (%(err)s); bu kopyaları elle kaldırın: %(path)s"
#: vrtManager/instance.py:2647
#: vrtManager/instance.py:2638
msgid "Shut the VM down before cloning it"
msgstr "Klonlamadan önce sanal makineyi kapatın"
#: vrtManager/instance.py:2674
#: vrtManager/instance.py:2665
#, python-format
msgid "Clone failed (%(err)s); remove these copies by hand: %(leftovers)s"
msgstr ""
"Klonlama başarısız oldu (%(err)s); bu kopyaları elle kaldırın: %(leftovers)s"
#: vrtManager/instance.py:2685
#: vrtManager/instance.py:2676
msgid "Live clone needs libvirt 11.10 or later; shut the VM down to clone it"
msgstr ""
"Canlı klonlama libvirt 11.10 veya sonrasını gerektirir; klonlamak için sanal "
"makineyi kapatın"
#: vrtManager/instance.py:2688
#: vrtManager/instance.py:2679
msgid "A VM with a TPM is cloned only shut down"
msgstr "TPM'i olan bir sanal makine yalnızca kapalıyken klonlanır"
#: vrtManager/instance.py:2691
#: vrtManager/instance.py:2682
#, python-format
msgid "Disk %(dev)s is not a local file; shut the VM down to clone it"
msgstr ""
"Disk %(dev)s yerel bir dosya değil; klonlamak için sanal makineyi kapatın"
#: vrtManager/instance.py:2693
#: vrtManager/instance.py:2684
#, python-format
msgid "Disk %(dev)s is shareable; shut the VM down to clone it"
msgstr "Disk %(dev)s paylaşılabilir; klonlamak için sanal makineyi kapatın"
#: vrtManager/instance.py:2698
#: vrtManager/instance.py:2689
#, python-format
msgid "Disk %(dev)s changes at the next start; shut the VM down to clone it"
msgstr ""
"Disk %(dev)s sonraki başlatmada değişiyor; klonlamak için sanal makineyi "
"kapatın"
#: vrtManager/instance.py:2700
#: vrtManager/instance.py:2691
msgid "Another job is running on the VM; clone it when that ends"
msgstr "Sanal makinede başka bir iş çalışıyor; o bittiğinde klonlayın"
#: vrtManager/instance.py:2726
#: vrtManager/instance.py:2717
#, python-format
msgid ""
"Storage pool %(pool)s has %(free).1f GiB free; the clone needs %(size).1f GiB"
@ -10429,25 +10518,25 @@ msgstr ""
"gerektiriyor (kopyalanan diskler, artı bunların %%%(percent)g kadarı, en az "
"%(minimum)g GiB)"
#: vrtManager/instance.py:2743
#: vrtManager/instance.py:2734
#, python-format
msgid "Volume %(name)s already exists in storage pool %(pool)s"
msgstr "%(name)s birimi %(pool)s depolama havuzunda zaten var"
#: vrtManager/instance.py:2897
#: vrtManager/instance.py:2888
msgid "A network interface that is a host device is removed in the XML editor"
msgstr "Sunucu aygıtı olan bir ağ arabirimi XML düzenleyicide kaldırılır"
#: vrtManager/instance.py:2913
#: vrtManager/instance.py:2904
#, python-format
msgid "No network interface with MAC %(old_mac)s"
msgstr "MAC adresi %(old_mac)s olan ağ arabirimi yok"
#: vrtManager/instance.py:2916
#: vrtManager/instance.py:2907
msgid "A network interface that is a host device is changed in the XML editor"
msgstr "Sunucu aygıtı olan bir ağ arabirimi XML düzenleyicide değiştirilir"
#: vrtManager/instance.py:3010
#: vrtManager/instance.py:3001
msgid ""
"A VM changes its PCI devices while it runs, or is shut off without a saved "
"state"
@ -10455,43 +10544,43 @@ msgstr ""
"Sanal makine PCI aygıtlarını çalışırken veya kaydedilmiş durumu olmadan "
"kapalıyken değiştirir"
#: vrtManager/instance.py:3031
#: vrtManager/instance.py:3022
#, python-format
msgid "%(err)s; whether the VM has %(device)s now is not known"
msgstr "%(err)s; sanal makinede şu anda %(device)s olup olmadığı bilinmiyor"
#: vrtManager/instance.py:3033
#: vrtManager/instance.py:3024
#, python-format
msgid "%(err)s; %(device)s: the VM is not running, its next start has it"
msgstr "%(err)s; %(device)s: sanal makine çalışmıyor, sonraki başlatmada var"
#: vrtManager/instance.py:3034
#: vrtManager/instance.py:3025
#, python-format
msgid ""
"%(err)s; %(device)s: the VM is not running, its next start does not have it"
msgstr "%(err)s; %(device)s: sanal makine çalışmıyor, sonraki başlatmada yok"
#: vrtManager/instance.py:3035
#: vrtManager/instance.py:3026
#, python-format
msgid "%(err)s; %(device)s: the running VM has it, its next start has it"
msgstr ""
"%(err)s; %(device)s: çalışan sanal makinede var, sonraki başlatmada var"
#: vrtManager/instance.py:3036
#: vrtManager/instance.py:3027
#, python-format
msgid ""
"%(err)s; %(device)s: the running VM has it, its next start does not have it"
msgstr ""
"%(err)s; %(device)s: çalışan sanal makinede var, sonraki başlatmada yok"
#: vrtManager/instance.py:3037
#: vrtManager/instance.py:3028
#, python-format
msgid ""
"%(err)s; %(device)s: the running VM does not have it, its next start has it"
msgstr ""
"%(err)s; %(device)s: çalışan sanal makinede yok, sonraki başlatmada var"
#: vrtManager/instance.py:3039
#: vrtManager/instance.py:3030
#, python-format
msgid ""
"%(err)s; %(device)s: the running VM does not have it, its next start does not"
@ -10499,48 +10588,48 @@ msgid ""
msgstr ""
"%(err)s; %(device)s: çalışan sanal makinede yok, sonraki başlatmada yok"
#: vrtManager/instance.py:3073
#: vrtManager/instance.py:3064
#, python-format
msgid "The VM has no PCI device %(address)s"
msgstr "Sanal makinede %(address)s PCI aygıtı yok"
#: vrtManager/instance.py:3094
#: vrtManager/instance.py:3085
msgid "The VM has no USB controller"
msgstr "Sanal makinede USB denetleyicisi yok"
#: vrtManager/instance.py:3128
#: vrtManager/instance.py:3119
msgid "The VM has no such USB device"
msgstr "Sanal makinede böyle bir USB aygıtı yok"
#: vrtManager/instance.py:3142
#: vrtManager/instance.py:3133
#, python-format
msgid "The VM has no network interface %(mac)s"
msgstr "Sanal makinede %(mac)s ağ arabirimi yok"
#: vrtManager/instance.py:3173
#: vrtManager/instance.py:3164
msgid "The VM has its own RNG device: change it in the XML editor"
msgstr ""
"Sanal makinenin kendi RNG aygıtı var: bunu XML düzenleyicide değiştirin"
#: vrtManager/instance.py:3200
#: vrtManager/instance.py:3191
msgid "The VM has its own TPM: change it in the XML editor"
msgstr "Sanal makinenin kendi TPM'i var: bunu XML düzenleyicide değiştirin"
#: vrtManager/instance.py:3219
#: vrtManager/instance.py:3210
#, python-format
msgid "Unknown crash action %(action)s"
msgstr "Bilinmeyen çökme eylemi %(action)s"
#: vrtManager/instance.py:3246
#: vrtManager/instance.py:3237
#, python-format
msgid "Network interface %(mac)s is not in the definition"
msgstr "%(mac)s ağ arayüzü tanımda yok"
#: vrtManager/instance.py:3337
#: vrtManager/instance.py:3328
msgid "The guest agent did not answer in time; nothing was changed"
msgstr "Konuk ajanı zamanında yanıt vermedi; hiçbir şey değiştirilmedi"
#: vrtManager/instance.py:3340
#: vrtManager/instance.py:3331
msgid "The VM runs Windows: its guest agent sets no root password or SSH key"
msgstr ""
"Sanal makinede Windows çalışıyor: konuk ajanı root parolası ya da SSH "

Binary file not shown.

View file

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-11-17 04:36+0000\n"
"POT-Creation-Date: 2026-11-17 05:39+0000\n"
"PO-Revision-Date: \n"
"Last-Translator: \n"
"Language-Team: \n"
@ -3092,7 +3092,7 @@ msgstr "VNC 密码最多 8 个字母、数字或符号,不能有带重音的
msgid "A password takes no line breaks or other control characters."
msgstr "密码不能包含换行或其他控制字符。"
#: instances/forms.py:114 vrtManager/instance.py:1667
#: instances/forms.py:114 vrtManager/instance.py:1657
msgid ""
"The console listens on no address (on a network, a socket or nowhere); change"
" it in the XML editor"
@ -3179,7 +3179,7 @@ msgstr "虚拟机未定义;请检查这些卷,然后处理此任务:%(volu
msgid "Delete snapshot"
msgstr "删除快照"
#: instances/jobs.py:357 vrtManager/instance.py:2426
#: instances/jobs.py:357 vrtManager/instance.py:2416
#, python-format
msgid "The VM has no external snapshot named %(name)s"
msgstr "虚拟机没有名为 %(name)s 的外部快照"
@ -3211,7 +3211,7 @@ msgstr "虚拟机已不在运行该任务的计算节点上"
msgid "Take snapshot"
msgstr "创建快照"
#: instances/jobs.py:425 instances/jobs.py:434 vrtManager/instance.py:2017
#: instances/jobs.py:425 instances/jobs.py:434 vrtManager/instance.py:2007
#, python-format
msgid "A snapshot named %(name)s already exists"
msgstr "名为 %(name)s 的快照已存在"
@ -3350,12 +3350,12 @@ msgstr "镜像已存在。请检查卷或更改虚拟机名称"
msgid "Each network card needs a network"
msgstr "每个网卡都需要一个网络"
#: instances/jobs.py:868 vrtManager/instance.py:2858
#: instances/jobs.py:868 vrtManager/instance.py:2849
#, python-format
msgid "This host has no network %(name)s"
msgstr "此主机没有网络 %(name)s"
#: instances/jobs.py:870 vrtManager/instance.py:2860
#: instances/jobs.py:870 vrtManager/instance.py:2851
#, python-format
msgid "This host has no network filter %(name)s"
msgstr "此主机没有网络过滤器 %(name)s"
@ -3425,7 +3425,7 @@ msgstr "cloud-init 种子需要为磁盘使用目录类型的存储池"
msgid "This host offers no firmware %(firmware)s"
msgstr "此主机不提供固件 %(firmware)s"
#: instances/jobs.py:957 vrtManager/instance.py:3207
#: instances/jobs.py:957 vrtManager/instance.py:3198
msgid "This host offers no TPM 2.0: install swtpm on it"
msgstr "此主机不提供 TPM 2.0:请在主机上安装 swtpm"
@ -4668,7 +4668,7 @@ msgid "Add USB device"
msgstr "添加 USB 设备"
#: instances/templates/instances/host_devices_form.html:18
#: vrtManager/instance.py:3111
#: vrtManager/instance.py:3102
msgid ""
"A VM with a saved state does not change its USB devices: start it, or start "
"it without its saved state"
@ -6526,7 +6526,7 @@ msgstr "卷已成功更改。"
msgid "Disk %(dev)s is not a storage volume of this instance"
msgstr "磁盘 %(dev)s 不是此虚拟机的存储卷"
#: instances/views.py:1598 vrtManager/instance.py:2436
#: instances/views.py:1598 vrtManager/instance.py:2426
msgid "The VM has a saved state; start it or remove the saved state first"
msgstr "虚拟机有保存的状态;请先启动它或删除保存的状态"
@ -6580,7 +6580,7 @@ msgstr "快照未删除:%(err)s"
msgid "Add at least one device to the boot order."
msgstr "请至少向启动顺序中添加一个设备。"
#: instances/views.py:1911 vrtManager/instance.py:1208
#: instances/views.py:1911 vrtManager/instance.py:1198
msgid "Invalid Device Type for boot order"
msgstr "启动顺序的设备类型无效"
@ -9247,13 +9247,102 @@ msgid ""
"pool %(other)s of %(other_compute)s"
msgstr "%(compute)s 的存储池 %(pool)s 与 %(other_compute)s 的存储池 %(other)s 不是同一目录"
#: vrtManager/backup.py:30
#: vrtManager/backup.py:35
#, python-format
msgid ""
"Storage pool %(pool)s is not an active directory or NFS pool of this host, or"
" not the one the backup target registered"
msgstr "存储池 %(pool)s 不是此主机上活动的目录或 NFS 存储池,或不是备份目标登记的那个存储池"
#: vrtManager/backup.py:62
#, python-format
msgid "%(vm)s has a saved state; start it or remove the saved state first"
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
#, python-format
msgid "%(vm)s shares a host directory (filesystem); it cannot be backed up"
msgstr "%(vm)s 共享主机目录(filesystem);无法备份"
#: vrtManager/backup.py:68
#, python-format
msgid "%(vm)s boots a kernel file of the host; it cannot be backed up"
msgstr "%(vm)s 从主机上的内核文件启动;无法备份"
#: vrtManager/backup.py:70
#, python-format
msgid "%(vm)s has a host device; it cannot be backed up"
msgstr "%(vm)s 有主机设备;无法备份"
#: vrtManager/backup.py:76
msgid "CD-ROM: not copied"
msgstr "CD-ROM:不复制"
#: vrtManager/backup.py:76
msgid "Floppy: not copied"
msgstr "软盘:不复制"
#: vrtManager/backup.py:80
#, python-format
msgid "Disk %(dev)s is encrypted; it cannot be backed up"
msgstr "磁盘 %(dev)s 已加密;无法备份"
#: vrtManager/backup.py:83
#, python-format
msgid "Disk %(dev)s is not a file; it cannot be backed up"
msgstr "磁盘 %(dev)s 不是文件;无法备份"
#: vrtManager/backup.py:85
#, python-format
msgid "Disk %(dev)s is shareable; it cannot be backed up"
msgstr "磁盘 %(dev)s 可共享;无法备份"
#: vrtManager/backup.py:88
#, python-format
msgid "Disk %(dev)s is %(format)s; only qcow2 and raw disks are backed up"
msgstr "磁盘 %(dev)s 是 %(format)s 格式;只备份 qcow2 和 raw 磁盘"
#: vrtManager/backup.py:95
#, python-format
msgid ""
"Disk %(dev)s (%(path)s) is in no storage pool of the host; it cannot be "
"backed up"
msgstr "磁盘 %(dev)s(%(path)s)不在主机的任何存储池中;无法备份"
#: vrtManager/backup.py:108
#, python-format
msgid ""
"Disks %(devs)s change at the next start; back the VM up after it restarts"
msgstr "磁盘 %(devs)s 将在下次启动时更改;请在虚拟机重启后再备份"
#: vrtManager/backup.py:113 vrtManager/instance.py:494
#, python-format
msgid ""
"The NVRAM file %(path)s is not in libvirt's NVRAM directory %(dir)s and "
"cannot be copied"
msgstr "NVRAM 文件 %(path)s 不在 libvirt 的 NVRAM 目录 %(dir)s 中,无法复制"
#: vrtManager/backup.py:164
#, python-format
msgid ""
"Storage pool %(pool)s has %(free).1f GiB free; the backup needs %(size).1f "
"GiB (the copied disks, plus %(percent)g%% of them, at least %(minimum)g GiB)"
msgstr ""
"存储池 %(pool)s 有 %(free).1f GiB 可用空间;备份需要 %(size).1f GiB(复制的磁盘,加上其 "
"%(percent)g%%,至少 %(minimum)g GiB)"
#: vrtManager/backup.py:177
#, python-format
msgid ""
"The file %(name)s read back from the backup target differs from the one "
"written"
msgstr "从备份目标读回的文件 %(name)s 与写入的不同"
#: vrtManager/connection.py:45
msgid "Connection closed (error)"
msgstr "连接已关闭(错误)"
@ -9277,36 +9366,36 @@ msgid ""
" for it"
msgstr "连接失败:%(host)s 无响应:仍有 %(requests)s 个请求在等待它"
#: vrtManager/connection.py:248
#: vrtManager/connection.py:250
#, python-format
msgid "Connection Failed: %(host)s did not answer within %(seconds)s s"
msgstr "连接失败:%(host)s 在 %(seconds)s 秒内未响应"
#: vrtManager/connection.py:259
#: vrtManager/connection.py:261
msgid "the connection closed right after opening"
msgstr "连接在打开后立即关闭"
#: vrtManager/connection.py:272
#: vrtManager/connection.py:274
#, python-format
msgid "Connection Failed: %(error)s"
msgstr "连接失败:%(error)s"
#: vrtManager/connection.py:341
#: vrtManager/connection.py:343
#, python-format
msgid "Connection closed (%(reason)s)"
msgstr "连接已关闭(%(reason)s)"
#: vrtManager/connection.py:493
#: vrtManager/connection.py:495
#, python-format
msgid "Connection Failed: %(host)s is not connected"
msgstr "连接失败:%(host)s 未连接"
#: vrtManager/connection.py:545
#: vrtManager/connection.py:547
#, python-format
msgid "This host has no architecture %(arch)s"
msgstr "此主机没有 %(arch)s 架构"
#: vrtManager/connection.py:1214
#: vrtManager/connection.py:1233
#, python-format
msgid ""
"Pool %(pool)s is not active: the files the disks of the VMs in it are made "
@ -9455,181 +9544,174 @@ msgid ""
"%(error)s; remove the partial disk copies from the destination host: %(left)s"
msgstr "%(error)s;请从目标主机删除不完整的磁盘副本:%(left)s"
#: vrtManager/instance.py:494
#, python-format
msgid ""
"The NVRAM file %(path)s is not in libvirt's NVRAM directory %(dir)s and "
"cannot be copied"
msgstr "NVRAM 文件 %(path)s 不在 libvirt 的 NVRAM 目录 %(dir)s 中,无法复制"
#: vrtManager/instance.py:503
#, python-format
msgid "The destination host cannot see the NVRAM file %(path)s"
msgstr "目标主机看不到 NVRAM 文件 %(path)s"
#: vrtManager/instance.py:594
#: vrtManager/instance.py:584
#, python-format
msgid "%(type)s disk, cannot be checked"
msgstr "%(type)s 磁盘,无法检查"
#: vrtManager/instance.py:634
#: vrtManager/instance.py:624
#, python-format
msgid "The destination host already has a VM %(key)s"
msgstr "目标主机上已有虚拟机 %(key)s"
#: vrtManager/instance.py:656
#: vrtManager/instance.py:646
msgid "The VM was started on the source host during the migration"
msgstr "迁移期间虚拟机在源主机上被启动"
#: vrtManager/instance.py:672
#: vrtManager/instance.py:662
#, python-format
msgid ""
"%(error)s; the VM may now be defined only on the destination host: check both"
" hosts"
msgstr "%(error)s;虚拟机现在可能只在目标主机上定义:请检查两台主机"
#: vrtManager/instance.py:678
#: vrtManager/instance.py:668
#, python-format
msgid ""
"%(error)s; the VM is now defined on both hosts, remove it from the "
"destination: %(undo_error)s"
msgstr "%(error)s;虚拟机现在在两台主机上都有定义,请从目标主机删除它:%(undo_error)s"
#: vrtManager/instance.py:684
#: vrtManager/instance.py:674
msgid ""
"Snapshot names are 1-64 letters, digits, '.', '_' or '-' and do not start "
"with '.'"
msgstr "快照名称为 1-64 个字母、数字、'.'、'_' 或 '-',且不能以 '.' 开头"
#: vrtManager/instance.py:1196
#: vrtManager/instance.py:1186
msgid ""
"A device other than a disk or NIC is in the boot order: change it in the XML "
"editor"
msgstr "启动顺序中有磁盘或网卡以外的设备:请在 XML 编辑器中修改"
#: vrtManager/instance.py:1211
#: vrtManager/instance.py:1201
#, python-format
msgid "Boot device %(dev)s is not in the definition"
msgstr "启动设备 %(dev)s 不在定义中"
#: vrtManager/instance.py:1231
#: vrtManager/instance.py:1221
#, python-format
msgid "CD-ROM %(dev)s is not in the running definition"
msgstr "CD-ROM %(dev)s 不在运行中的定义中"
#: vrtManager/instance.py:1232
#: vrtManager/instance.py:1222
#, python-format
msgid "CD-ROM %(dev)s is not in the persistent definition"
msgstr "CD-ROM %(dev)s 不在持久定义中"
#: vrtManager/instance.py:1245
#: vrtManager/instance.py:1235
#, python-format
msgid "Media of %(dev)s changed in the running VM only: %(err)s"
msgstr "%(dev)s 的介质仅在运行中的虚拟机中更改:%(err)s"
#: vrtManager/instance.py:1256
#: vrtManager/instance.py:1246
#, python-format
msgid "ISO image %(image)s was not found"
msgstr "未找到 ISO 镜像 %(image)s"
#: vrtManager/instance.py:1258
#: vrtManager/instance.py:1248
#, python-format
msgid "ISO image %(image)s is in more than one storage pool"
msgstr "ISO 镜像 %(image)s 位于多个存储池中"
#: vrtManager/instance.py:1353
#: vrtManager/instance.py:1343
#, python-format
msgid "Disk %(target_dev)s is not in the VM's definition"
msgstr "磁盘 %(target_dev)s 不在虚拟机的定义中"
#: vrtManager/instance.py:1485
#: vrtManager/instance.py:1475
msgid "Please shutdown the instance then try to enable vCPU hotplug"
msgstr "请先关闭虚拟机,再启用 vCPU 热插拔"
#: vrtManager/instance.py:1688
#: vrtManager/instance.py:1678
#, python-format
msgid ""
"The serial console is a %(type)s one, the browser opens only a pty one; "
"change it in the XML editor"
msgstr "串行控制台的类型是 %(type)s,浏览器只能打开 pty 类型的;请在 XML 编辑器中更改"
#: vrtManager/instance.py:1799
#: vrtManager/instance.py:1789
msgid "The VM has no video card"
msgstr "虚拟机没有显卡"
#: vrtManager/instance.py:1809
#: vrtManager/instance.py:1799
#, python-format
msgid ""
"The VM's CPU topology has %(count)s vCPUs: change it in the XML editor to set"
" another maximum"
msgstr "该虚拟机的 CPU 拓扑为 %(count)s 个 vCPU:要设置其他最大值,请在 XML 编辑器中修改拓扑"
#: vrtManager/instance.py:1835
#: vrtManager/instance.py:1825
#, python-format
msgid "The VM's next start has a maximum memory of %(max)s MiB"
msgstr "虚拟机下次启动时的最大内存为 %(max)s MiB"
#: vrtManager/instance.py:1976
#: vrtManager/instance.py:1966
msgid ""
"The VM has external snapshots; internal snapshots cannot be mixed with them"
msgstr "虚拟机有外部快照;内部快照不能与其混用"
#: vrtManager/instance.py:2008
#: vrtManager/instance.py:1998
msgid "A snapshot with memory is not quiesced; it keeps the whole guest state"
msgstr "含内存的快照不会静默文件系统;它保存整个客户机状态"
#: vrtManager/instance.py:2010
#: vrtManager/instance.py:2000
msgid "Only a running VM's file systems can be frozen"
msgstr "只有运行中的虚拟机的文件系统可以冻结"
#: vrtManager/instance.py:2012
#: vrtManager/instance.py:2002
msgid "The QEMU guest agent is not connected; it freezes the file systems"
msgstr "QEMU 客户机代理未连接;文件系统由它冻结"
#: vrtManager/instance.py:2015
#: vrtManager/instance.py:2005
msgid ""
"The VM has internal snapshots; external snapshots cannot be mixed with them"
msgstr "虚拟机有内部快照;外部快照不能与其混用"
#: vrtManager/instance.py:2020
#: vrtManager/instance.py:2010
msgid "Newer snapshots exist after the last revert; delete them first"
msgstr "上次还原后存在更新的快照;请先删除它们"
#: vrtManager/instance.py:2023
#: vrtManager/instance.py:2013
msgid "No snapshot is current; revert to a snapshot first"
msgstr "没有当前快照;请先还原到某个快照"
#: vrtManager/instance.py:2029
#: vrtManager/instance.py:2019
#, python-format
msgid "Eject the media from %(dev)s first"
msgstr "请先弹出 %(dev)s 中的介质"
#: vrtManager/instance.py:2031
#: vrtManager/instance.py:2021
#, python-format
msgid "Disk %(dev)s is not a file; external snapshots need file disks"
msgstr "磁盘 %(dev)s 不是文件;外部快照需要文件磁盘"
#: vrtManager/instance.py:2039
#: vrtManager/instance.py:2029
#, python-format
msgid ""
"The storage pools could not be refreshed, so their free space is unknown: "
"%(err)s"
msgstr "无法刷新存储池,其可用空间未知:%(err)s"
#: vrtManager/instance.py:2060
#: vrtManager/instance.py:2050
msgid "Memory is saved only from a running VM"
msgstr "只能保存运行中的虚拟机的内存"
#: vrtManager/instance.py:2062
#: vrtManager/instance.py:2052
msgid "The VM has no disk to keep its memory next to"
msgstr "虚拟机没有可存放其内存的磁盘"
#: vrtManager/instance.py:2066
#: vrtManager/instance.py:2056
#, python-format
msgid "%(disk)s is not in a storage pool; memory is saved only into one"
msgstr "%(disk)s 不在存储池中;内存只能保存到存储池中"
#: vrtManager/instance.py:2097
#: vrtManager/instance.py:2087
#, python-format
msgid ""
"Storage pool %(pool)s has %(free).1f GiB free; the snapshot needs %(size).1f "
@ -9639,151 +9721,151 @@ msgstr ""
"存储池 %(pool)s 可用 %(free).1f GiB;快照需要 %(size).1f GiB(其中虚拟机磁盘的 %(percent)g%%,至少 "
"%(minimum)g GiB,若保存内存则另加内存)"
#: vrtManager/instance.py:2115
#: vrtManager/instance.py:2105
msgid ""
"This snapshot was taken by an older version on a UEFI VM and cannot be "
"reverted; delete it instead"
msgstr "此快照由旧版本在 UEFI 虚拟机上创建,无法还原;请将其删除"
#: vrtManager/instance.py:2145
#: vrtManager/instance.py:2135
#, python-format
msgid ""
"The revert failed twice; try again in a moment (%(error)s). The VM is "
"running."
msgstr "还原两次失败;请稍后重试(%(error)s)。虚拟机正在运行。"
#: vrtManager/instance.py:2147
#: vrtManager/instance.py:2137
#, python-format
msgid ""
"The revert failed twice; try again in a moment (%(error)s). The VM is shut "
"off."
msgstr "还原两次失败;请稍后重试(%(error)s)。虚拟机已关机。"
#: vrtManager/instance.py:2315
#: vrtManager/instance.py:2305
msgid "A disk moves when its VM is defined and running, paused or shut off"
msgstr "仅当虚拟机已定义且处于运行、暂停或关机状态时才能移动磁盘"
#: vrtManager/instance.py:2317
#: vrtManager/instance.py:2307
msgid ""
"A disk of a VM with snapshots, a saved state or a running block job does not "
"move"
msgstr "有快照、保存的状态或正在运行块任务的虚拟机的磁盘不能移动"
#: vrtManager/instance.py:2325
#: vrtManager/instance.py:2315
#, python-format
msgid ""
"%(dev)s is not a disk file of the VM, the same in its running and next "
"start's definition"
msgstr "%(dev)s 不是该虚拟机在运行中的定义和下次启动定义中相同的磁盘文件"
#: vrtManager/instance.py:2330
#: vrtManager/instance.py:2320
#, python-format
msgid "%(dev)s does not move: only writable raw and qcow2 disks do"
msgstr "%(dev)s 不能移动:只能移动可写的 raw 和 qcow2 磁盘"
#: vrtManager/instance.py:2337
#: vrtManager/instance.py:2327
#, python-format
msgid "%(dev)s does not move: no storage pool has %(path)s"
msgstr "%(dev)s 不能移动:没有存储池包含 %(path)s"
#: vrtManager/instance.py:2339
#: vrtManager/instance.py:2329
#, python-format
msgid "%(dev)s does not move: it has a backing file"
msgstr "%(dev)s 不能移动:它有后备文件"
#: vrtManager/instance.py:2342
#: vrtManager/instance.py:2332
#, python-format
msgid "%(pool_name)s is not an active pool of disk files of this host"
msgstr "%(pool_name)s 不是此主机上活动的磁盘文件存储池"
#: vrtManager/instance.py:2345
#: vrtManager/instance.py:2335
#, python-format
msgid "%(dev)s is in pool %(pool_name)s already"
msgstr "%(dev)s 已在存储池 %(pool_name)s 中"
#: vrtManager/instance.py:2349
#: vrtManager/instance.py:2339
#, python-format
msgid "Pool %(pool_name)s already has a file %(name)s"
msgstr "存储池 %(pool_name)s 中已有文件 %(name)s"
#: vrtManager/instance.py:2373
#: vrtManager/instance.py:2363
#, python-format
msgid "The copy of %(dev)s ended before it was complete"
msgstr "%(dev)s 的复制在完成前结束"
#: vrtManager/instance.py:2418
#: vrtManager/instance.py:2408
#, python-format
msgid "%(error)s; remove %(dest)s if it is there: %(cleanup_error)s"
msgstr "%(error)s;如果 %(dest)s 存在请将其删除:%(cleanup_error)s"
#: vrtManager/instance.py:2420
#: vrtManager/instance.py:2410
#, python-format
msgid "%(error)s; the VM may use %(dest)s now: check its disk %(dev)s"
msgstr "%(error)s;虚拟机现在可能在使用 %(dest)s:请检查其磁盘 %(dev)s"
#: vrtManager/instance.py:2427
#: vrtManager/instance.py:2417
#, python-format
msgid "The VM has no internal snapshot named %(name)s"
msgstr "虚拟机没有名为 %(name)s 的内部快照"
#: vrtManager/instance.py:2438
#: vrtManager/instance.py:2428
msgid "A snapshot job is still running on this VM; try again when it ends"
msgstr "此虚拟机上仍有快照任务在运行;请在其结束后重试"
#: vrtManager/instance.py:2448
#: vrtManager/instance.py:2438
msgid "Shut the VM down to revert to an internal snapshot"
msgstr "请关闭虚拟机后再还原到内部快照"
#: vrtManager/instance.py:2535
#: vrtManager/instance.py:2525
msgid "A VM with a host's or an external TPM is not cloned; remove it first"
msgstr "带有主机 TPM 或外部 TPM 的虚拟机无法克隆;请先将其移除"
#: vrtManager/instance.py:2566
#: vrtManager/instance.py:2556
msgid "Cannot clone a VM whose NVRAM is not a file"
msgstr "NVRAM 不是文件的虚拟机无法克隆"
#: vrtManager/instance.py:2636
#: vrtManager/instance.py:2627
#, python-format
msgid "Clone failed (%(err)s); remove these copies by hand: %(path)s"
msgstr "克隆失败(%(err)s);请手动删除这些副本:%(path)s"
#: vrtManager/instance.py:2647
#: vrtManager/instance.py:2638
msgid "Shut the VM down before cloning it"
msgstr "请先关闭虚拟机再克隆"
#: vrtManager/instance.py:2674
#: vrtManager/instance.py:2665
#, python-format
msgid "Clone failed (%(err)s); remove these copies by hand: %(leftovers)s"
msgstr "克隆失败(%(err)s);请手动删除这些副本:%(leftovers)s"
#: vrtManager/instance.py:2685
#: vrtManager/instance.py:2676
msgid "Live clone needs libvirt 11.10 or later; shut the VM down to clone it"
msgstr "在线克隆需要 libvirt 11.10 或更高版本;请关闭虚拟机后再克隆"
#: vrtManager/instance.py:2688
#: vrtManager/instance.py:2679
msgid "A VM with a TPM is cloned only shut down"
msgstr "带 TPM 的虚拟机只能在关机时克隆"
#: vrtManager/instance.py:2691
#: vrtManager/instance.py:2682
#, python-format
msgid "Disk %(dev)s is not a local file; shut the VM down to clone it"
msgstr "磁盘 %(dev)s 不是本地文件;请关闭虚拟机后再克隆"
#: vrtManager/instance.py:2693
#: vrtManager/instance.py:2684
#, python-format
msgid "Disk %(dev)s is shareable; shut the VM down to clone it"
msgstr "磁盘 %(dev)s 是可共享的;请关闭虚拟机后再克隆"
#: vrtManager/instance.py:2698
#: vrtManager/instance.py:2689
#, python-format
msgid "Disk %(dev)s changes at the next start; shut the VM down to clone it"
msgstr "磁盘 %(dev)s 在下次启动时会改变;请关闭虚拟机后再克隆"
#: vrtManager/instance.py:2700
#: vrtManager/instance.py:2691
msgid "Another job is running on the VM; clone it when that ends"
msgstr "虚拟机上有另一个任务正在运行;请在其结束后再克隆"
#: vrtManager/instance.py:2726
#: vrtManager/instance.py:2717
#, python-format
msgid ""
"Storage pool %(pool)s has %(free).1f GiB free; the clone needs %(size).1f GiB"
@ -9792,111 +9874,111 @@ msgstr ""
"存储池 %(pool)s 可用 %(free).1f GiB;克隆需要 %(size).1f GiB(复制的磁盘,再加其 %(percent)g%%,至少"
" %(minimum)g GiB)"
#: vrtManager/instance.py:2743
#: vrtManager/instance.py:2734
#, python-format
msgid "Volume %(name)s already exists in storage pool %(pool)s"
msgstr "卷 %(name)s 已存在于存储池 %(pool)s 中"
#: vrtManager/instance.py:2897
#: vrtManager/instance.py:2888
msgid "A network interface that is a host device is removed in the XML editor"
msgstr "作为主机设备的网络接口需在 XML 编辑器中删除"
#: vrtManager/instance.py:2913
#: vrtManager/instance.py:2904
#, python-format
msgid "No network interface with MAC %(old_mac)s"
msgstr "没有 MAC 为 %(old_mac)s 的网络接口"
#: vrtManager/instance.py:2916
#: vrtManager/instance.py:2907
msgid "A network interface that is a host device is changed in the XML editor"
msgstr "作为主机设备的网络接口需在 XML 编辑器中修改"
#: vrtManager/instance.py:3010
#: vrtManager/instance.py:3001
msgid ""
"A VM changes its PCI devices while it runs, or is shut off without a saved "
"state"
msgstr "虚拟机只能在运行时或无保存的状态的关机时更改其 PCI 设备"
#: vrtManager/instance.py:3031
#: vrtManager/instance.py:3022
#, python-format
msgid "%(err)s; whether the VM has %(device)s now is not known"
msgstr "%(err)s;虚拟机现在是否有 %(device)s 未知"
#: vrtManager/instance.py:3033
#: vrtManager/instance.py:3024
#, python-format
msgid "%(err)s; %(device)s: the VM is not running, its next start has it"
msgstr "%(err)s;%(device)s:虚拟机未运行,下次启动时有它"
#: vrtManager/instance.py:3034
#: vrtManager/instance.py:3025
#, python-format
msgid ""
"%(err)s; %(device)s: the VM is not running, its next start does not have it"
msgstr "%(err)s;%(device)s:虚拟机未运行,下次启动时没有它"
#: vrtManager/instance.py:3035
#: vrtManager/instance.py:3026
#, python-format
msgid "%(err)s; %(device)s: the running VM has it, its next start has it"
msgstr "%(err)s;%(device)s:运行中的虚拟机有它,下次启动时有它"
#: vrtManager/instance.py:3036
#: vrtManager/instance.py:3027
#, python-format
msgid ""
"%(err)s; %(device)s: the running VM has it, its next start does not have it"
msgstr "%(err)s;%(device)s:运行中的虚拟机有它,下次启动时没有它"
#: vrtManager/instance.py:3037
#: vrtManager/instance.py:3028
#, python-format
msgid ""
"%(err)s; %(device)s: the running VM does not have it, its next start has it"
msgstr "%(err)s;%(device)s:运行中的虚拟机没有它,下次启动时有它"
#: vrtManager/instance.py:3039
#: vrtManager/instance.py:3030
#, python-format
msgid ""
"%(err)s; %(device)s: the running VM does not have it, its next start does not"
" have it"
msgstr "%(err)s;%(device)s:运行中的虚拟机没有它,下次启动时没有它"
#: vrtManager/instance.py:3073
#: vrtManager/instance.py:3064
#, python-format
msgid "The VM has no PCI device %(address)s"
msgstr "虚拟机没有 PCI 设备 %(address)s"
#: vrtManager/instance.py:3094
#: vrtManager/instance.py:3085
msgid "The VM has no USB controller"
msgstr "虚拟机没有 USB 控制器"
#: vrtManager/instance.py:3128
#: vrtManager/instance.py:3119
msgid "The VM has no such USB device"
msgstr "虚拟机没有此 USB 设备"
#: vrtManager/instance.py:3142
#: vrtManager/instance.py:3133
#, python-format
msgid "The VM has no network interface %(mac)s"
msgstr "虚拟机没有网络接口 %(mac)s"
#: vrtManager/instance.py:3173
#: vrtManager/instance.py:3164
msgid "The VM has its own RNG device: change it in the XML editor"
msgstr "虚拟机有自己的 RNG 设备:请在 XML 编辑器中修改"
#: vrtManager/instance.py:3200
#: vrtManager/instance.py:3191
msgid "The VM has its own TPM: change it in the XML editor"
msgstr "虚拟机有自己的 TPM:请在 XML 编辑器中修改"
#: vrtManager/instance.py:3219
#: vrtManager/instance.py:3210
#, python-format
msgid "Unknown crash action %(action)s"
msgstr "未知的崩溃操作 %(action)s"
#: vrtManager/instance.py:3246
#: vrtManager/instance.py:3237
#, python-format
msgid "Network interface %(mac)s is not in the definition"
msgstr "网络接口 %(mac)s 不在定义中"
#: vrtManager/instance.py:3337
#: vrtManager/instance.py:3328
msgid "The guest agent did not answer in time; nothing was changed"
msgstr "客户机代理未及时响应;未做任何更改"
#: vrtManager/instance.py:3340
#: vrtManager/instance.py:3331
msgid "The VM runs Windows: its guest agent sets no root password or SSH key"
msgstr "该虚拟机运行 Windows:其客户机代理不能设置 root 密码或 SSH 密钥"

View file

@ -1,9 +1,14 @@
"""VM backups: the target pools and what a VM's backup holds (app vmbackups)."""
import hashlib
import os
import libvirt
from django.utils.translation import gettext_noop
from lxml import etree
from vrtManager.connection import NVRAM_DIR, wvmConnect
from vrtManager.instance import PERSISTENT_XML, wvmInstance
from vrtManager.util import OperationError
# pools that keep their volumes as files in one directory
@ -41,3 +46,150 @@ def pool_space(pool):
pool.refresh(0)
_state, size, used, free = pool.info()
return {"name": pool.name(), "size": size, "free": free, "used_percent": used * 100 / size if size else 0}
class wvmBackup(wvmInstance):
"""The VM side of a backup."""
def backup_plan(self):
"""What a backup of the VM copies, from its persistent definition:
{"definition", "disks": [{dev, path, pool, format, capacity}],
"nvram": path or None, "left_out": [{dev, why}]}. Refuses, naming
why, a VM whose backup could not be restored as it is."""
tree = etree.fromstring(self._XMLDesc(PERSISTENT_XML))
name = self.instance.name()
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)
if tree.find("devices/tpm") is not None:
raise OperationError(gettext_noop("%(vm)s has TPM state; TPM backups come later"), vm=name)
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)
if tree.xpath("os/kernel|os/initrd|os/dtb"):
raise OperationError(gettext_noop("%(vm)s boots a kernel file of the host; it cannot be backed up"), vm=name)
if tree.xpath("devices/hostdev|devices/interface[@type='hostdev']"):
raise OperationError(gettext_noop("%(vm)s has a host device; it cannot be backed up"), vm=name)
disks, left_out = [], []
for disk in tree.xpath("devices/disk"):
dev = disk.find("target").get("dev")
if disk.get("device") in ("cdrom", "floppy"):
why = gettext_noop("CD-ROM: not copied") if disk.get("device") == "cdrom" else gettext_noop("Floppy: not copied")
left_out.append({"dev": dev, "why": why})
continue
if disk.xpath("encryption|source/encryption"):
raise OperationError(gettext_noop("Disk %(dev)s is encrypted; it cannot be backed up"), dev=dev)
path = disk.xpath("string(source/@file)")
if disk.get("type") != "file" or not path:
raise OperationError(gettext_noop("Disk %(dev)s is not a file; it cannot be backed up"), dev=dev)
if disk.find("shareable") is not None:
raise OperationError(gettext_noop("Disk %(dev)s is shareable; it cannot be backed up"), dev=dev)
disk_format = disk.xpath("string(driver/@type)") or "raw"
if disk_format not in ("qcow2", "raw"):
raise OperationError(gettext_noop("Disk %(dev)s is %(format)s; only qcow2 and raw disks are backed up"),
dev=dev, format=disk_format)
try:
vol = self.get_volume_by_path(path)
except libvirt.libvirtError as err:
if err.get_error_code() != libvirt.VIR_ERR_NO_STORAGE_VOL:
raise
raise OperationError(gettext_noop("Disk %(dev)s (%(path)s) is in no storage pool of the host; it cannot be backed up"),
dev=dev, path=path) from err
disks.append({"dev": dev, "path": path, "pool": vol.storagePoolLookupByVolume().name(),
"format": disk_format, "capacity": vol.info()[1]})
if self.instance.state()[0] != libvirt.VIR_DOMAIN_SHUTOFF:
# a running VM's disks are copied: the definition kept must name the same ones
live = etree.fromstring(self._XMLDesc(0))
copied = [(d["dev"], d["path"]) for d in disks]
running = [(d.find("target").get("dev"), d.xpath("string(source/@file)"))
for d in live.xpath("devices/disk[not(@device='cdrom' or @device='floppy')]")]
if copied != running:
changed = sorted({dev for dev, _path in set(copied) ^ set(running)})
raise OperationError(gettext_noop("Disks %(devs)s change at the next start; back the VM up after it restarts"),
devs=", ".join(changed))
nvram = tree.xpath("string(os/nvram/source/@file)") or (tree.findtext("os/nvram") or "").strip() or None
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"),
path=nvram, dir=NVRAM_DIR)
return {"definition": etree.tostring(tree).decode(), "disks": disks, "nvram": nvram, "left_out": left_out}
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
format (libvirt's createXMLFrom). Returns the copy's path."""
return self.get_wvmStorage(pool).clone_volume(
self.get_volume_by_path(disk["path"]), name, vol_fmt=disk["format"],
disk_owner_uid=owner_uid, disk_owner_gid=owner_gid,
)
def make_live_targets(self, disks, pool, names, owner_uid, owner_gid):
"""The empty volumes a running VM's push backup writes into, in the
target pool; the targets begin_clone_backup takes."""
targets = []
for disk in disks:
target = {"dev": disk["dev"], "pool": pool, "name": names[disk["dev"]],
"capacity": disk["capacity"], "format": disk["format"]}
target["path"] = self.create_clone_target(target, owner_uid, owner_gid)
targets.append(target)
return targets
def read_nvram(self, path):
"""The bytes of the VM's NVRAM file; None when it was never made (the
VM never started)."""
with self._nvram_pool() as pool:
vol = self._find_volume(pool, os.path.basename(path))
return None if vol is None else self.download_volume(vol)
def backup_file_names(uuid, disks, nvram):
"""The names of a backup's files in the target pool, from its UUID only."""
prefix = f"wvc-{uuid}"
return {
"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,
"domain": f"{prefix}-domain.xml",
"manifest": f"{prefix}-manifest.json",
}
def check_target_space(pool, disks, free_percent, free_min_gib):
"""The target keeps the disks' virtual capacity plus free_percent of
it, at least free_min_gib GiB, free (the snapshots' and clones' rule)."""
size = sum(d["capacity"] for d in disks)
needed = size + max(size * free_percent / 100, free_min_gib * 1024**3)
pool.refresh(0)
free = pool.info()[3]
if free < needed:
raise OperationError(gettext_noop(
"Storage pool %(pool)s has %(free).1f GiB free; the backup needs %(size).1f GiB (the copied disks, "
"plus %(percent)g%% of them, at least %(minimum)g 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):
"""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
SHA-256."""
remove_files(pool, [name])
vol = conn.upload_volume(pool, name, data, owner=owner)
if conn.download_volume(vol) != data:
vol.delete(0)
raise OperationError(gettext_noop("The file %(name)s read back from the backup target differs from the one written"), name=name)
return hashlib.sha256(data).hexdigest()
def get_file(conn, pool, name):
return conn.download_volume(pool.storageVolLookupByName(name))
def remove_files(pool, names):
"""Deletes the volumes names of pool; missing ones are passed over."""
for name in names:
vol = wvmConnect._find_volume(pool, name)
if vol is not None:
vol.delete(0)
def manifest_names(pool):
pool.refresh(0)
return sorted(name for name in pool.listVolumes() if name.startswith("wvc-") and name.endswith("-manifest.json"))

View file

@ -197,6 +197,8 @@ UNREAD_DISKS = etree.XPath("devices/disk[@device='disk'][not(driver/@type='raw')
# One use of NVRAM_DIR's pool at a time (_nvram_pool), on every host: a copy
# holds two hosts' pools, and locks per host taken by migrations both ways
# could deadlock. Reentrant, as that copy takes it twice.
# A lock of the process is enough: every user (migration, clone, backup and
# their recoveries) runs in the worker, the one process that runs jobs.
NVRAM_LOCK = threading.RLock()
class wvmConnection(object):
@ -1070,16 +1072,18 @@ class wvmConnect(object):
with contextlib.suppress(libvirtError):
pool.destroy()
def upload_volume(self, pool, name, data):
def upload_volume(self, pool, name, data, owner=None, mode="0644"):
"""A new raw volume in pool holding data, written through a libvirt
stream, which every connection type carries. A failed write leaves
no volume."""
stream, which every connection type carries; owner: (uid, gid) of
its file, else libvirt's (root). A failed write leaves no volume."""
permissions = (f"<permissions><owner>{owner[0]}</owner><group>{owner[1]}</group><mode>{mode}</mode></permissions>"
if owner else "")
stream = self.wvm.newStream(0)
vol = None
try:
vol = pool.createXML(
f"<volume><name>{util.xml_escape(name)}</name><capacity>{len(data)}</capacity>"
"<target><format type='raw'/></target></volume>",
f"<target><format type='raw'/>{permissions}</target></volume>",
0,
)
vol.upload(stream, 0, len(data), 0)
@ -1094,6 +1098,21 @@ class wvmConnect(object):
raise
return vol
def download_volume(self, vol):
"""A volume's bytes, read through a libvirt stream. For small files
(NVRAM, a backup's definition and manifest): held in memory."""
chunks = []
stream = self.wvm.newStream(0)
try:
vol.download(stream, 0, 0, 0)
stream.recvAll(lambda _stream, data, out: out.append(data), chunks)
stream.finish()
except Exception:
with contextlib.suppress(libvirtError):
stream.abort()
raise
return b"".join(chunks)
@staticmethod
def _find_volume(pool, name):
try:

View file

@ -502,17 +502,7 @@ class wvmInstances(wvmConnect):
if self._find_volume(target, name) is None:
raise util.OperationError(gettext_noop("The destination host cannot see the NVRAM file %(path)s"), path=path)
return None
chunks = []
stream = conn.wvm.newStream(0)
try:
vol.download(stream, 0, 0, 0)
stream.recvAll(lambda _stream, data, out: out.append(data), chunks)
stream.finish()
except Exception:
with contextlib.suppress(libvirtError):
stream.abort()
raise
self.upload_volume(target, name, b"".join(chunks))
self.upload_volume(target, name, conn.download_volume(vol))
return name
def delete_nvram(self, name):
@ -2567,6 +2557,8 @@ class wvmInstance(wvmConnect):
return tree, disks
def _clone_volume_xml(self, name, capacity, vol_format, owner_uid, owner_gid):
# compat and features are qcow2's: libvirt refuses them for another format
qcow2 = "<compat>1.1</compat><features><lazy_refcounts/></features>" if vol_format == "qcow2" else ""
return f"""<volume>
<name>{util.xml_escape(name)}</name>
<capacity>{capacity}</capacity>
@ -2579,8 +2571,7 @@ class wvmInstance(wvmConnect):
<mode>0644</mode>
<label>virt_image_t</label>
</permissions>
<compat>1.1</compat>
<features><lazy_refcounts/></features>
{qcow2}
</target>
</volume>"""

View file

@ -7,6 +7,7 @@ from unittest.mock import MagicMock
import libvirt
from lxml import etree
from vrtManager.connection import wvmConnect
from vrtManager.instance import wvmInstances
@ -196,6 +197,8 @@ class FakeSource:
def get_nvram(self):
return self.nvram
download_volume = wvmConnect.download_volume # through self.wvm's streams
reads = 0
def get_status(self):

View file

@ -0,0 +1,200 @@
"""What a VM's backup holds (wvmBackup.backup_plan), the target's file
names and space, and the small files' upload read back."""
import unittest
from unittest.mock import MagicMock
import libvirt
from vrtManager import util
from vrtManager.backup import backup_file_names, check_target_space, put_file, wvmBackup
from vrtManager.instance import PERSISTENT_XML
GIB = 1024**3
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>"
CDROM = "<disk type='file' device='cdrom'><source file='/iso/x.iso'/><target dev='sda'/></disk>"
def error(code):
err = libvirt.libvirtError("x")
err.err = (code,)
return err
def domain(devices=QCOW + RAW + CDROM, os_extra=""):
return (
f"<domain><name>vm1</name><uuid>u</uuid><os><type>hvm</type>{os_extra}</os>"
f"<devices>{devices}</devices></domain>"
)
def proxy(xml=None, live=None, state=libvirt.VIR_DOMAIN_SHUTOFF, managed_save=False):
p = wvmBackup.__new__(wvmBackup) # no connection: only these calls
p.wvm = MagicMock()
p.instance = MagicMock()
p.instance.name.return_value = "vm1"
p.instance.state.return_value = [state, 0]
p.instance.hasManagedSaveImage.return_value = managed_save
persistent = xml or domain()
p._XMLDesc = lambda flags: persistent if flags == PERSISTENT_XML else (live or persistent)
pool = MagicMock()
pool.name.return_value = "default"
def volume(path):
vol = MagicMock()
vol.info.return_value = [0, (10 if path.endswith("qcow2") else 20) * GIB, GIB]
vol.storagePoolLookupByVolume.return_value = pool
return vol
p.get_volume_by_path = MagicMock(side_effect=volume)
return p
class BackupPlanTestCase(unittest.TestCase):
def refused(self, p, *texts):
with self.assertRaises(util.OperationError) as caught:
p.backup_plan()
for text in texts:
self.assertIn(text, str(caught.exception))
def test_a_vm_with_qcow2_and_raw_disks_and_a_cdrom(self):
plan = proxy().backup_plan()
self.assertEqual(
plan["disks"],
[
{"dev": "vda", "path": "/pool/a.qcow2", "pool": "default", "format": "qcow2", "capacity": 10 * GIB},
{"dev": "vdb", "path": "/pool/b.img", "pool": "default", "format": "raw", "capacity": 20 * GIB},
],
)
self.assertEqual(plan["left_out"], [{"dev": "sda", "why": "CD-ROM: not copied"}])
self.assertIsNone(plan["nvram"])
self.assertIn("<name>vm1</name>", plan["definition"])
def test_the_nvram_is_named(self):
xml = domain(os_extra="<nvram>/var/lib/libvirt/qemu/nvram/vm1_VARS.fd</nvram>")
self.assertEqual(proxy(xml).backup_plan()["nvram"], "/var/lib/libvirt/qemu/nvram/vm1_VARS.fd")
xml = domain(os_extra="<nvram><source file='/var/lib/libvirt/qemu/nvram/vm1_VARS.fd'/></nvram>")
self.assertEqual(proxy(xml).backup_plan()["nvram"], "/var/lib/libvirt/qemu/nvram/vm1_VARS.fd")
def test_an_nvram_outside_libvirts_directory_is_refused(self):
self.refused(proxy(domain(os_extra="<nvram>/srv/vm1_VARS.fd</nvram>")), "/srv/vm1_VARS.fd")
def test_refusals_name_the_reason_and_the_device(self):
cases = {
"encrypted": (
"<disk type='file' device='disk'><driver type='qcow2'/><source file='/pool/a.qcow2'>"
"<encryption format='luks'/></source><target dev='vda'/></disk>",
("vda", "encrypted"),
),
"block": ("<disk type='block' device='disk'><source dev='/dev/sdb'/><target dev='vda'/></disk>", ("vda", "not a file")),
"network": ("<disk type='network' device='disk'><source protocol='rbd' name='p/i'/><target dev='vda'/></disk>", ("vda", "not a file")),
"volume": ("<disk type='volume' device='disk'><source pool='p' volume='v'/><target dev='vda'/></disk>", ("vda", "not a file")),
"dir": ("<disk type='dir' device='disk'><source dir='/srv'/><target dev='vda'/></disk>", ("vda", "not a file")),
"shareable": (
"<disk type='file' device='disk'><driver type='raw'/><source file='/pool/b.img'/><target dev='vda'/><shareable/></disk>",
("vda", "shareable"),
),
"other format": (
"<disk type='file' device='disk'><driver type='vmdk'/><source file='/pool/c.vmdk'/><target dev='vda'/></disk>",
("vda", "vmdk"),
),
"filesystem": (QCOW + "<filesystem type='mount'><source dir='/srv'/><target dir='t'/></filesystem>", ("host directory",)),
"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",)),
"tpm": (QCOW + "<tpm model='tpm-crb'><backend type='emulator'/></tpm>", ("vm1", "TPM")),
}
for name, (devices, texts) in cases.items():
with self.subTest(name):
self.refused(proxy(domain(devices)), *texts)
for tag in ("kernel", "initrd", "dtb"):
with self.subTest(tag):
self.refused(proxy(domain(os_extra=f"<{tag}>/boot/x</{tag}>")), "kernel")
def test_a_saved_state_is_refused(self):
self.refused(proxy(managed_save=True), "saved state")
def test_a_disk_in_no_pool_is_refused_by_name(self):
p = proxy()
p.get_volume_by_path.side_effect = error(libvirt.VIR_ERR_NO_STORAGE_VOL)
self.refused(p, "vda", "/pool/a.qcow2", "no storage pool")
def test_another_lookup_error_is_raised(self):
p = proxy()
p.get_volume_by_path.side_effect = error(libvirt.VIR_ERR_INTERNAL_ERROR)
with self.assertRaises(libvirt.libvirtError):
p.backup_plan()
def test_live_and_persistent_disks_must_match(self):
changed = QCOW.replace("/pool/a.qcow2", "/pool/new.qcow2") + RAW
p = proxy(domain(changed), live=domain(), state=libvirt.VIR_DOMAIN_RUNNING)
self.refused(p, "vda", "next start")
p = proxy(domain(QCOW), live=domain(QCOW + RAW), state=libvirt.VIR_DOMAIN_RUNNING)
self.refused(p, "next start")
p = proxy(domain(), live=domain(), state=libvirt.VIR_DOMAIN_RUNNING)
self.assertEqual(len(p.backup_plan()["disks"]), 2)
class FilesTestCase(unittest.TestCase):
def test_file_names(self):
uuid = "00000000-0000-4000-8000-000000000001"
disks = [{"dev": "vda", "format": "qcow2"}, {"dev": "vdb", "format": "raw"}]
self.assertEqual(
backup_file_names(uuid, disks, nvram=True),
{
"disks": {"vda": f"wvc-{uuid}-vda.qcow2", "vdb": f"wvc-{uuid}-vdb.raw"},
"nvram": f"wvc-{uuid}-nvram.fd",
"domain": f"wvc-{uuid}-domain.xml",
"manifest": f"wvc-{uuid}-manifest.json",
},
)
self.assertIsNone(backup_file_names(uuid, disks, nvram=False)["nvram"])
def test_space_counts_virtual_capacity_and_the_margin(self):
# 2 x 10 GiB plus max(10 % of it, 1 GiB) = 22 GiB
pool = MagicMock()
pool.name.return_value = "b1"
disks = [{"capacity": 10 * GIB}, {"capacity": 10 * GIB}]
pool.info.return_value = [2, 100 * GIB, 0, int(21.9 * GIB)]
with self.assertRaisesRegex(util.OperationError, "Storage pool b1 has 21.9 GiB free; the backup needs 22.0 GiB"):
check_target_space(pool, disks, 10, 1)
pool.info.return_value = [2, 100 * GIB, 0, 22 * GIB]
check_target_space(pool, disks, 10, 1)
pool.refresh.assert_called_with(0)
def test_put_file_refuses_a_different_read_back(self):
conn, pool = MagicMock(), MagicMock()
pool.storageVolLookupByName.side_effect = error(libvirt.VIR_ERR_NO_STORAGE_VOL)
conn.download_volume.return_value = b"other"
with self.assertRaisesRegex(util.OperationError, "wvc-x-domain.xml"):
put_file(conn, pool, "wvc-x-domain.xml", b"data", (107, 107))
conn.upload_volume.return_value.delete.assert_called_once_with(0)
def test_put_file_returns_the_sha256_and_replaces_a_volume(self):
conn, pool = MagicMock(), MagicMock()
old = pool.storageVolLookupByName.return_value
conn.download_volume.return_value = b"data"
self.assertEqual(
put_file(conn, pool, "wvc-x-domain.xml", b"data", (107, 108)),
"3a6eb0790f39ac87c94f3856b2dd2c5d110e6811602261a9a923d3bb23adc8b7",
)
old.delete.assert_called_once_with(0)
# 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))
def test_upload_volume_sets_the_owner(self):
from lxml import etree
from vrtManager.connection import wvmConnect
conn = wvmConnect.__new__(wvmConnect)
conn.wvm = MagicMock()
pool = MagicMock()
conn.upload_volume(pool, "f", b"ab", owner=(107, 108), mode="0600")
volume = etree.fromstring(pool.createXML.call_args.args[0])
self.assertEqual(volume.findtext("target/permissions/owner"), "107")
self.assertEqual(volume.findtext("target/permissions/group"), "108")
self.assertEqual(volume.findtext("target/permissions/mode"), "0600")
conn.upload_volume(pool, "g", b"ab")
self.assertIsNone(etree.fromstring(pool.createXML.call_args.args[0]).find("target/permissions"))

View file

@ -273,6 +273,16 @@ class CreateCloneTargetTestCase(unittest.TestCase):
self.assertEqual(volume.findtext("target/permissions/owner"), "107")
self.assertEqual(volume.findtext("target/permissions/group"), "108")
self.assertEqual(flags, 0)
self.assertEqual(volume.findtext("target/compat"), "1.1")
def test_a_raw_volume_has_no_qcow2_features(self):
p = proxy()
p.wvm.storagePoolLookupByName.return_value = p.pool
p.create_clone_target({"pool": "default", "name": "copy-vdb.raw", "capacity": GIB, "format": "raw"}, 107, 107)
volume = etree.fromstring(p.pool.createXML.call_args.args[0])
self.assertEqual(volume.find("target/format").get("type"), "raw")
self.assertIsNone(volume.find("target/compat"))
self.assertIsNone(volume.find("target/features"))
class DefineCloneTestCase(unittest.TestCase):