diff --git a/README.md b/README.md index 1a319b84..44e41c19 100644 --- a/README.md +++ b/README.md @@ -865,7 +865,7 @@ What an update from an older version changes for operators and users. `manage.py - A template VM is changed or deleted only by superusers and staff owners with the matching permission; other owners can still view, open the console and clone it. - On a running VM the edit forms show the settings as they will be at the next start, so saving an edit no longer reverts another pending change. - External snapshots need libvirt 9.9 or newer on the computes. libvirt 9.10 (openEuler 24.03 LTS) refuses to revert a snapshot taken without memory of a running or paused VM ("Invalid target domain state 'disk-snapshot'"); 11.10 reverts it. A VM's snapshots form one chain: after a revert, delete the newer snapshots before taking another. An internal snapshot is reverted only on a shut-off VM. Snapshot names no longer get an `s1.` prefix. A snapshot an older version took of a UEFI VM can only be deleted, not reverted. On NFS, the qemu user needs write access to the image directory to remove merged snapshot files. -- A storage volume a VM still needs (a disk, a backing file or a snapshot's file) is not deleted; deleting a VM with its files keeps a file another compute's VM or volume uses at the same path, and is refused before the VM is stopped when one of the other computes cannot be reached. +- A storage volume a VM still needs (a disk, a backing file or a snapshot's file) is not deleted; deleting a VM with its files keeps a file another compute's VM or volume uses at the same path, and is refused before the VM is stopped when one of the other computes cannot be reached. A pool's page names the VMs of its host that use each volume and lists those the host does not use. - A VM that vanishes from its compute, or whose compute is deleted, keeps its owners, tags, protection and schedules for `INSTANCE_OWNERSHIP_RETENTION_DAYS` (30) in case the same UUID comes back, and its backups are linked to it again; superusers manage these records on the "Removed VMs" page. - The Logs page records who changed what (computes, users, groups, VM owners, settings, SSH keys, host networks, pools, volumes, interfaces, secrets and network filters), every login, failed login and lockout, and every page or API call answered 401 or 403 to a signed-in user or a request with credentials, with the address and the result (a VM hidden with 404 is not logged). - On a host whose libvirt cannot change network interfaces (the udev backend: RHEL 9 and later, Debian 12), the interface pages offer no create, start, stop or delete. diff --git a/locale/tr/LC_MESSAGES/django.mo b/locale/tr/LC_MESSAGES/django.mo index 3b24ff4b..c352b593 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 3d68cb58..a39c67c3 100644 --- a/locale/tr/LC_MESSAGES/django.po +++ b/locale/tr/LC_MESSAGES/django.po @@ -11,7 +11,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-11-20 05:04+0000\n" +"POT-Creation-Date: 2026-11-20 05:17+0000\n" "PO-Revision-Date: 2020-11-04 12:00+0000\n" "Last-Translator: catborise , 2020\n" "Language-Team: Turkish (https://www.transifex.com/catborise/teams/110663/tr/)\n" @@ -74,7 +74,7 @@ msgstr "Geçersiz anahtar" #: instances/templates/create_instance_w2.html:42 #: interfaces/templates/interface.html:119 networks/templates/network.html:145 #: networks/templates/network.html:373 nwfilters/templates/nwfilters.html:29 -#: storages/templates/storage.html:123 virtsecrets/forms.py:34 +#: storages/templates/storage.html:140 virtsecrets/forms.py:34 #: virtsecrets/forms.py:36 vmbackups/forms.py:23 vmbackups/forms.py:36 #: vmbackups/forms.py:82 vmbackups/templates/vmbackups/policies.html:17 #: vmbackups/templates/vmbackups/targets.html:18 @@ -262,7 +262,7 @@ msgstr "Yalnızca güç ve konsol" #: accounts/templates/account.html:81 computes/templates/computes/list.html:110 #: instances/templates/instance_actions.html:9 -#: storages/templates/storage.html:140 +#: storages/templates/storage.html:166 #, python-format msgid "Actions for %(name)s" msgstr "%(name)s için işlemler" @@ -326,7 +326,7 @@ msgstr "Burada oturumunuz açık kalır; diğer oturumlarınız kapanır." #: storages/templates/create_stg_block.html:183 #: storages/templates/create_stg_vol_block.html:35 #: storages/templates/create_stg_vol_block.html:68 -#: storages/templates/storage.html:202 templates/base.html:65 +#: storages/templates/storage.html:228 templates/base.html:65 #: templates/common/confirm_delete.html:25 templates/common/form.html:27 #: virtsecrets/templates/create_secret_block.html:48 #: virtsecrets/templates/secrets.html:106 @@ -478,7 +478,7 @@ msgstr "%(name)s API anahtarı için işlemler" #: instances/templates/instances/settings_tab.html:315 #: instances/templates/instances/snapshots_tab.html:103 #: instances/templates/instances/snapshots_tab.html:117 -#: networks/templates/network.html:168 storages/templates/storage.html:153 +#: networks/templates/network.html:168 storages/templates/storage.html:179 #: templates/common/confirm_delete.html:5 #: templates/common/confirm_delete.html:9 #: templates/common/confirm_delete.html:26 @@ -1073,7 +1073,7 @@ msgstr "Sunucular" #: networks/templates/network.html:146 networks/templates/network.html:204 #: networks/templates/network.html:286 nwfilters/templates/nwfilter.html:56 #: nwfilters/templates/nwfilter.html:100 nwfilters/templates/nwfilters.html:35 -#: storages/templates/storage.html:126 virtsecrets/templates/secrets.html:33 +#: storages/templates/storage.html:144 virtsecrets/templates/secrets.html:33 msgid "Actions" msgstr "Eylemler" @@ -3397,7 +3397,7 @@ msgstr "Bağlan" #: storages/templates/create_stg_block.html:21 #: storages/templates/create_stg_vol_block.html:16 #: storages/templates/create_stg_vol_block.html:54 -#: storages/templates/storage.html:175 templates/base.html:61 +#: storages/templates/storage.html:201 templates/base.html:61 #: virtsecrets/templates/create_secret_block.html:16 #: virtsecrets/templates/secrets.html:97 msgid "Close" @@ -4284,7 +4284,7 @@ msgstr "Depolama havuzu" #: instances/templates/add_instance_volume.html:41 #: instances/templates/create_instance_w2.html:46 storages/forms.py:119 -#: storages/templates/storage.html:183 +#: storages/templates/storage.html:209 msgid "Letters, digits, dot, dash and underscore." msgstr "Harf, rakam, nokta, tire ve alt çizgi." @@ -4297,14 +4297,14 @@ msgstr "Boyut" #: instances/templates/add_instance_volume.html:51 #: instances/templates/instances/edit_instance_volume.html:82 -#: storages/templates/storage.html:124 storages/templates/storage.html:190 +#: storages/templates/storage.html:141 storages/templates/storage.html:216 msgid "Format" msgstr "Biçem" #: instances/templates/add_instance_volume.html:61 #: instances/templates/create_instance_w2.html:154 #: instances/templates/create_instance_w2.html:220 storages/forms.py:125 -#: storages/forms.py:145 storages/templates/storage.html:198 +#: storages/forms.py:145 storages/templates/storage.html:224 msgid "Preallocate metadata (qcow2)" msgstr "Meta veriyi önceden ayır (qcow2)" @@ -4344,7 +4344,7 @@ msgstr "Bazı sanal makinelerinizin bir sunucusuna şu anda ulaşılamıyor." msgid "VM states" msgstr "Sanal makine durumları" -#: instances/templates/allinstances.html:48 +#: instances/templates/allinstances.html:48 storages/templates/storage.html:125 msgid "All" msgstr "Tümü" @@ -4796,7 +4796,7 @@ msgstr "Ayrıntılar" #: instances/templates/instances/settings_tab.html:882 #: instances/templates/instances/settings_tab.html:884 #: nwfilters/templates/nwfilters.html:57 nwfilters/templates/nwfilters.html:94 -#: storages/templates/storage.html:143 storages/templates/storage.html:203 +#: storages/templates/storage.html:169 storages/templates/storage.html:229 msgid "Clone" msgstr "Klonla" @@ -4905,7 +4905,7 @@ msgstr "Kapat" #: instances/templates/instance_actions.html:39 #: interfaces/templates/interface.html:22 networks/templates/network.html:22 #: networks/templates/network.html:162 storages/templates/storage.html:26 -#: storages/templates/storage.html:147 +#: storages/templates/storage.html:173 msgid "More actions" msgstr "Diğer işlemler" @@ -5871,7 +5871,7 @@ msgid "The VM has no CD-ROM drive." msgstr "Sanal makinenin CD-ROM sürücüsü yok." #: instances/templates/instances/settings_tab.html:217 -#: storages/templates/storage.html:125 +#: storages/templates/storage.html:143 msgid "Capacity" msgstr "Kapasite" @@ -7822,7 +7822,8 @@ msgstr "Yayılan ağaç" #: interfaces/templates/interface.html:81 #: interfaces/templates/interfaces.html:57 nodedevs/templates/nodedevs.html:37 -#: nodedevs/templates/nodedevs.html:82 virtsecrets/templates/secrets.html:32 +#: nodedevs/templates/nodedevs.html:82 storages/templates/storage.html:142 +#: virtsecrets/templates/secrets.html:32 msgid "Used by" msgstr "Kullanan" @@ -8835,7 +8836,7 @@ msgstr "Aramayla eşleşen filtre yok." msgid "Clone filter" msgstr "Filtreyi klonla" -#: nwfilters/templates/nwfilters.html:88 storages/templates/storage.html:181 +#: nwfilters/templates/nwfilters.html:88 storages/templates/storage.html:207 msgid "Name of the copy" msgstr "Kopyanın adı" @@ -9614,16 +9615,32 @@ msgstr "" msgid "Search volumes" msgstr "Birimlerde ara" -#: storages/templates/storage.html:137 +#: storages/templates/storage.html:122 +msgid "Volume use" +msgstr "Disk kullanımı" + +#: storages/templates/storage.html:128 storages/templates/storage.html:156 +msgid "In use" +msgstr "Kullanımda" + +#: storages/templates/storage.html:131 storages/templates/storage.html:157 +msgid "Not used on this host" +msgstr "Bu sunucuda kullanılmıyor" + +#: storages/templates/storage.html:156 +msgid "Another volume is built on it" +msgstr "Başka bir disk bunun üzerine kurulu" + +#: storages/templates/storage.html:163 #, python-format msgid "%(allocated)s allocated" msgstr "%(allocated)s ayrılmış" -#: storages/templates/storage.html:149 +#: storages/templates/storage.html:175 msgid "Download" msgstr "İndir" -#: storages/templates/storage.html:153 +#: storages/templates/storage.html:179 #, python-format msgid "" "Delete volume %(name)s? Its file and data are removed; a volume a VM uses is " @@ -9632,27 +9649,27 @@ msgstr "" "%(name)s birimi silinsin mi? Dosyası ve verisi kaldırılır; bir sanal " "makinenin kullandığı birim silinmez." -#: storages/templates/storage.html:166 +#: storages/templates/storage.html:192 msgid "No volume matches the search." msgstr "Aramayla eşleşen birim yok." -#: storages/templates/storage.html:174 +#: storages/templates/storage.html:200 msgid "Clone image" msgstr "İmaj Klonla" -#: storages/templates/storage.html:187 +#: storages/templates/storage.html:213 msgid "Convert it to another format" msgstr "Başka bir biçime dönüştür" -#: storages/templates/storage.html:192 +#: storages/templates/storage.html:218 msgid "raw" msgstr "raw" -#: storages/templates/storage.html:193 +#: storages/templates/storage.html:219 msgid "qcow2" msgstr "qcow2" -#: storages/templates/storage.html:210 +#: storages/templates/storage.html:236 msgid "This pool has no volumes." msgstr "Bu havuzda birim yok." @@ -11411,7 +11428,7 @@ msgstr "Bağlantı başarısız: %(host)s bağlı değil" msgid "This host has no architecture %(arch)s" msgstr "Bu sunucuda %(arch)s mimarisi yok" -#: vrtManager/connection.py:1265 +#: vrtManager/connection.py:1277 #, python-format msgid "" "Pool %(pool)s is not active: the files the disks of the VMs in it are made " @@ -12530,7 +12547,7 @@ msgstr "" msgid "Enter one element" msgstr "Tek bir öğesi girin" -#: vrtManager/storage.py:124 +#: vrtManager/storage.py:125 #, python-format msgid "" "Device %(device)s already holds data: a partition table, a file system or a " @@ -12541,7 +12558,7 @@ msgstr "" "da bir birim grubu. Doğru cihazsa hostta \"wipefs -a %(device)s\" ile silin " "ve yeniden deneyin." -#: vrtManager/storage.py:221 +#: vrtManager/storage.py:222 #, python-format msgid "" "Pool %(name)s holds disks of the running VMs %(vms)s; shut them down first" @@ -12549,7 +12566,7 @@ msgstr "" "%(name)s havuzu çalışan %(vms)s sanal makinelerinin disklerini tutuyor; önce " "onları kapatın" -#: vrtManager/storage.py:241 +#: vrtManager/storage.py:242 #, python-format msgid "" "VMs %(vms)s have disks in pool %(name)s and would no longer start; detach " @@ -12558,12 +12575,12 @@ msgstr "" "%(vms)s sanal makinelerinin %(name)s havuzunda diskleri var ve artık " "başlamaz; önce bu diskleri ayırın" -#: vrtManager/storage.py:276 +#: vrtManager/storage.py:277 #, python-format msgid "Volume %(name)s is in use on another compute that shares this storage" msgstr "%(name)s birimi bu depolamayı paylaşan başka bir sunucuda kullanılıyor" -#: vrtManager/storage.py:282 +#: vrtManager/storage.py:288 #, python-format msgid "" "Volume %(name)s is in use: a VM's disk, a backing file or a snapshot's file" @@ -12571,7 +12588,7 @@ msgstr "" "%(name)s birimi kullanımda: bir sanal makinenin diski, bir temel (backing) " "dosya ya da bir anlık görüntünün dosyası" -#: vrtManager/storage.py:375 +#: vrtManager/storage.py:381 #, python-format msgid "The running VMs %(vms)s use volume %(name)s; shut them down to copy it" msgstr "" diff --git a/locale/zh/LC_MESSAGES/django.mo b/locale/zh/LC_MESSAGES/django.mo index 6b6cd13d..3308aafa 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 96cfadf9..9b35d2d4 100644 --- a/locale/zh/LC_MESSAGES/django.po +++ b/locale/zh/LC_MESSAGES/django.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-11-20 05:04+0000\n" +"POT-Creation-Date: 2026-11-20 05:17+0000\n" "PO-Revision-Date: \n" "Last-Translator: \n" "Language-Team: \n" @@ -71,7 +71,7 @@ msgstr "无效的密钥" #: instances/templates/create_instance_w2.html:42 #: interfaces/templates/interface.html:119 networks/templates/network.html:145 #: networks/templates/network.html:373 nwfilters/templates/nwfilters.html:29 -#: storages/templates/storage.html:123 virtsecrets/forms.py:34 +#: storages/templates/storage.html:140 virtsecrets/forms.py:34 #: virtsecrets/forms.py:36 vmbackups/forms.py:23 vmbackups/forms.py:36 #: vmbackups/forms.py:82 vmbackups/templates/vmbackups/policies.html:17 #: vmbackups/templates/vmbackups/targets.html:18 @@ -257,7 +257,7 @@ msgstr "仅电源和控制台" #: accounts/templates/account.html:81 computes/templates/computes/list.html:110 #: instances/templates/instance_actions.html:9 -#: storages/templates/storage.html:140 +#: storages/templates/storage.html:166 #, python-format msgid "Actions for %(name)s" msgstr "%(name)s 的操作" @@ -321,7 +321,7 @@ msgstr "您在此处保持登录;您的其他会话将结束。" #: storages/templates/create_stg_block.html:183 #: storages/templates/create_stg_vol_block.html:35 #: storages/templates/create_stg_vol_block.html:68 -#: storages/templates/storage.html:202 templates/base.html:65 +#: storages/templates/storage.html:228 templates/base.html:65 #: templates/common/confirm_delete.html:25 templates/common/form.html:27 #: virtsecrets/templates/create_secret_block.html:48 #: virtsecrets/templates/secrets.html:106 @@ -471,7 +471,7 @@ msgstr "API 令牌 %(name)s 的操作" #: instances/templates/instances/settings_tab.html:315 #: instances/templates/instances/snapshots_tab.html:103 #: instances/templates/instances/snapshots_tab.html:117 -#: networks/templates/network.html:168 storages/templates/storage.html:153 +#: networks/templates/network.html:168 storages/templates/storage.html:179 #: templates/common/confirm_delete.html:5 #: templates/common/confirm_delete.html:9 #: templates/common/confirm_delete.html:26 @@ -1042,7 +1042,7 @@ msgstr "主机" #: networks/templates/network.html:146 networks/templates/network.html:204 #: networks/templates/network.html:286 nwfilters/templates/nwfilter.html:56 #: nwfilters/templates/nwfilter.html:100 nwfilters/templates/nwfilters.html:35 -#: storages/templates/storage.html:126 virtsecrets/templates/secrets.html:33 +#: storages/templates/storage.html:144 virtsecrets/templates/secrets.html:33 msgid "Actions" msgstr "操作" @@ -3230,7 +3230,7 @@ msgstr "连接" #: storages/templates/create_stg_block.html:21 #: storages/templates/create_stg_vol_block.html:16 #: storages/templates/create_stg_vol_block.html:54 -#: storages/templates/storage.html:175 templates/base.html:61 +#: storages/templates/storage.html:201 templates/base.html:61 #: virtsecrets/templates/create_secret_block.html:16 #: virtsecrets/templates/secrets.html:97 msgid "Close" @@ -4052,7 +4052,7 @@ msgstr "存储池" #: instances/templates/add_instance_volume.html:41 #: instances/templates/create_instance_w2.html:46 storages/forms.py:119 -#: storages/templates/storage.html:183 +#: storages/templates/storage.html:209 msgid "Letters, digits, dot, dash and underscore." msgstr "字母、数字、点、短横线和下划线。" @@ -4065,14 +4065,14 @@ msgstr "大小" #: instances/templates/add_instance_volume.html:51 #: instances/templates/instances/edit_instance_volume.html:82 -#: storages/templates/storage.html:124 storages/templates/storage.html:190 +#: storages/templates/storage.html:141 storages/templates/storage.html:216 msgid "Format" msgstr "格式" #: instances/templates/add_instance_volume.html:61 #: instances/templates/create_instance_w2.html:154 #: instances/templates/create_instance_w2.html:220 storages/forms.py:125 -#: storages/forms.py:145 storages/templates/storage.html:198 +#: storages/forms.py:145 storages/templates/storage.html:224 msgid "Preallocate metadata (qcow2)" msgstr "预分配元数据(qcow2)" @@ -4111,7 +4111,7 @@ msgstr "您的部分虚拟机所在的主机当前无法连接。" msgid "VM states" msgstr "虚拟机状态" -#: instances/templates/allinstances.html:48 +#: instances/templates/allinstances.html:48 storages/templates/storage.html:125 msgid "All" msgstr "全部" @@ -4550,7 +4550,7 @@ msgstr "详情" #: instances/templates/instances/settings_tab.html:882 #: instances/templates/instances/settings_tab.html:884 #: nwfilters/templates/nwfilters.html:57 nwfilters/templates/nwfilters.html:94 -#: storages/templates/storage.html:143 storages/templates/storage.html:203 +#: storages/templates/storage.html:169 storages/templates/storage.html:229 msgid "Clone" msgstr "克隆" @@ -4657,7 +4657,7 @@ msgstr "关机" #: instances/templates/instance_actions.html:39 #: interfaces/templates/interface.html:22 networks/templates/network.html:22 #: networks/templates/network.html:162 storages/templates/storage.html:26 -#: storages/templates/storage.html:147 +#: storages/templates/storage.html:173 msgid "More actions" msgstr "更多操作" @@ -5545,7 +5545,7 @@ msgid "The VM has no CD-ROM drive." msgstr "该虚拟机没有 CD-ROM 驱动器。" #: instances/templates/instances/settings_tab.html:217 -#: storages/templates/storage.html:125 +#: storages/templates/storage.html:143 msgid "Capacity" msgstr "容量" @@ -7343,7 +7343,8 @@ msgstr "生成树" #: interfaces/templates/interface.html:81 #: interfaces/templates/interfaces.html:57 nodedevs/templates/nodedevs.html:37 -#: nodedevs/templates/nodedevs.html:82 virtsecrets/templates/secrets.html:32 +#: nodedevs/templates/nodedevs.html:82 storages/templates/storage.html:142 +#: virtsecrets/templates/secrets.html:32 msgid "Used by" msgstr "使用者" @@ -8306,7 +8307,7 @@ msgstr "没有与搜索匹配的过滤器。" msgid "Clone filter" msgstr "克隆过滤器" -#: nwfilters/templates/nwfilters.html:88 storages/templates/storage.html:181 +#: nwfilters/templates/nwfilters.html:88 storages/templates/storage.html:207 msgid "Name of the copy" msgstr "副本名称" @@ -9048,43 +9049,59 @@ msgstr "此存储池已停止:在启动之前无法列出或管理其中的卷 msgid "Search volumes" msgstr "搜索卷" -#: storages/templates/storage.html:137 +#: storages/templates/storage.html:122 +msgid "Volume use" +msgstr "卷使用情况" + +#: storages/templates/storage.html:128 storages/templates/storage.html:156 +msgid "In use" +msgstr "使用中" + +#: storages/templates/storage.html:131 storages/templates/storage.html:157 +msgid "Not used on this host" +msgstr "未在此主机上使用" + +#: storages/templates/storage.html:156 +msgid "Another volume is built on it" +msgstr "另一个卷基于它" + +#: storages/templates/storage.html:163 #, python-format msgid "%(allocated)s allocated" msgstr "已分配 %(allocated)s" -#: storages/templates/storage.html:149 +#: storages/templates/storage.html:175 msgid "Download" msgstr "下载" -#: storages/templates/storage.html:153 +#: storages/templates/storage.html:179 #, python-format msgid "" "Delete volume %(name)s? Its file and data are removed; a volume a VM uses is " "not deleted." msgstr "删除卷 %(name)s?其文件和数据将被删除;虚拟机正在使用的卷不会被删除。" -#: storages/templates/storage.html:166 +#: storages/templates/storage.html:192 msgid "No volume matches the search." msgstr "没有与搜索匹配的卷。" -#: storages/templates/storage.html:174 +#: storages/templates/storage.html:200 msgid "Clone image" msgstr "克隆镜像" -#: storages/templates/storage.html:187 +#: storages/templates/storage.html:213 msgid "Convert it to another format" msgstr "转换为其他格式" -#: storages/templates/storage.html:192 +#: storages/templates/storage.html:218 msgid "raw" msgstr "raw" -#: storages/templates/storage.html:193 +#: storages/templates/storage.html:219 msgid "qcow2" msgstr "qcow2" -#: storages/templates/storage.html:210 +#: storages/templates/storage.html:236 msgid "This pool has no volumes." msgstr "此存储池中没有卷。" @@ -10722,7 +10739,7 @@ msgstr "连接失败:%(host)s 未连接" msgid "This host has no architecture %(arch)s" msgstr "此主机没有 %(arch)s 架构" -#: vrtManager/connection.py:1265 +#: vrtManager/connection.py:1277 #, python-format msgid "" "Pool %(pool)s is not active: the files the disks of the VMs in it are made " @@ -11740,7 +11757,7 @@ msgstr "无法引用过滤器 %(name)s:它就是本过滤器、已被引用或 msgid "Enter one element" msgstr "请输入一个 元素" -#: vrtManager/storage.py:124 +#: vrtManager/storage.py:125 #, python-format msgid "" "Device %(device)s already holds data: a partition table, a file system or a " @@ -11750,31 +11767,31 @@ msgstr "" "设备 %(device)s 上已有数据:分区表、文件系统或卷组。如果确认是正确的设备,请在主机上用 \"wipefs -a %(device)s\" " "清除后重试。" -#: vrtManager/storage.py:221 +#: vrtManager/storage.py:222 #, python-format msgid "" "Pool %(name)s holds disks of the running VMs %(vms)s; shut them down first" msgstr "存储池 %(name)s 中有运行中的虚拟机 %(vms)s 的磁盘;请先关闭它们" -#: vrtManager/storage.py:241 +#: vrtManager/storage.py:242 #, python-format msgid "" "VMs %(vms)s have disks in pool %(name)s and would no longer start; detach " "those disks first" msgstr "虚拟机 %(vms)s 使用存储池 %(name)s 中的磁盘,将无法再启动;请先分离这些磁盘" -#: vrtManager/storage.py:276 +#: vrtManager/storage.py:277 #, python-format msgid "Volume %(name)s is in use on another compute that shares this storage" msgstr "卷 %(name)s 正在被共享此存储的另一台主机使用" -#: vrtManager/storage.py:282 +#: vrtManager/storage.py:288 #, python-format msgid "" "Volume %(name)s is in use: a VM's disk, a backing file or a snapshot's file" msgstr "卷 %(name)s 正在使用中:它是虚拟机的磁盘、后备文件或快照文件" -#: vrtManager/storage.py:375 +#: vrtManager/storage.py:381 #, python-format msgid "The running VMs %(vms)s use volume %(name)s; shut them down to copy it" msgstr "正在运行的虚拟机 %(vms)s 使用卷 %(name)s;请先将其关闭再复制" diff --git a/storages/templates/storage.html b/storages/templates/storage.html index 3f7375eb..1d173822 100644 --- a/storages/templates/storage.html +++ b/storages/templates/storage.html @@ -116,21 +116,47 @@
{% trans "Volumes" %}
+ {% if users_read %} + {# which volumes this host's VMs use: table_filter.js counts each kind the search finds #} + + + {% endif %}
+ {% if users_read %}{% endif %} {% for volume in volumes %} - + + {% if users_read %} + {# a delete still asks the other hosts: one sharing this storage may use the volume #} + + {% endif %} {# capacity: what the guest sees; allocated: what it takes on the storage now #}
{% trans "Name" %} {% trans "Format" %}{% trans "Used by" %}{% trans "Capacity" %} {% trans "Actions" %}
{{ volume.name }} {{ volume.type }} + {% if volume.users %}{{ volume.users|join:", " }} + {% elif volume.users is not None %}{% trans "In use" %} + {% else %}{% trans "Not used on this host" %}{% endif %} +
{{ volume.size|filesizeformat }}
diff --git a/storages/tests/test_pool_page.py b/storages/tests/test_pool_page.py index f3c792f4..7d7d99b7 100644 --- a/storages/tests/test_pool_page.py +++ b/storages/tests/test_pool_page.py @@ -25,7 +25,9 @@ class PoolPageTests(TestCase): self.conn.is_active.return_value = True self.conn.refresh.side_effect = libvirtError("pool 'default' has asynchronous jobs running.") self.conn.get_volumes.return_value = ["base.qcow2"] - self.conn.update_volumes.return_value = [{"name": "base.qcow2", "size": 1, "allocation": 1, "type": "qcow2"}] + self.conn.update_volumes.return_value = [{"name": "base.qcow2", "path": "/p/base.qcow2", "size": 1, "allocation": 1, + "type": "qcow2"}] + self.conn.volume_users.return_value = {} def test_the_page_answers_while_a_volume_is_cloned(self): self.conn.get_size.return_value = (0, 0) # an iSCSI pool without LUNs @@ -113,7 +115,8 @@ class PoolPageTests(TestCase): def test_volumes_are_searched_by_name_and_share_one_clone_dialog(self): self.conn.get_size.return_value = (10, 4) self.conn.update_volumes.return_value = [ - {"name": name, "size": 1, "allocation": 1, "type": "raw"} for name in ("data.img", "install.iso", "Boot.ISO")] + {"name": name, "path": f"/p/{name}", "size": 1, "allocation": 1, "type": "raw"} + for name in ("data.img", "install.iso", "Boot.ISO")] page = html.fromstring(self.client.get(reverse("storage", args=[self.compute.pk, "default"])).content) self.assertEqual(page.xpath("//tbody/tr/@data-search"), ["data.img", "install.iso", "Boot.ISO"]) self.assertEqual(len(page.xpath("//div[contains(concat(' ', @class, ' '), ' modal ')][.//button[@name='cln_volume']]")), 1) @@ -122,6 +125,29 @@ class PoolPageTests(TestCase): self.assertEqual(clone, {"data.img": True, "install.iso": False, "Boot.ISO": False}) self.assertTrue(page.xpath("//div[@id='no-match'][@hidden]")) + def test_each_volume_says_which_vms_use_it(self): + self.conn.get_size.return_value = (10, 4) + self.conn.update_volumes.return_value = [ + {"name": name, "path": f"/p/{name}", "size": 1, "allocation": 1, "type": "raw"} + for name in ("a.img", "b.img", "c.img")] + self.conn.volume_users.return_value = {"/p/a.img": ["vm1", "vm2"], "/p/b.img": []} + page = html.fromstring(self.client.get(reverse("storage", args=[self.compute.pk, "default"])).content) + self.assertEqual([" ".join(t.split()) for t in page.xpath("//tbody/tr/td[3]//text()[normalize-space()]")], + ["vm1, vm2", "In use", "Not used on this host"]) + self.assertEqual(page.xpath("//tbody/tr//@data-state"), ["used", "used", "unused"]) + self.assertEqual(page.xpath("//tbody/tr/@data-search"), ["a.img vm1 vm2", "b.img", "c.img"]) + self.assertEqual(page.xpath("//div[@id='state-pills']/button/@data-pill"), ["", "used", "unused"]) + + def test_volumes_whose_use_cannot_be_read_are_listed(self): + self.conn.get_size.return_value = (10, 4) + self.conn.update_volumes.return_value = [{"name": "a.img", "path": "/p/a.img", "size": 1, "allocation": 1, + "type": "raw"}] + self.conn.volume_users.side_effect = libvirtError("cannot read the domains") + page = html.fromstring(self.client.get(reverse("storage", args=[self.compute.pk, "default"])).content) + self.assertEqual(page.xpath("//tbody/tr/td[1]/text()"), ["a.img"]) + self.assertFalse(page.xpath("//tbody/tr//@data-state")) + self.assertFalse(page.xpath("//div[@id='state-pills']")) + def test_the_heading_offers_what_the_pool_state_allows(self): # an active pool is stopped, a stopped one started or deleted; autostart either way self.conn.get_size.return_value = (10, 4) diff --git a/storages/views.py b/storages/views.py index aee9ba75..19effbe7 100644 --- a/storages/views.py +++ b/storages/views.py @@ -232,8 +232,14 @@ def storage(request, compute_id, pool): # read only for the page: every action above redirects, but a refused new volume # first: it refreshes the pool, and libvirt measures a pool's space only then volumes = conn.update_volumes() if state else None + users = None + if volumes: + # which VMs of this host use each volume; the page lists them without it when it cannot be read + with contextlib.suppress(libvirtError): + users = conn.volume_users() for volume in volumes or []: volume["iso"] = is_iso(volume["name"]) + volume["users"] = users.get(volume["path"]) if users is not None else None try: size, free = conn.get_size() status = conn.get_status() @@ -251,6 +257,7 @@ def storage(request, compute_id, pool): "form": form, "state": state, "volumes": volumes, + "users_read": users is not None, "size": size, "free": free, "used": used, diff --git a/vrtManager/connection.py b/vrtManager/connection.py index cdb104f3..f83ac80d 100644 --- a/vrtManager/connection.py +++ b/vrtManager/connection.py @@ -1220,19 +1220,30 @@ class wvmConnect(object): return sorted(name for name, trees in self.domain_trees(running_only) if any(map(match, trees))) def paths_in_use(self, skip_uuid=None, own=()): - """Paths (names for network disks) a domain uses as a disk or a - backing file of one, in its saved state too, or as a file of its - snapshots (overlays, memory, the disks they were taken on); and the - backing files of volumes. + """The paths of path_users.""" + return set(self.path_users(skip_uuid, own)) + + def path_users(self, skip_uuid=None, own=()): + """{path: names of the domains that use it} for the paths (names for + network disks) a domain uses as a disk or a backing file of one, as + its UEFI variables, in its saved state too, or as a file of its + snapshots (overlays, memory, the disks they were taken on); and, + with no name, the backing files of volumes. skip_uuid leaves out one domain, own the volumes whose backing files do not count. util.InUse when a disk not running has its file in an inactive pool: the files it is made from cannot be read.""" - used, unread = set(), set() + users, unread = {}, set() for dom in self.wvm.listAllDomains(): if dom.UUIDString() == skip_uuid: continue + name = dom.name() + + def use(paths): + for path in paths: + users.setdefault(path, set()).add(name) + live, config = (etree.fromstring(dom.XMLDesc(flags)) for flags in (0, libvirt.VIR_DOMAIN_XML_INACTIVE)) - used.update(self._source_paths(live), self._source_paths(config)) + use(self._source_paths(live) + self._source_paths(config)) # a running disk's definition has its backing chain; the others' volumes have it unread.update(set(UNREAD_DISKS(config)) - (set(UNREAD_DISKS(live)) if dom.isActive() else set())) # a saved state starts with the disks it was saved with, detached since or not @@ -1247,16 +1258,17 @@ class wvmConnect(object): # the image went meanwhile: the VM may have started from it saved = dom.XMLDesc(0) saved = etree.fromstring(saved) - used.update(self._source_paths(saved)) + use(self._source_paths(saved)) unread.update(UNREAD_DISKS(saved)) for snap in dom.listAllSnapshots(0): tree = etree.fromstring(snap.getXMLDesc(0)) - used.update(tree.xpath("disks/disk/source/@file|memory/@file")) + use(tree.xpath("disks/disk/source/@file|disks/disk/source/@dev|disks/disk/source/@name|memory/@file")) for saved in tree.xpath("domain|inactiveDomain"): - used.update(self._source_paths(saved)) + use(self._source_paths(saved)) unread.update(UNREAD_DISKS(saved)) # A stopped domain's XML has no backing chain; the volumes have it. # Any volume backed by a path keeps that path, even an unattached one. + built_on = {} # a backing path: the volumes built on it for pool in self.wvm.listAllStoragePools(): if not pool.isActive(): target = util.get_xml_path(pool.XMLDesc(0), "/pool/target/path") @@ -1271,18 +1283,30 @@ class wvmConnect(object): # only a volume removed meanwhile is skipped: one that cannot # be read may still keep a backing file try: - if vol.path() not in own: - used.update(etree.fromstring(vol.XMLDesc(0)).xpath("./backingStore/path/text()")) + if (top := vol.path()) not in own: + for path in etree.fromstring(vol.XMLDesc(0)).xpath("./backingStore/path/text()"): + users.setdefault(path, set()) + built_on.setdefault(path, []).append(top) except libvirtError as err: if err.get_error_code() != libvirt.VIR_ERR_NO_STORAGE_VOL: raise - return used + # a backing file is used by the domains of the volumes built on it, down the chain + changed = True + while changed: + changed = False + for path, tops in built_on.items(): + names = set().union(*(users.get(top, set()) for top in tops)) - users[path] + if names: + users[path] |= names + changed = True + return users def _source_paths(self, domain): """The files, devices or network names of a domain definition's disks and of their backing chains ("//" reaches a running domain's - backingStore); a pool volume source as its volume's path.""" - paths = [] + backingStore), and of its UEFI variables; a pool volume source as its volume's path.""" + paths = domain.xpath("os/nvram/text()|os/nvram/source/@file|os/nvram/source/@dev|os/nvram/source/@name|" + "os/varstore/@path") for source in domain.xpath("devices/disk//source"): if source.get("pool") and source.get("volume"): try: diff --git a/vrtManager/storage.py b/vrtManager/storage.py index cacd28ba..06fb9c7c 100644 --- a/vrtManager/storage.py +++ b/vrtManager/storage.py @@ -27,7 +27,7 @@ def rbd_source_children(pool): def volume_details(vol): - """A volume's name, capacity (size), allocation and format, from its XML: + """A volume's name, capacity (size), allocation, format and path, from its XML: one libvirt call, which refreshes the volume as info() does. Logical and iSCSI volumes have no format (None).""" def read(doc): @@ -36,6 +36,7 @@ def volume_details(vol): "size": int(util.get_xpath(doc, "/volume/capacity")), "allocation": int(util.get_xpath(doc, "/volume/allocation")), "type": util.get_xpath(doc, "/volume/target/format/@type"), + "path": util.get_xpath(doc, "/volume/target/path"), } return util.get_xml_path(vol.XMLDesc(0), func=read) @@ -275,6 +276,11 @@ class wvmStorage(wvmConnect): if path in elsewhere([path]): raise util.InUse(gettext_noop("Volume %(name)s is in use on another compute that shares this storage"), name=name) + def volume_users(self): + """{path: VM names, sorted} of the paths this host uses (path_users): none for + a backing file only another volume is built on.""" + return {path: sorted(names) for path, names in self.path_users().items()} + def del_volume(self, name): """libvirt deletes any volume; one a VM of this host still needs is refused.""" vol = self.pool.storageVolLookupByName(name) diff --git a/vrtManager/tests/test_host_reads.py b/vrtManager/tests/test_host_reads.py index 5f9175a6..6d4efff0 100644 --- a/vrtManager/tests/test_host_reads.py +++ b/vrtManager/tests/test_host_reads.py @@ -264,7 +264,8 @@ class StoragesInfoTestCase(unittest.TestCase): def volume(name, capacity, allocation, fmt=None, error=None): - target = f"" if fmt else "" + fmt_xml = f"" if fmt else "" + target = f"/p/{name}{fmt_xml}" xml = (f"{name}{capacity}" f"{allocation}{target}") return MagicMock(**{"XMLDesc.side_effect": error} if error else {"XMLDesc.return_value": xml}) @@ -288,8 +289,8 @@ class VolumesTestCase(unittest.TestCase): vols = [volume("b.qcow2", 2048, 512, "qcow2"), volume("a-lv", 1024, 1024)] stg = self.storage(vols) self.assertEqual(stg.update_volumes(), [ - {"name": "a-lv", "size": 1024, "allocation": 1024, "type": None}, # a logical volume has no format - {"name": "b.qcow2", "size": 2048, "allocation": 512, "type": "qcow2"}, + {"name": "a-lv", "size": 1024, "allocation": 1024, "type": None, "path": "/p/a-lv"}, # a logical volume has no format + {"name": "b.qcow2", "size": 2048, "allocation": 512, "type": "qcow2", "path": "/p/b.qcow2"}, ]) self.assertEqual([c[0] for c in stg.pool.mock_calls], ["refresh", "listAllVolumes"]) for vol in vols: @@ -312,7 +313,8 @@ class VolumesTestCase(unittest.TestCase): def test_one_volume(self): stg = self.storage([]) stg.pool.storageVolLookupByName.return_value = volume("a.img", 4096, 0, "raw") - self.assertEqual(stg.get_volume_details("a.img"), {"name": "a.img", "size": 4096, "allocation": 0, "type": "raw"}) + self.assertEqual(stg.get_volume_details("a.img"), {"name": "a.img", "size": 4096, "allocation": 0, "type": "raw", + "path": "/p/a.img"}) def test_the_pool_size_is_one_info_call(self): stg = self.storage([]) diff --git a/vrtManager/tests/test_volume_in_use.py b/vrtManager/tests/test_volume_in_use.py index bff353c7..235edea0 100644 --- a/vrtManager/tests/test_volume_in_use.py +++ b/vrtManager/tests/test_volume_in_use.py @@ -12,9 +12,10 @@ from vrtManager import util from vrtManager.storage import wvmStorage -def domain(uuid, disks=(), snapshots=()): +def domain(uuid, disks=(), snapshots=(), name=None): dom = MagicMock() dom.UUIDString.return_value = uuid + dom.name.return_value = name or uuid dom.hasManagedSaveImage.return_value = 0 devices = "".join(f"" for d in disks) dom.XMLDesc.return_value = f"{devices}" @@ -172,6 +173,40 @@ class PathsInUseTestCase(unittest.TestCase): conn.paths_in_use() +class VolumeUsersTestCase(unittest.TestCase): + def test_the_vms_that_use_each_path(self): + conn, _ = storage( + domains=[domain("u1", ["/pool/vm.now", "/pool/shared.iso"], [SNAPSHOT], name="vm1"), + domain("u2", ["/pool/shared.iso"], name="vm2")], + volumes=[volume("/pool/clone.qcow2", backing="/pool/template.qcow2"), volume("/pool/spare.qcow2")], + ) + # a snapshot's files are its VM's; another volume's backing file is no VM's + self.assertEqual(conn.volume_users(), { + "/pool/vm.now": ["vm1"], "/pool/shared.iso": ["vm1", "vm2"], + "/pool/vm.s": ["vm1"], "/pool/vm.s.mem": ["vm1"], "/pool/vm.qcow2": ["vm1"], "/pool/template.qcow2": [], + }) + + def test_uefi_variables_and_a_snapshots_block_device_are_in_use(self): + dom = domain("u1", ["/pool/vm.qcow2"], ["" + ""]) + dom.XMLDesc.return_value = ("/pool/vm_VARS.fd") + conn, _ = storage(domains=[dom]) + self.assertEqual(conn.paths_in_use(), {"/pool/vm.qcow2", "/pool/vm_VARS.fd", "/dev/vg/vm-snap"}) + dom.XMLDesc.return_value = "" + dom.listAllSnapshots.return_value = [] + self.assertEqual(conn.paths_in_use(), {"/dev/vg/vars"}) + + def test_a_shut_off_vms_base_images_are_its(self): + # its definition names the top volume only; the volumes tell what each is built on + conn, _ = storage(domains=[domain("u1", ["/pool/top.qcow2"], name="vm1")], + volumes=[volume("/pool/top.qcow2", backing="/pool/mid.qcow2"), + volume("/pool/mid.qcow2", backing="/pool/base.qcow2"), + volume("/pool/other.qcow2", backing="/pool/base.qcow2")]) + self.assertEqual(conn.volume_users(), {"/pool/top.qcow2": ["vm1"], "/pool/mid.qcow2": ["vm1"], + "/pool/base.qcow2": ["vm1"]}) + + class DeleteVolumeTestCase(unittest.TestCase): def test_a_volume_in_use_is_refused(self): for case, domains, volumes in (