From f94124c8917328ad9e3c22bf4a699de712879534 Mon Sep 17 00:00:00 2001 From: catborise Date: Sun, 8 Nov 2026 14:40:26 +0300 Subject: [PATCH] fix(vrtManager): an ISO put in a host CD-ROM drive is read A CD-ROM of type block (a host drive) kept its type when an ISO was inserted, and libvirt reads only source/@dev for that type, so the drive stayed empty. Inserting an ISO now makes it a file drive. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Kk4h2TcUiaWmU5MUszYSea --- vrtManager/instance.py | 1 + vrtManager/tests/test_iso_media.py | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/vrtManager/instance.py b/vrtManager/instance.py index 771ec7e8..67be0836 100644 --- a/vrtManager/instance.py +++ b/vrtManager/instance.py @@ -1139,6 +1139,7 @@ class wvmInstance(wvmConnect): for source in disk.findall("source"): disk.remove(source) if path: + disk.set("type", "file") # a host drive (type block) reads source/@dev only disk.insert(1, etree.Element("source", file=path)) try: self.instance.updateDeviceFlags(etree.tostring(disk).decode(), affect) diff --git a/vrtManager/tests/test_iso_media.py b/vrtManager/tests/test_iso_media.py index 1bd8bed7..34179215 100644 --- a/vrtManager/tests/test_iso_media.py +++ b/vrtManager/tests/test_iso_media.py @@ -45,6 +45,13 @@ class IsoMediaTestCase(unittest.TestCase): self.updates(inst), [("sdb", "", VIR_DOMAIN_AFFECT_LIVE), ("sdb", "", VIR_DOMAIN_AFFECT_CONFIG)] ) + def test_an_iso_in_a_host_drive_makes_it_a_file_drive(self): + inst = vm(active=False) + inst._XMLDesc = MagicMock(return_value=DOMAIN.replace("