[virt-tools-list] [virt-manager 1/8] fsdetails: Show the 'driver' combo for qemu

Lin Ma lma at suse.com
Wed Jun 30 12:10:59 UTC 2021


Driver combo for qemu was dropped from fsdetails (commit 41023192), Add
it back due to the next patch needs it.

Signed-off-by: Lin Ma <lma at suse.com>
---
 tests/uitests/test_details.py   |  1 +
 virtManager/device/fsdetails.py | 16 +++++++++++-----
 virtinst/devices/filesystem.py  |  2 ++
 3 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/tests/uitests/test_details.py b/tests/uitests/test_details.py
index c8d6fe6c..50b83e5c 100644
--- a/tests/uitests/test_details.py
+++ b/tests/uitests/test_details.py
@@ -576,6 +576,7 @@ def testDetailsEditDevices2(app):
 
     # Filesystem tweaks
     tab = _select_hw(app, win, "Filesystem /target/", "filesystem-tab")
+    tab.combo_select("Driver:", "path")
     tab.find("Source path:", "text").set_text("/frib1")
     tab.find("Target path:", "text").set_text("newtarget")
     tab.find_fuzzy("Export filesystem", "check box").click()
diff --git a/virtManager/device/fsdetails.py b/virtManager/device/fsdetails.py
index 4a8eaf12..c3ecbfab 100644
--- a/virtManager/device/fsdetails.py
+++ b/virtManager/device/fsdetails.py
@@ -101,13 +101,18 @@ class vmmFSDetails(vmmGObjectUI):
 
         simple_store_set("fs-mode-combo",
                 [DeviceFilesystem.MODE_MAPPED,
+                 DeviceFilesystem.MODE_PASSTHROUGH,
                  DeviceFilesystem.MODE_SQUASH,
                  None])
 
-        simple_store_set("fs-driver-combo",
-                [DeviceFilesystem.DRIVER_LOOP,
-                 DeviceFilesystem.DRIVER_NBD,
-                 None])
+        drivers = []
+        if self.conn.is_qemu() or self.conn.is_test():
+            drivers += [DeviceFilesystem.DRIVER_PATH]
+        if self.conn.is_lxc() or self.conn.is_test():
+            drivers += [DeviceFilesystem.DRIVER_LOOP,
+                        DeviceFilesystem.DRIVER_NBD,
+                        None]
+        simple_store_set("fs-driver-combo", drivers)
 
         simple_store_set("fs-format-combo", ["raw", "qcow2"])
         self.widget("fs-readonly").set_visible(
@@ -139,7 +144,8 @@ class vmmFSDetails(vmmGObjectUI):
         uiutil.set_grid_row_visible(
                 self.widget("fs-format-combo"), show_format)
 
-        show_driver_combo = fstype == DeviceFilesystem.TYPE_FILE
+        show_driver_combo = (fstype == DeviceFilesystem.TYPE_FILE or
+                fstype == DeviceFilesystem.TYPE_MOUNT)
         show_mode_combo = (fstype == DeviceFilesystem.TYPE_MOUNT and
                 (self.conn.is_qemu() or self.conn.is_test()))
 
diff --git a/virtinst/devices/filesystem.py b/virtinst/devices/filesystem.py
index 9daf23c4..dd588d11 100644
--- a/virtinst/devices/filesystem.py
+++ b/virtinst/devices/filesystem.py
@@ -19,10 +19,12 @@ class DeviceFilesystem(Device):
     TYPE_FILE = "file"
     TYPE_BLOCK = "block"
     TYPE_RAM = "ram"
+    MODE_PASSTHROUGH = "passthrough"
 
     MODE_MAPPED = "mapped"
     MODE_SQUASH = "squash"
 
+    DRIVER_PATH = "path"
     DRIVER_LOOP = "loop"
     DRIVER_NBD = "nbd"
 
-- 
2.26.2





More information about the virt-tools-list mailing list