diff options
author | Cole Robinson <crobinso@redhat.com> | 2022-02-19 09:23:47 -0500 |
---|---|---|
committer | Cole Robinson <crobinso@redhat.com> | 2022-02-19 10:02:41 -0500 |
commit | d65d31cea28990df9314425dca34e89c42f02fc2 (patch) | |
tree | 08f52ecae9cf3300eb51e76575823a8cf610df5a /virtinst | |
parent | 72b7dcaceb84c784ff808143803c02b85c9a72c6 (diff) | |
download | virt-manager-d65d31cea28990df9314425dca34e89c42f02fc2.tar.gz |
devices: filesystem: Fix default virtiofs accessmode
We shouldn't use accessmode=mapped here, libvirt rejects it.
Let libvirt fill in a working default
Signed-off-by: Cole Robinson <crobinso@redhat.com>
Diffstat (limited to 'virtinst')
-rw-r--r-- | virtinst/devices/filesystem.py | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/virtinst/devices/filesystem.py b/virtinst/devices/filesystem.py index a578a51e..fdf7d41a 100644 --- a/virtinst/devices/filesystem.py +++ b/virtinst/devices/filesystem.py @@ -135,14 +135,22 @@ class DeviceFilesystem(Device): def set_defaults(self, guest): ignore = guest - if self.conn.is_qemu() or self.conn.is_lxc() or self.conn.is_test(): - # type=mount is the libvirt default. But hardcode it - # here since we need it for the accessmode check - if self.type is None: - self.type = self.TYPE_MOUNT - - # 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 - if self.accessmode is None: + if not (self.conn.is_qemu() or + self.conn.is_lxc() or + self.conn.is_test()): + return + + # type=mount is the libvirt default. But hardcode it since other + # bits like validation depend on it + if self.type is None: + 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 |