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(a)gmail.com> at
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=732394
Signed-off-by: Eric Blake <eblake(a)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