Bug 714981
| Summary: | 'list-filesystems' does not know about virtio 9p filesystems or detect existing mounts | ||
|---|---|---|---|
| Product: | [Community] Virtualization Tools | Reporter: | Daniel Berrangé <berrange> |
| Component: | libguestfs | Assignee: | Richard W.M. Jones <rjones> |
| Status: | CLOSED UPSTREAM | QA Contact: | |
| Severity: | unspecified | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | unspecified | CC: | mbooth, moli, virt-maint |
| Target Milestone: | --- | ||
| Target Release: | --- | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | Bug Fix | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2011-06-22 17:01:08 UTC | Type: | --- |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
I found a place in sysfs you can enumerate 9p filesystems. Assuming the 'virtio_9p' module has been loaded, you can iterate reading the 'mount_tag' file from the subdirectories: /sys/bus/virtio/drivers/9pnet_virtio/virtio*/ list-filesystems is a "meta" API call. It is implemented on the library side (not in the daemon) and works by calling out to various daemon functions including list-devices, list-partitions, lvs and vfs-type. http://git.annexia.org/?p=libguestfs.git;a=blob;f=src/listfs.c;hb=HEAD It would therefore make sense to implement another daemon function like "list-9ps" which would return all 9p filesystems (by looking in the /sys directory mentioned above). Then extend list-filesystems to call this. Presumably all 9p filesystems will have the type "9p" so it won't be necessary to call vfs-type on them. Although use of mount_tag (instead of a device) is going to cause no end of confusion throughout the rest of the API ... Patches posted here: https://www.redhat.com/archives/libguestfs/2011-June/msg00122.html These are not complete or tested yet. |
Description of problem: I have launched a QEMU guest with a virtio 9p filesystem -fsdev local,security_model=passthrough,id=fsdev-fs0,path=/home/berrange/export -device virtio-9p-pci,id=fs0,fsdev=fsdev-fs0,mount_tag=my-host-export-fs,bus=pci.0,addr=0x3 This can be mounted as a filesystem inside the guest with mount -t 9p -o trans=virtio my-host-export-fs /mnt I'm not sure how we can enumerate exported 9p filesystems from within the guest, but assuming we can do that, it would be desirable for 'list-filesystems' to display 9p filesystems, and to be able to mount/unmount them as with block devices. Version-Release number of selected component (if applicable): libguestfs-1.10.3-1.fc15.x86_64 (self-built, not Fedora builds) How reproducible: Always Steps to Reproduce: 1. Launch a guest with something like this: domain type='kvm'> <name>firefox</name> <memory>1000000</memory> <os> <type arch='x86_64'>hvm</type> <initrd>/home/berrange/initrd-2.6.35.13-91.fc14.x86_64.img</initrd> <kernel>/boot/vmlinuz-2.6.35.13-91.fc14.x86_64</kernel> <cmdline>console=ttyS0 init=/bin/sh vga=0x318 quiet edd=off</cmdline> </os> <features> <acpi/> </features> <devices> <emulator>/usr/bin/qemu-kvm</emulator> <filesystem> <source dir='/'/> <target dir='org.kernel.root'/> </filesystem> <serial type='pty'> </serial> <input type='tablet' bus='usb'/> <video> <model type='cirrus'/> </video> <graphics type='vnc'/> <channel type='unix'> <source mode='server' path='/tmp/guestfs'/> <target type='virtio' name='org.libguestfs.channel.0'/> </channel> <interface type='user'> <model type='virtio'/> </interface> </devices> </domain> (This custom initrd mounts the exported host FS as the guest's root fs) 2. Spawn guestfsd in the guest 3. In guestfish on host set-attach-method unix:/tmp/guestfs launch list-filesystems ls / Actual results: No 9p filesystems listed libguestfs: error: ls: ls_stub: you must call 'mount' first to mount the root filesystem Expected results: Should list the 9p filesystem, and also detect if any filesystems are already mounted Additional info: