devicefilesystem: Default to accessmode=mapped for qemu
libvirt qemu default's to accessmode=passthrough, which really only works correctly when qemu is run as root, which isn't common for libvirt nowadays. So use accessmode=mapped which has a better chance of working
This commit is contained in:
parent
ccaf749e29
commit
85307b9bd2
|
@ -149,7 +149,7 @@
|
|||
<master startport="4"/>
|
||||
<address type="pci" domain="0" bus="0" slot="4" function="2"/>
|
||||
</controller>
|
||||
<filesystem accessmode="squash">
|
||||
<filesystem type="mount" accessmode="mapped">
|
||||
<source dir="/source"/>
|
||||
<target dir="/target"/>
|
||||
</filesystem>
|
||||
|
@ -157,6 +157,10 @@
|
|||
<source name="template_name"/>
|
||||
<target dir="/"/>
|
||||
</filesystem>
|
||||
<filesystem type="file" accessmode="squash">
|
||||
<source file="/tmp/somefile.img"/>
|
||||
<target dir="/mount/point"/>
|
||||
</filesystem>
|
||||
<interface type="user">
|
||||
<source portgroup="foo"/>
|
||||
<mac address="12:34:56:78:11:22"/>
|
||||
|
|
|
@ -81,7 +81,7 @@
|
|||
<emulator>/usr/bin/qemu-kvm</emulator>
|
||||
<controller type="usb" index="0" model="nec-xhci"/>
|
||||
<controller type="virtio-scsi" index="0"/>
|
||||
<filesystem>
|
||||
<filesystem type="mount" accessmode="mapped">
|
||||
<source dir="/foo/source"/>
|
||||
<target dir="/bar/target"/>
|
||||
</filesystem>
|
||||
|
@ -201,7 +201,7 @@
|
|||
<emulator>/usr/bin/qemu-kvm</emulator>
|
||||
<controller type="usb" index="0" model="nec-xhci"/>
|
||||
<controller type="virtio-scsi" index="0"/>
|
||||
<filesystem>
|
||||
<filesystem type="mount" accessmode="mapped">
|
||||
<source dir="/foo/source"/>
|
||||
<target dir="/bar/target"/>
|
||||
</filesystem>
|
||||
|
|
|
@ -498,8 +498,9 @@ c.add_compare(""" \
|
|||
--hostdev usb_5_20 --hostdev usb_5_21 \
|
||||
\
|
||||
|
||||
--filesystem /source,/target,accessmode=squash \
|
||||
--filesystem /source,/target \
|
||||
--filesystem template_name,/,type=template,mode=passthrough \
|
||||
--filesystem type=file,source=/tmp/somefile.img,target=/mount/point,accessmode=squash \
|
||||
\
|
||||
--soundhw default \
|
||||
--sound ac97 \
|
||||
|
|
|
@ -76,7 +76,7 @@ class VirtualFilesystem(VirtualDevice):
|
|||
# In case of qemu for default fs type (mount) target is not
|
||||
# actually a directory, it is merely a arbitrary string tag
|
||||
# that is exported to the guest as a hint for where to mount
|
||||
if (self.conn.is_qemu() and
|
||||
if ((self.conn.is_qemu() or self.conn.is_test()) and
|
||||
(self.type is None or
|
||||
self.type == self.TYPE_DEFAULT or
|
||||
self.type == self.TYPE_MOUNT)):
|
||||
|
@ -111,5 +111,20 @@ class VirtualFilesystem(VirtualDevice):
|
|||
return setattr(self, self._type_to_source_prop(), val)
|
||||
source = property(_get_source, _set_source)
|
||||
|
||||
def set_defaults(self, guest):
|
||||
ignore = guest
|
||||
|
||||
if self.conn.is_qemu() or self.conn.is_test():
|
||||
# type=mount is the libvirt qemu default. But hardcode it
|
||||
# here since we need it for the accessmode check
|
||||
if self.type is None or self.type == self.TYPE_DEFAULT:
|
||||
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 or self.accessmode == self.MODE_DEFAULT:
|
||||
self.accessmode = self.MODE_MAPPED
|
||||
|
||||
|
||||
VirtualFilesystem.register_type()
|
||||
|
|
Loading…
Reference in New Issue