diff --git a/locale/tr/LC_MESSAGES/django.mo b/locale/tr/LC_MESSAGES/django.mo index b12db0f4..53f0a165 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 66c65c9f..432e2e11 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-13 07:26+0000\n" +"POT-Creation-Date: 2026-11-13 07:27+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" @@ -8620,6 +8620,10 @@ msgstr "Havuz" msgid "Degraded" msgstr "Bozulmuş" +#: storages/templates/storage.html:94 +msgid "Inaccessible" +msgstr "Erişilemiyor" + #: storages/templates/storage.html:112 msgid "" "This pool is stopped: its volumes cannot be listed or managed until it is " @@ -10280,7 +10284,7 @@ msgstr "" msgid "Enter one element" msgstr "Tek bir öğesi girin" -#: vrtManager/storage.py:213 +#: vrtManager/storage.py:214 #, python-format msgid "" "Pool %(name)s holds disks of the running VMs %(vms)s; shut them down first" @@ -10288,16 +10292,16 @@ msgstr "" "%(name)s havuzu çalışan %(vms)s sanal makinelerinin disklerini tutuyor; önce " "onları kapatın" -#: vrtManager/storage.py:221 +#: vrtManager/storage.py:231 #, python-format msgid "" -"VMs %(vms)s have disks in pool %(name)s by its name and would no longer " -"start; detach those disks first" +"VMs %(vms)s have disks in pool %(name)s and would no longer start; detach " +"those disks first" msgstr "" -"%(vms)s sanal makinelerinin %(name)s havuzunda adıyla bağlı diskleri var ve " -"artık başlamaz; önce bu diskleri ayırın" +"%(vms)s sanal makinelerinin %(name)s havuzunda diskleri var ve artık " +"başlamaz; önce bu diskleri ayırın" -#: vrtManager/storage.py:253 +#: vrtManager/storage.py:263 #, python-format msgid "" "Volume %(name)s is in use: a VM's disk, a backing file or a snapshot's file" @@ -10305,7 +10309,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:346 +#: vrtManager/storage.py:356 #, 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 9c533f69..fe172bd3 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 5de6f047..74187545 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-13 07:26+0000\n" +"POT-Creation-Date: 2026-11-13 07:27+0000\n" "PO-Revision-Date: \n" "Last-Translator: \n" "Language-Team: \n" @@ -8147,6 +8147,10 @@ msgstr "存储池" msgid "Degraded" msgstr "降级" +#: storages/templates/storage.html:94 +msgid "Inaccessible" +msgstr "无法访问" + #: storages/templates/storage.html:112 msgid "" "This pool is stopped: its volumes cannot be listed or managed until it is " @@ -9675,26 +9679,26 @@ msgstr "无法引用过滤器 %(name)s:它就是本过滤器、已被引用或 msgid "Enter one element" msgstr "请输入一个 元素" -#: vrtManager/storage.py:213 +#: vrtManager/storage.py:214 #, 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:221 +#: vrtManager/storage.py:231 #, python-format msgid "" -"VMs %(vms)s have disks in pool %(name)s by its name and would no longer " -"start; detach those disks first" -msgstr "虚拟机 %(vms)s 通过名称使用存储池 %(name)s 中的磁盘,将无法再启动;请先分离这些磁盘" +"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:253 +#: vrtManager/storage.py:263 #, 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:346 +#: vrtManager/storage.py:356 #, 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 3e713c1b..32816313 100644 --- a/storages/templates/storage.html +++ b/storages/templates/storage.html @@ -91,7 +91,7 @@ {% trans "State" %} {% if state %}{% trans "Active" %}{% else %}{% trans "Stopped" %}{% endif %} - {% if status == "Running degraded" %}{% trans "Degraded" %}{% endif %} + {% if status == "Running degraded" %}{% trans "Degraded" %}{% elif status == "Inaccessible" %}{% trans "Inaccessible" %}{% endif %} {% if autostart %}{% trans "Autostart" %}{% endif %} diff --git a/storages/tests/test_pool_in_use.py b/storages/tests/test_pool_in_use.py index 28e341d2..f0a04c2a 100644 --- a/storages/tests/test_pool_in_use.py +++ b/storages/tests/test_pool_in_use.py @@ -1,7 +1,8 @@ """A pool a VM needs is not stopped or deleted: stopping one that holds a running VM's disk would take that disk away, deleting one a VM's definition names (a disk of type volume) would keep that VM from starting. A disk given -by its file path keeps working without the pool's definition. Runs on a +by its file path keeps working without a directory pool's definition, not +without a share's, which mounts it. Runs on a private libvirt test driver: "test:///default" is shared by the whole process.""" import tempfile @@ -75,3 +76,43 @@ class PoolInUseTests(TestCase): self.conn.lookupByName("by-name").undefine() self.post("delete") self.assertNotIn("use-pool", self.conn.listDefinedStoragePools()) + + def test_a_share_a_vm_disk_path_is_in_is_not_deleted(self): + # undefined, the share is not mounted at the next boot: the path is gone + self.conn.storagePoolDefineXML( + "share" + "/mnt/share", 0) + self.conn.defineXML(domain("on-share", "type='file'>")) + self.conn.defineXML(domain("beside", "type='file'>")) + url = reverse("storage", args=[self.compute.id, "share"]) + response = self.client.post(url, {"delete": ""}) + messages = [str(m) for m in get_messages(response.wsgi_request)] + self.assertEqual(messages, ["VMs on-share have disks in pool share and would no longer start; detach those disks first"]) + self.conn.lookupByName("on-share").undefine() + self.client.post(url, {"delete": ""}) + self.assertNotIn("share", self.conn.listDefinedStoragePools()) + + def test_an_lvm_pool_counts_its_device_mapper_names_and_iscsi_pools_do_not_share_their_directory(self): + self.conn.storagePoolDefineXML( + "lvmvg-data" + "/dev/vg-data", 0) + self.conn.storagePoolDefineXML( + "lun" + "/dev/disk/by-path", 0) + self.conn.defineXML(domain("on-lv", "type='block'>")) + # another iSCSI pool's LUN: every iSCSI pool's target is /dev/disk/by-path + self.conn.defineXML(domain("other-lun", "type='block'>")) + self.client.post(reverse("storage", args=[self.compute.id, "lvm"]), {"delete": ""}) + self.client.post(reverse("storage", args=[self.compute.id, "lun"]), {"delete": ""}) + self.assertIn("lvm", self.conn.listDefinedStoragePools()) + self.assertNotIn("lun", self.conn.listDefinedStoragePools()) + + def test_an_inaccessible_pool_has_its_state(self): + # libvirt's state 4: running, but its storage cannot be reached + from vrtManager.storage import wvmStorage + + storage = wvmStorage.__new__(wvmStorage) + for state, status in ((2, "Running normally"), (4, "Inaccessible"), (9, "Unknown")): + with self.subTest(state=state): + storage.pool = type("Pool", (), {"info": lambda self, state=state: [state, 0, 0, 0]})() + self.assertEqual(storage.get_status(), status) diff --git a/vrtManager/storage.py b/vrtManager/storage.py index 4b6b44ca..6002a7e6 100644 --- a/vrtManager/storage.py +++ b/vrtManager/storage.py @@ -168,10 +168,11 @@ class wvmStorage(wvmConnect): "Initializing pool, not available", "Running normally", "Running degraded", + "Inaccessible", # running, but its storage cannot be reached: a share whose server is gone ] try: return status[self.pool.info()[0]] - except ValueError: + except IndexError: # a state newer than these return "Unknown" def get_size(self): @@ -215,10 +216,22 @@ class wvmStorage(wvmConnect): def delete(self): """Refused while a VM's definition names it for a disk: that VM would - no longer start. A disk given by its file path does not need it.""" - name = self.pool.name() - if vms := self.domains_using(lambda domain: domain.xpath("devices/disk/source[@pool=$name]", name=name)): - raise util.OperationError(gettext_noop("VMs %(vms)s have disks in pool %(name)s by its name and would no longer start; detach those disks first"), vms=', '.join(vms), name=name) + no longer start. So is a disk given by its path in a pool that mounts + or activates its storage (a share, a file system, an LVM group): the + path is gone with the pool. A directory pool's files stay; the device + directories of iSCSI and disk pools are every pool's, not this one's.""" + name, kind = self.pool.name(), self.get_type() + target = (self.get_target_path() or "").rstrip("/") + under = (target + "/",) if kind in ("fs", "netfs", "logical") and target else () + if kind == "logical" and (group := self.get_source_name()): + under += ("/dev/mapper/" + group.replace("-", "--") + "-",) # device mapper's name of its volumes + + def needs(domain): + return domain.xpath("devices/disk/source[@pool=$name]", name=name) or any( + path.startswith(under) for path in domain.xpath("devices/disk//source/@file | devices/disk//source/@dev")) + + if vms := self.domains_using(needs): + raise util.OperationError(gettext_noop("VMs %(vms)s have disks in pool %(name)s and would no longer start; detach those disks first"), vms=', '.join(vms), name=name) self.pool.undefine() def get_autostart(self):