mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-01-08 21:18:04 +03:00
fsdetails: Show virtio-9p vs virtiofs driver field
Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
parent
d65d31cea2
commit
a7682fc9eb
@ -97,10 +97,19 @@ class vmmFSDetails(vmmGObjectUI):
|
||||
else:
|
||||
simple_store_set("fs-type-combo", [DeviceFilesystem.TYPE_MOUNT])
|
||||
|
||||
simple_store_set("fs-driver-combo",
|
||||
[DeviceFilesystem.DRIVER_LOOP,
|
||||
DeviceFilesystem.DRIVER_NBD,
|
||||
None])
|
||||
if self.conn.is_container_only():
|
||||
simple_store_set("fs-driver-combo",
|
||||
[DeviceFilesystem.DRIVER_LOOP,
|
||||
DeviceFilesystem.DRIVER_NBD,
|
||||
None])
|
||||
else:
|
||||
domcaps = self.vm.get_domain_capabilities()
|
||||
rows = []
|
||||
if domcaps.supports_filesystem_virtiofs():
|
||||
rows.append(["virtiofs", "virtiofs"])
|
||||
rows.append([None, "virtio-9p"])
|
||||
uiutil.build_simple_combo(
|
||||
self.widget("fs-driver-combo"), rows, sort=False)
|
||||
|
||||
simple_store_set("fs-format-combo", ["raw", "qcow2"])
|
||||
self.widget("fs-readonly").set_visible(
|
||||
@ -129,7 +138,7 @@ 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 = is_qemu or fstype == DeviceFilesystem.TYPE_FILE
|
||||
|
||||
if fstype == DeviceFilesystem.TYPE_TEMPLATE:
|
||||
source_text = _("Te_mplate:")
|
||||
@ -213,7 +222,11 @@ class vmmFSDetails(vmmGObjectUI):
|
||||
if _EDIT_FS_READONLY in self._active_edits:
|
||||
dev.readonly = readonly
|
||||
if _EDIT_FS_DRIVER in self._active_edits:
|
||||
origdriver = dev.driver_type
|
||||
dev.driver_type = driver
|
||||
if origdriver == "virtiofs" or driver == "virtiofs":
|
||||
# Need to reset the accessmode for virtiofs
|
||||
dev.accessmode = dev.default_accessmode()
|
||||
if _EDIT_FS_FORMAT in self._active_edits:
|
||||
dev.driver_format = fsformat
|
||||
|
||||
|
@ -127,6 +127,15 @@ class DeviceFilesystem(Device):
|
||||
if self.target:
|
||||
self.validate_target(self.target)
|
||||
|
||||
def default_accessmode(self):
|
||||
if self.driver_type == "virtiofs":
|
||||
# let libvirt fill in default accessmode=passthrough
|
||||
return None
|
||||
# libvirt qemu defaults to accessmode=passthrough, but that
|
||||
# really only works well for qemu running as root, which is
|
||||
# not the common case. so use mode=mapped
|
||||
return self.MODE_MAPPED
|
||||
|
||||
|
||||
##################
|
||||
# Default config #
|
||||
@ -146,11 +155,4 @@ class DeviceFilesystem(Device):
|
||||
self.type = self.TYPE_MOUNT
|
||||
|
||||
if self.accessmode is None:
|
||||
if self.driver_type == "virtiofs":
|
||||
# let libvirt fill in default accessmode=passthrough
|
||||
pass
|
||||
else:
|
||||
# libvirt qemu defaults to accessmode=passthrough, but that
|
||||
# really only works well for qemu running as root, which is
|
||||
# not the common case. so use mode=mapped
|
||||
self.accessmode = self.MODE_MAPPED
|
||||
self.accessmode = self.default_accessmode()
|
||||
|
Loading…
Reference in New Issue
Block a user