[libvirt] [PATCHv2 6/7] lxc: add virProcessRunInMountNamespace

Eric Blake eblake at redhat.com
Fri Jan 10 02:14:13 UTC 2014

On 12/23/2013 10:55 PM, Eric Blake wrote:
> Implement virProcessRunInMountNamespace, which runs callback of type
> virProcessNamespaceCallback in a container namespace.
> Idea by Dan Berrange, based on an initial report by Reco
> <recoverym4n at gmail.com> at
> http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=732394
> Signed-off-by: Eric Blake <eblake at redhat.com>
> ---
> setns() is a per-thread call.  Would it be any simpler to just
> pthread_create() a short-lived helper thread, so that we don't
> have to worry about full-blown async-signal safety, and so that
> the thread can pass more information back rather than the
> limitation of an exit status?

The more I look at the LXC device hotplug, the more I keep coming back
to this question.  Writing async-signal-safe functions whose only way of
communicating back to the parent is through an exit status is tough;
doing the callback as a dedicated thread (since setns() is a per-thread
call, as long as you aren't worried about the pid namespace) seems like
it would be a lot more manageable for having the temporary thread still
take full advantage of libvirt error reporting.  But I'm not sure if
there are any implications I'm overlooking by the idea of using a
dedicated thread.

Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 604 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140109/53737bb2/attachment-0001.sig>

More information about the libvir-list mailing list