diff --git a/instances/tests/test_quota.py b/instances/tests/test_quota.py index 4bde91e4..2fa10fea 100644 --- a/instances/tests/test_quota.py +++ b/instances/tests/test_quota.py @@ -40,7 +40,8 @@ def vm_reader(vcpu=2, memory=1024, disk_gib=10, pending=None): return values(config)["memory"] def get_disk_devices(self, config=False): - return [{"size": values(config)["disk_gib"] << 30}] + size = values(config)["disk_gib"] + return [{"size": None if size is None else size << 30}] def values(persistent): return config if persistent else live @@ -98,6 +99,13 @@ class QuotaTests(TestCase): self.assertEqual(self.check(0, 0, 512, 0, reader=gone)[0], QUOTA_UNVERIFIED) + def test_a_disk_whose_size_is_unknown_refuses_an_increase(self): + # not 0 GiB: a volume not read (its pool stopped) may be the largest + self.own(self.up, 1) + self.assertEqual(self.check(0, 1, 0, 0, reader=vm_reader(disk_gib=None))[0], QUOTA_UNVERIFIED) + UserAttributes.objects.filter(user=self.user).update(max_disk_size=-1) # disks not limited: not needed + self.assertEqual(self.check(0, 1, 0, 0, reader=vm_reader(disk_gib=None))[0], "") + def test_each_host_is_checked_once(self): for n in range(3): self.own(self.up, n) diff --git a/instances/utils.py b/instances/utils.py index b563b1db..07f7f4d2 100644 --- a/instances/utils.py +++ b/instances/utils.py @@ -78,7 +78,8 @@ def disk_gib(disks): # check_user_quota could not read every VM of the user: an increase is refused QUOTA_UNVERIFIED = "unverified" QUOTA_UNVERIFIED_TEXT = gettext_noop( - "The quota cannot be checked because a host of your virtual machines cannot be reached. Nothing was changed.") + "The quota cannot be checked: a host of your virtual machines cannot be reached, or the size of one of " + "their disks cannot be read. Nothing was changed.") # The quota a change would exceed: instance, cpu, memory or disk, the total it # would make and the limit @@ -106,8 +107,8 @@ def check_user_quota(user, instance, cpu, memory, disk_size): The quota the user would exceed by adding these amounts (instances, vCPUs, memory MiB, disk GiB) to their VMs, a QuotaExceeded, or "". A quota of -1 has no limit; 0 allows none. QUOTA_UNVERIFIED if a - VM that counts cannot be read (its host is down, the VM is gone): the - usage is unknown, so an increase is refused. + VM that counts cannot be read (its host is down, the VM is gone, a disk's + size is unknown): the usage is unknown, so an increase is refused. """ ua, attributes_created = UserAttributes.objects.get_or_create(user=user) msg = "" @@ -156,7 +157,10 @@ def check_user_quota(user, instance, cpu, memory, disk_size): with conn.cached_reads(): cpu += max(conn.get_vcpu(), conn.get_vcpu(config=True)) memory += max(conn.get_memory(), conn.get_memory(config=True)) - disk_size += max(disk_gib(conn.get_disk_devices()), disk_gib(conn.get_disk_devices(config=True))) + disks = conn.get_disk_devices(), conn.get_disk_devices(config=True) + if ua.max_disk_size >= 0 and any(disk["size"] is None for devices in disks for disk in devices): + return QUOTA_UNVERIFIED # not 0 GiB + disk_size += max(map(disk_gib, disks)) except libvirtError: return QUOTA_UNVERIFIED diff --git a/locale/tr/LC_MESSAGES/django.mo b/locale/tr/LC_MESSAGES/django.mo index 2984eb01..fc0f227b 100644 Binary files a/locale/tr/LC_MESSAGES/django.mo and b/locale/tr/LC_MESSAGES/django.mo differ diff --git a/locale/tr/LC_MESSAGES/django.po b/locale/tr/LC_MESSAGES/django.po index 7f7ade86..af3ced5d 100644 --- a/locale/tr/LC_MESSAGES/django.po +++ b/locale/tr/LC_MESSAGES/django.po @@ -2792,7 +2792,7 @@ msgstr "" msgid "Delete snapshot" msgstr "Anlık görüntüyü sil" -#: instances/jobs.py:318 vrtManager/instance.py:2278 +#: instances/jobs.py:318 vrtManager/instance.py:2281 #, 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" @@ -2827,7 +2827,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:386 instances/jobs.py:395 vrtManager/instance.py:1874 +#: instances/jobs.py:386 instances/jobs.py:395 vrtManager/instance.py:1877 #, python-format msgid "A snapshot named %(name)s already exists" msgstr "%(name)s adında bir anlık görüntü zaten var" @@ -3025,7 +3025,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:839 vrtManager/instance.py:3010 +#: instances/jobs.py:839 vrtManager/instance.py:3013 msgid "This host offers no TPM 2.0: install swtpm on it" msgstr "Bu sunucu TPM 2.0 sunmuyor: üzerine swtpm kurun" @@ -5873,47 +5873,48 @@ msgstr "Disk dosyaları %(host)s üzerinde denetlenemiyor: %(err)s" #: instances/utils.py:81 msgid "" -"The quota cannot be checked because a host of your virtual machines cannot be" -" reached. Nothing was changed." +"The quota cannot be checked: a host of your virtual machines cannot be " +"reached, or the size of one of their disks cannot be read. Nothing was " +"changed." msgstr "" -"Sanal makinelerinizin bir sunucusuna erişilemediği için kota denetlenemiyor. " -"Hiçbir şey değiştirilmedi." +"Kota denetlenemiyor: sanal makinelerinizin bir sunucusuna erişilemiyor ya da " +"disklerinden birinin boyutu okunamıyor. Hiçbir şey değiştirilmedi." -#: instances/utils.py:87 +#: instances/utils.py:88 msgid "The quota of virtual machines is reached" msgstr "Sanal makine kotası doldu" -#: instances/utils.py:88 +#: instances/utils.py:89 msgid "The vCPU quota is reached" msgstr "vCPU kotası doldu" -#: instances/utils.py:89 +#: instances/utils.py:90 msgid "The memory quota is reached" msgstr "Bellek kotası doldu" -#: instances/utils.py:90 +#: instances/utils.py:91 msgid "The disk quota is reached" msgstr "Disk kotası doldu" -#: instances/utils.py:99 +#: instances/utils.py:100 #, python-format msgid "%(quota)s (%(total)s > %(limit)s)" msgstr "%(quota)s (%(total)s > %(limit)s)" -#: instances/utils.py:195 +#: instances/utils.py:199 msgid "None available device name" msgstr "Hiçbiri uygun aygıt adı değil" -#: instances/utils.py:402 +#: instances/utils.py:406 #, python-format msgid "%(hostname)s via %(address)s" msgstr "%(address)s üzerinden %(hostname)s" -#: instances/utils.py:441 +#: instances/utils.py:445 msgid "Invalid MAC address" msgstr "Geçersiz MAC adresi" -#: instances/utils.py:443 +#: instances/utils.py:447 msgid "More MAC addresses than networks" msgstr "Ağlardan daha fazla MAC adresi" @@ -9076,7 +9077,7 @@ msgstr "" "Anlık görüntü adları 1-64 harf, rakam, '.', '_' veya '-' karakterinden oluşur" " ve '.' ile başlamaz" -#: vrtManager/instance.py:1076 +#: vrtManager/instance.py:1079 msgid "" "A device other than a disk or NIC is in the boot order: change it in the XML " "editor" @@ -9084,104 +9085,104 @@ 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:1088 +#: vrtManager/instance.py:1091 msgid "Invalid Device Type for boot order" msgstr "Ön yükleme sırası için geçersiz aygıt türü" -#: vrtManager/instance.py:1091 +#: vrtManager/instance.py:1094 #, 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:1111 +#: vrtManager/instance.py:1114 #, 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:1112 +#: vrtManager/instance.py:1115 #, 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:1124 +#: vrtManager/instance.py:1127 #, 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:1135 +#: vrtManager/instance.py:1138 #, python-format msgid "ISO image %(image)s was not found" msgstr "ISO imajı %(image)s bulunamadı" -#: vrtManager/instance.py:1137 +#: vrtManager/instance.py:1140 #, 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:1244 +#: vrtManager/instance.py:1247 #, 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:1372 +#: vrtManager/instance.py:1375 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:1659 +#: vrtManager/instance.py:1662 msgid "The VM has no video card" msgstr "Sanal makinede ekran kartı yok" -#: vrtManager/instance.py:1833 +#: vrtManager/instance.py:1836 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:1865 +#: vrtManager/instance.py:1868 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:1867 +#: vrtManager/instance.py:1870 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:1869 +#: vrtManager/instance.py:1872 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:1872 +#: vrtManager/instance.py:1875 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:1877 +#: vrtManager/instance.py:1880 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:1880 +#: vrtManager/instance.py:1883 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:1886 +#: vrtManager/instance.py:1889 #, python-format msgid "Eject the media from %(dev)s first" msgstr "Önce %(dev)s içindeki ortamı çıkarın" -#: vrtManager/instance.py:1888 +#: vrtManager/instance.py:1891 #, 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:1896 +#: vrtManager/instance.py:1899 #, python-format msgid "" "The storage pools could not be refreshed, so their free space is unknown: " @@ -9189,21 +9190,21 @@ msgid "" msgstr "" "Depolama havuzları yenilenemedi, bu yüzden boş alanları bilinmiyor: %(err)s" -#: vrtManager/instance.py:1917 +#: vrtManager/instance.py:1920 msgid "Memory is saved only from a running VM" msgstr "Bellek yalnızca çalışan bir sanal makineden kaydedilir" -#: vrtManager/instance.py:1919 +#: vrtManager/instance.py:1922 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:1923 +#: vrtManager/instance.py:1926 #, 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:1954 +#: vrtManager/instance.py:1957 #, python-format msgid "" "Storage pool %(pool)s has %(free).1f GiB free; the snapshot needs %(size).1f " @@ -9214,7 +9215,7 @@ msgstr "" "%(size).1f GiB gerektiriyor (sanal makinenin oradaki disklerinin " "%%%(percent)g kadarı, en az %(minimum)g GiB, ve kaydediliyorsa bellek)" -#: vrtManager/instance.py:1972 +#: vrtManager/instance.py:1975 msgid "" "This snapshot was taken by an older version on a UEFI VM and cannot be " "reverted; delete it instead" @@ -9222,7 +9223,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:2002 +#: vrtManager/instance.py:2005 #, python-format msgid "" "The revert failed twice; try again in a moment (%(error)s). The VM is " @@ -9231,7 +9232,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:2004 +#: vrtManager/instance.py:2007 #, python-format msgid "" "The revert failed twice; try again in a moment (%(error)s). The VM is shut " @@ -9240,13 +9241,13 @@ msgstr "" "Geri dönüş iki kez başarısız oldu; biraz sonra tekrar deneyin (%(error)s). " "Sanal makine kapalı." -#: vrtManager/instance.py:2167 +#: vrtManager/instance.py:2170 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:2169 +#: vrtManager/instance.py:2172 msgid "" "A disk of a VM with snapshots, a saved state or a running block job does not " "move" @@ -9254,7 +9255,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:2177 +#: vrtManager/instance.py:2180 #, python-format msgid "" "%(dev)s is not a disk file of the VM, the same in its running and next " @@ -9263,132 +9264,132 @@ msgstr "" "%(dev)s, sanal makinenin çalışan ve sonraki başlatma tanımlarında aynı olan " "bir disk dosyası değil" -#: vrtManager/instance.py:2182 +#: vrtManager/instance.py:2185 #, 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:2189 +#: vrtManager/instance.py:2192 #, 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:2191 +#: vrtManager/instance.py:2194 #, 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:2194 +#: vrtManager/instance.py:2197 #, 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:2197 +#: vrtManager/instance.py:2200 #, python-format msgid "%(dev)s is in pool %(pool_name)s already" msgstr "%(dev)s zaten %(pool_name)s havuzunda" -#: vrtManager/instance.py:2201 +#: vrtManager/instance.py:2204 #, 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:2225 +#: vrtManager/instance.py:2228 #, python-format msgid "The copy of %(dev)s ended before it was complete" msgstr "%(dev)s kopyası tamamlanmadan sona erdi" -#: vrtManager/instance.py:2270 +#: vrtManager/instance.py:2273 #, 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:2272 +#: vrtManager/instance.py:2275 #, 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:2279 +#: vrtManager/instance.py:2282 #, 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:2288 +#: vrtManager/instance.py:2291 msgid "The VM has a saved state; start it or remove the saved state first" msgstr "" "Sanal makinenin kaydedilmiş durumu var; önce başlatın veya kaydedilmiş durumu" " kaldırın" -#: vrtManager/instance.py:2290 +#: vrtManager/instance.py:2293 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:2300 +#: vrtManager/instance.py:2303 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:2398 +#: vrtManager/instance.py:2401 msgid "Cannot clone a VM whose NVRAM is not a file" msgstr "NVRAM'i dosya olmayan bir sanal makine klonlanamaz" -#: vrtManager/instance.py:2466 +#: vrtManager/instance.py:2469 #, 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:2476 +#: vrtManager/instance.py:2479 msgid "Shut the VM down before cloning it" msgstr "Klonlamadan önce sanal makineyi kapatın" -#: vrtManager/instance.py:2530 +#: vrtManager/instance.py:2533 #, 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:2541 +#: vrtManager/instance.py:2544 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:2544 +#: vrtManager/instance.py:2547 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:2547 +#: vrtManager/instance.py:2550 #, 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:2549 +#: vrtManager/instance.py:2552 #, 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:2554 +#: vrtManager/instance.py:2557 #, 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:2556 +#: vrtManager/instance.py:2559 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:2569 +#: vrtManager/instance.py:2572 #, 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:2588 +#: vrtManager/instance.py:2591 #, python-format msgid "" "Storage pool %(pool)s has %(free).1f GiB free; the clone needs %(size).1f GiB" @@ -9398,20 +9399,20 @@ msgstr "" "gerektiriyor (kopyalanan diskler, artı bunların %%%(percent)g kadarı, en az " "%(minimum)g GiB)" -#: vrtManager/instance.py:2727 +#: vrtManager/instance.py:2730 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:2743 +#: vrtManager/instance.py:2746 #, python-format msgid "No network interface with MAC %(old_mac)s" msgstr "MAC adresi %(old_mac)s olan ağ arabirimi yok" -#: vrtManager/instance.py:2746 +#: vrtManager/instance.py:2749 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:2837 +#: vrtManager/instance.py:2840 msgid "" "A VM changes its PCI devices while it runs, or is shut off without a saved " "state" @@ -9419,14 +9420,14 @@ msgstr "" "Sanal makine PCI aygıtlarını çalışırken veya kaydedilmiş durumu olmadan " "kapalıyken değiştirir" -#: vrtManager/instance.py:2849 +#: vrtManager/instance.py:2852 #, python-format msgid "%(err)s; whether the VM has PCI device %(address)s now is not known" msgstr "" "%(err)s; sanal makinede şu anda %(address)s PCI aygıtının olup olmadığı " "bilinmiyor" -#: vrtManager/instance.py:2851 +#: vrtManager/instance.py:2854 #, python-format msgid "" "%(err)s; PCI device %(address)s: the VM is not running, its next start has it" @@ -9434,7 +9435,7 @@ msgstr "" "%(err)s; PCI aygıtı %(address)s: sanal makine çalışmıyor, sonraki başlatmada " "var" -#: vrtManager/instance.py:2853 +#: vrtManager/instance.py:2856 #, python-format msgid "" "%(err)s; PCI device %(address)s: the VM is not running, its next start does " @@ -9443,7 +9444,7 @@ msgstr "" "%(err)s; PCI aygıtı %(address)s: sanal makine çalışmıyor, sonraki başlatmada " "yok" -#: vrtManager/instance.py:2854 +#: vrtManager/instance.py:2857 #, python-format msgid "" "%(err)s; PCI device %(address)s: the running VM has it, its next start has it" @@ -9451,7 +9452,7 @@ msgstr "" "%(err)s; PCI aygıtı %(address)s: çalışan sanal makinede var, sonraki " "başlatmada var" -#: vrtManager/instance.py:2856 +#: vrtManager/instance.py:2859 #, python-format msgid "" "%(err)s; PCI device %(address)s: the running VM has it, its next start does " @@ -9460,7 +9461,7 @@ msgstr "" "%(err)s; PCI aygıtı %(address)s: çalışan sanal makinede var, sonraki " "başlatmada yok" -#: vrtManager/instance.py:2858 +#: vrtManager/instance.py:2861 #, python-format msgid "" "%(err)s; PCI device %(address)s: the running VM does not have it, its next " @@ -9469,7 +9470,7 @@ msgstr "" "%(err)s; PCI aygıtı %(address)s: çalışan sanal makinede yok, sonraki " "başlatmada var" -#: vrtManager/instance.py:2860 +#: vrtManager/instance.py:2863 #, python-format msgid "" "%(err)s; PCI device %(address)s: the running VM does not have it, its next " @@ -9478,34 +9479,34 @@ msgstr "" "%(err)s; PCI aygıtı %(address)s: çalışan sanal makinede yok, sonraki " "başlatmada yok" -#: vrtManager/instance.py:2894 +#: vrtManager/instance.py:2897 #, python-format msgid "The VM has no PCI device %(address)s" msgstr "Sanal makinede %(address)s PCI aygıtı yok" -#: vrtManager/instance.py:2912 +#: vrtManager/instance.py:2915 msgid "The VM has no USB controller" msgstr "Sanal makinede USB denetleyicisi yok" -#: vrtManager/instance.py:2931 +#: vrtManager/instance.py:2934 msgid "The VM has no such USB device" msgstr "Sanal makinede böyle bir USB aygıtı yok" -#: vrtManager/instance.py:2945 +#: vrtManager/instance.py:2948 #, python-format msgid "The VM has no network interface %(mac)s" msgstr "Sanal makinede %(mac)s ağ arabirimi yok" -#: vrtManager/instance.py:2976 +#: vrtManager/instance.py:2979 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:3003 +#: vrtManager/instance.py:3006 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:3022 +#: vrtManager/instance.py:3025 #, python-format msgid "Unknown crash action %(action)s" msgstr "Bilinmeyen çökme eylemi %(action)s" diff --git a/locale/zh/LC_MESSAGES/django.mo b/locale/zh/LC_MESSAGES/django.mo index 89cd34c8..069b3b1d 100644 Binary files a/locale/zh/LC_MESSAGES/django.mo and b/locale/zh/LC_MESSAGES/django.mo differ diff --git a/locale/zh/LC_MESSAGES/django.po b/locale/zh/LC_MESSAGES/django.po index 1e737cb3..8e76b4ed 100644 --- a/locale/zh/LC_MESSAGES/django.po +++ b/locale/zh/LC_MESSAGES/django.po @@ -2693,7 +2693,7 @@ msgstr "虚拟机未定义;请检查这些卷,然后处理此任务:%(volu msgid "Delete snapshot" msgstr "删除快照" -#: instances/jobs.py:318 vrtManager/instance.py:2278 +#: instances/jobs.py:318 vrtManager/instance.py:2281 #, python-format msgid "The VM has no external snapshot named %(name)s" msgstr "虚拟机没有名为 %(name)s 的外部快照" @@ -2725,7 +2725,7 @@ msgstr "虚拟机已不在运行该任务的计算节点上" msgid "Take snapshot" msgstr "创建快照" -#: instances/jobs.py:386 instances/jobs.py:395 vrtManager/instance.py:1874 +#: instances/jobs.py:386 instances/jobs.py:395 vrtManager/instance.py:1877 #, python-format msgid "A snapshot named %(name)s already exists" msgstr "名为 %(name)s 的快照已存在" @@ -2901,7 +2901,7 @@ msgstr "cloud-init 种子需要为磁盘使用目录类型的存储池" msgid "This host offers no firmware %(firmware)s" msgstr "此主机不提供固件 %(firmware)s" -#: instances/jobs.py:839 vrtManager/instance.py:3010 +#: instances/jobs.py:839 vrtManager/instance.py:3013 msgid "This host offers no TPM 2.0: install swtpm on it" msgstr "此主机不提供 TPM 2.0:请在主机上安装 swtpm" @@ -5575,45 +5575,46 @@ msgstr "无法在 %(host)s 上检查磁盘文件:%(err)s" #: instances/utils.py:81 msgid "" -"The quota cannot be checked because a host of your virtual machines cannot be" -" reached. Nothing was changed." -msgstr "无法检查配额,因为您的某台虚拟机所在主机无法连接。未做任何更改。" +"The quota cannot be checked: a host of your virtual machines cannot be " +"reached, or the size of one of their disks cannot be read. Nothing was " +"changed." +msgstr "无法检查配额:您的某台虚拟机所在主机无法连接,或其某个磁盘的大小无法读取。未做任何更改。" -#: instances/utils.py:87 +#: instances/utils.py:88 msgid "The quota of virtual machines is reached" msgstr "虚拟机配额已用尽" -#: instances/utils.py:88 +#: instances/utils.py:89 msgid "The vCPU quota is reached" msgstr "vCPU 配额已用尽" -#: instances/utils.py:89 +#: instances/utils.py:90 msgid "The memory quota is reached" msgstr "内存配额已用尽" -#: instances/utils.py:90 +#: instances/utils.py:91 msgid "The disk quota is reached" msgstr "磁盘配额已用尽" -#: instances/utils.py:99 +#: instances/utils.py:100 #, python-format msgid "%(quota)s (%(total)s > %(limit)s)" msgstr "%(quota)s(%(total)s > %(limit)s)" -#: instances/utils.py:195 +#: instances/utils.py:199 msgid "None available device name" msgstr "没有可用的设备名称" -#: instances/utils.py:402 +#: instances/utils.py:406 #, python-format msgid "%(hostname)s via %(address)s" msgstr "%(hostname)s,经由 %(address)s" -#: instances/utils.py:441 +#: instances/utils.py:445 msgid "Invalid MAC address" msgstr "无效的 MAC 地址" -#: instances/utils.py:443 +#: instances/utils.py:447 msgid "More MAC addresses than networks" msgstr "MAC 地址数量多于网络数量" @@ -8597,120 +8598,120 @@ msgid "" "with '.'" msgstr "快照名称为 1-64 个字母、数字、'.'、'_' 或 '-',且不能以 '.' 开头" -#: vrtManager/instance.py:1076 +#: vrtManager/instance.py:1079 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:1088 +#: vrtManager/instance.py:1091 msgid "Invalid Device Type for boot order" msgstr "启动顺序的设备类型无效" -#: vrtManager/instance.py:1091 +#: vrtManager/instance.py:1094 #, python-format msgid "Boot device %(dev)s is not in the definition" msgstr "启动设备 %(dev)s 不在定义中" -#: vrtManager/instance.py:1111 +#: vrtManager/instance.py:1114 #, python-format msgid "CD-ROM %(dev)s is not in the running definition" msgstr "CD-ROM %(dev)s 不在运行中的定义中" -#: vrtManager/instance.py:1112 +#: vrtManager/instance.py:1115 #, python-format msgid "CD-ROM %(dev)s is not in the persistent definition" msgstr "CD-ROM %(dev)s 不在持久定义中" -#: vrtManager/instance.py:1124 +#: vrtManager/instance.py:1127 #, python-format msgid "Media of %(dev)s changed in the running VM only: %(err)s" msgstr "%(dev)s 的介质仅在运行中的虚拟机中更改:%(err)s" -#: vrtManager/instance.py:1135 +#: vrtManager/instance.py:1138 #, python-format msgid "ISO image %(image)s was not found" msgstr "未找到 ISO 镜像 %(image)s" -#: vrtManager/instance.py:1137 +#: vrtManager/instance.py:1140 #, python-format msgid "ISO image %(image)s is in more than one storage pool" msgstr "ISO 镜像 %(image)s 位于多个存储池中" -#: vrtManager/instance.py:1244 +#: vrtManager/instance.py:1247 #, python-format msgid "Disk %(target_dev)s is not in the VM's definition" msgstr "磁盘 %(target_dev)s 不在虚拟机的定义中" -#: vrtManager/instance.py:1372 +#: vrtManager/instance.py:1375 msgid "Please shutdown the instance then try to enable vCPU hotplug" msgstr "请先关闭虚拟机,再启用 vCPU 热插拔" -#: vrtManager/instance.py:1659 +#: vrtManager/instance.py:1662 msgid "The VM has no video card" msgstr "虚拟机没有显卡" -#: vrtManager/instance.py:1833 +#: vrtManager/instance.py:1836 msgid "" "The VM has external snapshots; internal snapshots cannot be mixed with them" msgstr "虚拟机有外部快照;内部快照不能与其混用" -#: vrtManager/instance.py:1865 +#: vrtManager/instance.py:1868 msgid "A snapshot with memory is not quiesced; it keeps the whole guest state" msgstr "含内存的快照不会静默文件系统;它保存整个客户机状态" -#: vrtManager/instance.py:1867 +#: vrtManager/instance.py:1870 msgid "Only a running VM's file systems can be frozen" msgstr "只有运行中的虚拟机的文件系统可以冻结" -#: vrtManager/instance.py:1869 +#: vrtManager/instance.py:1872 msgid "The QEMU guest agent is not connected; it freezes the file systems" msgstr "QEMU 客户机代理未连接;文件系统由它冻结" -#: vrtManager/instance.py:1872 +#: vrtManager/instance.py:1875 msgid "" "The VM has internal snapshots; external snapshots cannot be mixed with them" msgstr "虚拟机有内部快照;外部快照不能与其混用" -#: vrtManager/instance.py:1877 +#: vrtManager/instance.py:1880 msgid "Newer snapshots exist after the last revert; delete them first" msgstr "上次还原后存在更新的快照;请先删除它们" -#: vrtManager/instance.py:1880 +#: vrtManager/instance.py:1883 msgid "No snapshot is current; revert to a snapshot first" msgstr "没有当前快照;请先还原到某个快照" -#: vrtManager/instance.py:1886 +#: vrtManager/instance.py:1889 #, python-format msgid "Eject the media from %(dev)s first" msgstr "请先弹出 %(dev)s 中的介质" -#: vrtManager/instance.py:1888 +#: vrtManager/instance.py:1891 #, python-format msgid "Disk %(dev)s is not a file; external snapshots need file disks" msgstr "磁盘 %(dev)s 不是文件;外部快照需要文件磁盘" -#: vrtManager/instance.py:1896 +#: vrtManager/instance.py:1899 #, python-format msgid "" "The storage pools could not be refreshed, so their free space is unknown: " "%(err)s" msgstr "无法刷新存储池,其可用空间未知:%(err)s" -#: vrtManager/instance.py:1917 +#: vrtManager/instance.py:1920 msgid "Memory is saved only from a running VM" msgstr "只能保存运行中的虚拟机的内存" -#: vrtManager/instance.py:1919 +#: vrtManager/instance.py:1922 msgid "The VM has no disk to keep its memory next to" msgstr "虚拟机没有可存放其内存的磁盘" -#: vrtManager/instance.py:1923 +#: vrtManager/instance.py:1926 #, python-format msgid "%(disk)s is not in a storage pool; memory is saved only into one" msgstr "%(disk)s 不在存储池中;内存只能保存到存储池中" -#: vrtManager/instance.py:1954 +#: vrtManager/instance.py:1957 #, python-format msgid "" "Storage pool %(pool)s has %(free).1f GiB free; the snapshot needs %(size).1f " @@ -8720,156 +8721,156 @@ msgstr "" "存储池 %(pool)s 可用 %(free).1f GiB;快照需要 %(size).1f GiB(其中虚拟机磁盘的 %(percent)g%%,至少 " "%(minimum)g GiB,若保存内存则另加内存)" -#: vrtManager/instance.py:1972 +#: vrtManager/instance.py:1975 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:2002 +#: vrtManager/instance.py:2005 #, python-format msgid "" "The revert failed twice; try again in a moment (%(error)s). The VM is " "running." msgstr "还原两次失败;请稍后重试(%(error)s)。虚拟机正在运行。" -#: vrtManager/instance.py:2004 +#: vrtManager/instance.py:2007 #, 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:2167 +#: vrtManager/instance.py:2170 msgid "A disk moves when its VM is defined and running, paused or shut off" msgstr "仅当虚拟机已定义且处于运行、暂停或关机状态时才能移动磁盘" -#: vrtManager/instance.py:2169 +#: vrtManager/instance.py:2172 msgid "" "A disk of a VM with snapshots, a saved state or a running block job does not " "move" msgstr "有快照、保存的状态或正在运行块任务的虚拟机的磁盘不能移动" -#: vrtManager/instance.py:2177 +#: vrtManager/instance.py:2180 #, 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:2182 +#: vrtManager/instance.py:2185 #, python-format msgid "%(dev)s does not move: only writable raw and qcow2 disks do" msgstr "%(dev)s 不能移动:只能移动可写的 raw 和 qcow2 磁盘" -#: vrtManager/instance.py:2189 +#: vrtManager/instance.py:2192 #, python-format msgid "%(dev)s does not move: no storage pool has %(path)s" msgstr "%(dev)s 不能移动:没有存储池包含 %(path)s" -#: vrtManager/instance.py:2191 +#: vrtManager/instance.py:2194 #, python-format msgid "%(dev)s does not move: it has a backing file" msgstr "%(dev)s 不能移动:它有后备文件" -#: vrtManager/instance.py:2194 +#: vrtManager/instance.py:2197 #, python-format msgid "%(pool_name)s is not an active pool of disk files of this host" msgstr "%(pool_name)s 不是此主机上活动的磁盘文件存储池" -#: vrtManager/instance.py:2197 +#: vrtManager/instance.py:2200 #, python-format msgid "%(dev)s is in pool %(pool_name)s already" msgstr "%(dev)s 已在存储池 %(pool_name)s 中" -#: vrtManager/instance.py:2201 +#: vrtManager/instance.py:2204 #, python-format msgid "Pool %(pool_name)s already has a file %(name)s" msgstr "存储池 %(pool_name)s 中已有文件 %(name)s" -#: vrtManager/instance.py:2225 +#: vrtManager/instance.py:2228 #, python-format msgid "The copy of %(dev)s ended before it was complete" msgstr "%(dev)s 的复制在完成前结束" -#: vrtManager/instance.py:2270 +#: vrtManager/instance.py:2273 #, 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:2272 +#: vrtManager/instance.py:2275 #, 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:2279 +#: vrtManager/instance.py:2282 #, python-format msgid "The VM has no internal snapshot named %(name)s" msgstr "虚拟机没有名为 %(name)s 的内部快照" -#: vrtManager/instance.py:2288 +#: vrtManager/instance.py:2291 msgid "The VM has a saved state; start it or remove the saved state first" msgstr "虚拟机有保存的状态;请先启动它或删除保存的状态" -#: vrtManager/instance.py:2290 +#: vrtManager/instance.py:2293 msgid "A snapshot job is still running on this VM; try again when it ends" msgstr "此虚拟机上仍有快照任务在运行;请在其结束后重试" -#: vrtManager/instance.py:2300 +#: vrtManager/instance.py:2303 msgid "Shut the VM down to revert to an internal snapshot" msgstr "请关闭虚拟机后再还原到内部快照" -#: vrtManager/instance.py:2398 +#: vrtManager/instance.py:2401 msgid "Cannot clone a VM whose NVRAM is not a file" msgstr "NVRAM 不是文件的虚拟机无法克隆" -#: vrtManager/instance.py:2466 +#: vrtManager/instance.py:2469 #, python-format msgid "Clone failed (%(err)s); remove these copies by hand: %(path)s" msgstr "克隆失败(%(err)s);请手动删除这些副本:%(path)s" -#: vrtManager/instance.py:2476 +#: vrtManager/instance.py:2479 msgid "Shut the VM down before cloning it" msgstr "请先关闭虚拟机再克隆" -#: vrtManager/instance.py:2530 +#: vrtManager/instance.py:2533 #, python-format msgid "Clone failed (%(err)s); remove these copies by hand: %(leftovers)s" msgstr "克隆失败(%(err)s);请手动删除这些副本:%(leftovers)s" -#: vrtManager/instance.py:2541 +#: vrtManager/instance.py:2544 msgid "Live clone needs libvirt 11.10 or later; shut the VM down to clone it" msgstr "在线克隆需要 libvirt 11.10 或更高版本;请关闭虚拟机后再克隆" -#: vrtManager/instance.py:2544 +#: vrtManager/instance.py:2547 msgid "A VM with a TPM is cloned only shut down" msgstr "带 TPM 的虚拟机只能在关机时克隆" -#: vrtManager/instance.py:2547 +#: vrtManager/instance.py:2550 #, python-format msgid "Disk %(dev)s is not a local file; shut the VM down to clone it" msgstr "磁盘 %(dev)s 不是本地文件;请关闭虚拟机后再克隆" -#: vrtManager/instance.py:2549 +#: vrtManager/instance.py:2552 #, python-format msgid "Disk %(dev)s is shareable; shut the VM down to clone it" msgstr "磁盘 %(dev)s 是可共享的;请关闭虚拟机后再克隆" -#: vrtManager/instance.py:2554 +#: vrtManager/instance.py:2557 #, python-format msgid "Disk %(dev)s changes at the next start; shut the VM down to clone it" msgstr "磁盘 %(dev)s 在下次启动时会改变;请关闭虚拟机后再克隆" -#: vrtManager/instance.py:2556 +#: vrtManager/instance.py:2559 msgid "Another job is running on the VM; clone it when that ends" msgstr "虚拟机上有另一个任务正在运行;请在其结束后再克隆" -#: vrtManager/instance.py:2569 +#: vrtManager/instance.py:2572 #, python-format msgid "Volume %(name)s already exists in storage pool %(pool)s" msgstr "卷 %(name)s 已存在于存储池 %(pool)s 中" -#: vrtManager/instance.py:2588 +#: vrtManager/instance.py:2591 #, python-format msgid "" "Storage pool %(pool)s has %(free).1f GiB free; the clone needs %(size).1f GiB" @@ -8878,97 +8879,97 @@ msgstr "" "存储池 %(pool)s 可用 %(free).1f GiB;克隆需要 %(size).1f GiB(复制的磁盘,再加其 %(percent)g%%,至少" " %(minimum)g GiB)" -#: vrtManager/instance.py:2727 +#: vrtManager/instance.py:2730 msgid "A network interface that is a host device is removed in the XML editor" msgstr "作为主机设备的网络接口需在 XML 编辑器中删除" -#: vrtManager/instance.py:2743 +#: vrtManager/instance.py:2746 #, python-format msgid "No network interface with MAC %(old_mac)s" msgstr "没有 MAC 为 %(old_mac)s 的网络接口" -#: vrtManager/instance.py:2746 +#: vrtManager/instance.py:2749 msgid "A network interface that is a host device is changed in the XML editor" msgstr "作为主机设备的网络接口需在 XML 编辑器中修改" -#: vrtManager/instance.py:2837 +#: vrtManager/instance.py:2840 msgid "" "A VM changes its PCI devices while it runs, or is shut off without a saved " "state" msgstr "虚拟机只能在运行时或无保存的状态的关机时更改其 PCI 设备" -#: vrtManager/instance.py:2849 +#: vrtManager/instance.py:2852 #, python-format msgid "%(err)s; whether the VM has PCI device %(address)s now is not known" msgstr "%(err)s;虚拟机现在是否有 PCI 设备 %(address)s 未知" -#: vrtManager/instance.py:2851 +#: vrtManager/instance.py:2854 #, python-format msgid "" "%(err)s; PCI device %(address)s: the VM is not running, its next start has it" msgstr "%(err)s;PCI 设备 %(address)s:虚拟机未运行,下次启动时有它" -#: vrtManager/instance.py:2853 +#: vrtManager/instance.py:2856 #, python-format msgid "" "%(err)s; PCI device %(address)s: the VM is not running, its next start does " "not have it" msgstr "%(err)s;PCI 设备 %(address)s:虚拟机未运行,下次启动时没有它" -#: vrtManager/instance.py:2854 +#: vrtManager/instance.py:2857 #, python-format msgid "" "%(err)s; PCI device %(address)s: the running VM has it, its next start has it" msgstr "%(err)s;PCI 设备 %(address)s:运行中的虚拟机有它,下次启动时有它" -#: vrtManager/instance.py:2856 +#: vrtManager/instance.py:2859 #, python-format msgid "" "%(err)s; PCI device %(address)s: the running VM has it, its next start does " "not have it" msgstr "%(err)s;PCI 设备 %(address)s:运行中的虚拟机有它,下次启动时没有它" -#: vrtManager/instance.py:2858 +#: vrtManager/instance.py:2861 #, python-format msgid "" "%(err)s; PCI device %(address)s: the running VM does not have it, its next " "start has it" msgstr "%(err)s;PCI 设备 %(address)s:运行中的虚拟机没有它,下次启动时有它" -#: vrtManager/instance.py:2860 +#: vrtManager/instance.py:2863 #, python-format msgid "" "%(err)s; PCI device %(address)s: the running VM does not have it, its next " "start does not have it" msgstr "%(err)s;PCI 设备 %(address)s:运行中的虚拟机没有它,下次启动时没有它" -#: vrtManager/instance.py:2894 +#: vrtManager/instance.py:2897 #, python-format msgid "The VM has no PCI device %(address)s" msgstr "虚拟机没有 PCI 设备 %(address)s" -#: vrtManager/instance.py:2912 +#: vrtManager/instance.py:2915 msgid "The VM has no USB controller" msgstr "虚拟机没有 USB 控制器" -#: vrtManager/instance.py:2931 +#: vrtManager/instance.py:2934 msgid "The VM has no such USB device" msgstr "虚拟机没有此 USB 设备" -#: vrtManager/instance.py:2945 +#: vrtManager/instance.py:2948 #, python-format msgid "The VM has no network interface %(mac)s" msgstr "虚拟机没有网络接口 %(mac)s" -#: vrtManager/instance.py:2976 +#: vrtManager/instance.py:2979 msgid "The VM has its own RNG device: change it in the XML editor" msgstr "虚拟机有自己的 RNG 设备:请在 XML 编辑器中修改" -#: vrtManager/instance.py:3003 +#: vrtManager/instance.py:3006 msgid "The VM has its own TPM: change it in the XML editor" msgstr "虚拟机有自己的 TPM:请在 XML 编辑器中修改" -#: vrtManager/instance.py:3022 +#: vrtManager/instance.py:3025 #, python-format msgid "Unknown crash action %(action)s" msgstr "未知的崩溃操作 %(action)s" diff --git a/vrtManager/instance.py b/vrtManager/instance.py index e0bfb5e2..df14a667 100644 --- a/vrtManager/instance.py +++ b/vrtManager/instance.py @@ -926,6 +926,11 @@ class wvmInstance(wvmConnect): volume, disk_size, used_size, storage = details else: volume = src_file + # a disk no pool holds: libvirt reads its size from the file or device, + # named by its path: a target names the running VM's disk, which may + # be another file than the one saved for its next start (that one: unknown) + with contextlib.suppress(libvirtError): + disk_size, used_size = self.instance.blockInfo(src_file)[:2] except Exception as e: logger.warning("Disk %s of %s not fully read: %s", dev, self.instance.name(), e) finally: diff --git a/vrtManager/tests/test_instance_getters.py b/vrtManager/tests/test_instance_getters.py index cb969c33..cd82f697 100644 --- a/vrtManager/tests/test_instance_getters.py +++ b/vrtManager/tests/test_instance_getters.py @@ -48,6 +48,15 @@ class DeviceGettersTestCase(unittest.TestCase): self.assertEqual([(n["inbound"], n["outbound"]) for n in nics[1:]], [([], [])] * 2) self.assertEqual([(n["nic"], n["model"]) for n in nics], [("default", "virtio"), ("br0", ""), ("", "")]) + def test_a_disk_no_pool_holds_has_the_size_libvirt_reads(self): + p = proxy() + p.instance = MagicMock() + # vda: libvirt reads it, by its path; vdb: it cannot + p.instance.blockInfo.side_effect = lambda path: [20 << 30, 5 << 30, 20 << 30] if path == "/pool/a.qcow2" else \ + (_ for _ in ()).throw(libvirtError("cannot read")) + self.assertEqual([(d["dev"], d["size"], d["used"]) for d in p.get_disk_devices()], + [("vda", 20 << 30, 5 << 30), ("vdb", None, None)]) + def test_an_empty_cdrom_shows_no_pool(self): media = proxy().get_media_devices() self.assertEqual( diff --git a/vrtManager/tests/test_read_cache.py b/vrtManager/tests/test_read_cache.py index 37303d23..f2948bb7 100644 --- a/vrtManager/tests/test_read_cache.py +++ b/vrtManager/tests/test_read_cache.py @@ -25,6 +25,9 @@ class FakeDomain: self.reads.append(flags) return f"" + def blockInfo(self, dev): # a disk no pool holds that libvirt cannot read either + raise libvirtError("cannot read") + class FakeConn: def __init__(self):