[PATCH] bhyve: implement virtio-9p support

Roman Bogorodskiy bogorodskiy at gmail.com
Tue Oct 13 13:40:28 UTC 2020


  Daniel P. Berrangé wrote:

> On Thu, Oct 08, 2020 at 05:06:16PM +0400, Roman Bogorodskiy wrote:
> > Recently virtio-9p support was added to bhyve.
> > 
> > On the host side it looks this way:
> > 
> >   bhyve .... -s 25:0,virtio-9p,sharename=/path/to/shared/dir
> > 
> > It could also have ",ro" suffix to make share read-only.
> > 
> > In the Linux guest, this share is mounted with:
> > 
> >   mount -t 9p sharename /mnt/sharename
> > 
> > In the guest user will see the same permissions and ownership
> > information for this directory as on the host. No uid/gid remapping is
> > supported, so those could resolve to wrong user or group names.
> > 
> > The same applies to the other side: chowning/chmodding in the guest will
> > set specified ownership and permissions on the host.
> > 
> > In libvirt domain XML it's modeled using the 'filesystem' element:
> > 
> >   <filesystem type='mount'>
> >     <source dir='/path/to/shared/dir'/>
> >     <target dir='sharename'/>
> >   </filesystem>
> 
> 
> > diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-fs-9p-readonly.xml b/tests/bhyvexml2argvdata/bhyvexml2argv-fs-9p-readonly.xml
> > new file mode 100644
> > index 0000000000..6341236654
> > --- /dev/null
> > +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-fs-9p-readonly.xml
> > @@ -0,0 +1,28 @@
> > +<domain type='bhyve'>
> > +  <name>bhyve</name>
> > +  <uuid>df3be7e7-a104-11e3-aeb0-50e5492bd3dc</uuid>
> > +  <memory>219136</memory>
> > +  <vcpu>1</vcpu>
> > +  <os>
> > +    <type>hvm</type>
> > +  </os>
> > +  <devices>
> > +    <disk type='file'>
> > +      <driver name='file' type='raw'/>
> > +      <source file='/tmp/freebsd.img'/>
> > +      <target dev='hda' bus='sata'/>
> > +      <address type='drive' controller='0' bus='0' target='2' unit='0'/>
> > +    </disk>
> > +    <interface type='bridge'>
> > +      <mac address='52:54:00:b9:94:02'/>
> > +      <model type='virtio'/>
> > +      <source bridge="virbr0"/>
> > +      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
> > +    </interface>
> > +    <filesystem>
> 
> This is missing the  type="mount"  attribute which should be mandatory.
> It suggests we're not validating the type in the driver, before accessing
> the <source> element, which is dangerous.
> 
> > +      <source dir='/shared/dir'/>
> > +      <target dir='shared_dir'/>
> > +      <readonly/>
> > +    </filesystem>
> > +  </devices>
> > +</domain>
> 
> The other demo XML files are the same.

Hm, as I can see in the schema, type="mount" is default. That's what I
see in virDomainFSDefParseXML() @ src/conf/domain_conf.c as well.

I also check that in the driver, and there's a test for it:

tests/bhyvexml2argvdata/bhyvexml2argv-fs-9p-unsupported-type.xml

Are you referring to something different?

> Regards,
> Daniel
> -- 
> |: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
> |: https://libvirt.org         -o-            https://fstop138.berrange.com :|
> |: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
> 

Roman Bogorodskiy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20201013/7c6caa9e/attachment-0001.sig>


More information about the libvir-list mailing list