Signed-off-by: Lin Ma <lma@xxxxxxxx> --- virtManager/device/fsdetails.py | 18 ++++++++++++++++-- virtinst/devices/filesystem.py | 1 + 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/virtManager/device/fsdetails.py b/virtManager/device/fsdetails.py index c3ecbfab..1650e1b8 100644 --- a/virtManager/device/fsdetails.py +++ b/virtManager/device/fsdetails.py @@ -50,7 +50,7 @@ class vmmFSDetails(vmmGObjectUI): self.builder.connect_signals({ "on_fs_source_browse_clicked": self._browse_fs_source_cb, "on_fs_type_combo_changed": _e(_EDIT_FS_TYPE), - "on_fs_driver_combo_changed": _e(_EDIT_FS_DRIVER), + "on_fs_driver_combo_changed": self._fs_driver_cb, "on_fs_mode_combo_changed": _e(_EDIT_FS_MODE), "on_fs_readonly_toggled": _e(_EDIT_FS_READONLY), "on_fs_format_combo_changed": _e(_EDIT_FS_FORMAT), @@ -107,7 +107,8 @@ class vmmFSDetails(vmmGObjectUI): drivers = [] if self.conn.is_qemu() or self.conn.is_test(): - drivers += [DeviceFilesystem.DRIVER_PATH] + drivers += [DeviceFilesystem.DRIVER_PATH, + DeviceFilesystem.DRIVER_VIRTIOFS] if self.conn.is_lxc() or self.conn.is_test(): drivers += [DeviceFilesystem.DRIVER_LOOP, DeviceFilesystem.DRIVER_NBD, @@ -294,3 +295,16 @@ class vmmFSDetails(vmmGObjectUI): def _browse_fs_source_cb(self, src): self._browse_file(self.widget("fs-source"), isdir=True) + + def _fs_driver_cb(self, src): + fsdriver = uiutil.get_list_selection(src) + if fsdriver == DeviceFilesystem.DRIVER_VIRTIOFS: + uiutil.set_list_selection( + self.widget("fs-mode-combo"), DeviceFilesystem.MODE_PASSTHROUGH) + self.widget("fs-mode-combo").set_sensitive(False) + self.widget("fs-readonly").set_active(False) + self.widget("fs-readonly").set_sensitive(False) + else: + self.widget("fs-mode-combo").set_sensitive(True) + self.widget("fs-readonly").set_sensitive(True) + self._change_cb(_EDIT_FS_DRIVER) diff --git a/virtinst/devices/filesystem.py b/virtinst/devices/filesystem.py index dd588d11..8be34f34 100644 --- a/virtinst/devices/filesystem.py +++ b/virtinst/devices/filesystem.py @@ -25,6 +25,7 @@ class DeviceFilesystem(Device): MODE_SQUASH = "squash" DRIVER_PATH = "path" + DRIVER_VIRTIOFS = "virtiofs" DRIVER_LOOP = "loop" DRIVER_NBD = "nbd" -- 2.26.2