Bug 830135

Summary: libguestfs should support mount-local APIs in RHEL 6 (for OpenStack)
Product: Red Hat Enterprise Linux 6 Reporter: Richard W.M. Jones <rjones>
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.4CC: apevec, leiwang, mbooth, moli, pbrady, qguan, yuzhou
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libguestfs-1.16.31-1.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 830694 (view as bug list) Environment:
Last Closed: 2013-02-21 08:38:16 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 836501    
Bug Blocks: 830694    

Description Richard W.M. Jones 2012-06-08 10:32:29 UTC
Description of problem:

In libguestfs 1.18 we added useful new APIs which expose FUSE,
so that programs don't need to use the external guestmount program
in order to make guest filesystem directories appear mounted
locally.

https://rwmj.wordpress.com/2012/03/29/libguestfs-mount-local/
https://rwmj.wordpress.com/2012/05/14/tip-using-mount-local-api-from-c/
https://github.com/libguestfs/libguestfs/blob/master/examples/mount_local.c

Currently OpenStack uses guestmount directly, but this is
problematic, see eg:

https://www.redhat.com/archives/libguestfs/2012-June/msg00021.html
https://www.redhat.com/archives/libguestfs/2012-June/msg00020.html

These kinds of problems could be solved easily if OpenStack
could use a more recent version of libguestfs which supported
the mount-local API.  However because RHEL 6.3 libguestfs is
version 1.16, it doesn't have this API, effectively preventing
us from contributing such a patch upstream.

Therefore it would make sense for us either to rebase
libguestfs to 1.18, or to backport the 3 mount-local APIs
to libguestfs 1.16, for RHEL 6.4.

Note that Fedora >= 17 has libguestfs 1.18.

Comment 2 Pádraig Brady 2012-06-11 08:45:34 UTC
Note this should only be an issue when nova is _creating_ the authorized_keys file. A workaround would be to create an empty file with appropriate selinux labels in the guest image.

Also guestmount supports passing mount options when using a specific partition,
so if the guest image(s) have a simple layout, a specific partition to inject to can be configured, and in this mode nova could be modified to pass the appropriate options. It's not been tested whether SElinux labels can be updated in this way.

Comment 3 Richard W.M. Jones 2012-06-15 16:43:12 UTC
Bug 832511 would be helped by this.

Comment 5 Mohua Li 2012-11-09 11:36:18 UTC
libguestfs-1.16.32-3.el6

have run some basic test for mount-local api with the following test script(https://github.com/libguestfs/libguestfs/blob/master/examples/mount_local.c), more detail test will be done later, 


[root@station2 tmp]# ./mount_local  disk.img

This is the 'mount-local' demonstration program.  Follow the
instructions on screen.

Creating and formatting the disk image, please wait a moment ...

The _current directory_ is a FUSE filesystem backed by the disk
image which is managed by libguestfs.  Any files or directories
you copy into here (up to 512 MB) will be saved into the disk
image.  You can also delete files, create certain special files
and so on.

When you have finished adding files, hit ^D or exit to exit the
shell and return to the mount-local program.

mount-local-shell> touch mount_local.c
mount-local-shell> touch this_is_mount_local_test
mount-local-shell> exit


[root@station2 tmp]# guestfish -a disk.img -m /dev/sda1 
><fs> ls /
PUT_FILES_AND_DIRECTORIES_HERE
lost+found
mount_local.c
this_is_mount_local_test

Comment 7 errata-xmlrpc 2013-02-21 08:38:16 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2013-0324.html