[libvirt] [PATCH 6/9] Introduce an LXC specific public API & library
Daniel P. Berrange
berrange at redhat.com
Mon Jan 14 13:43:41 UTC 2013
On Tue, Jan 08, 2013 at 09:02:37AM -0700, Eric Blake wrote:
> On 12/21/2012 10:08 AM, Daniel P. Berrange wrote:
> > From: "Daniel P. Berrange" <berrange at redhat.com>
> >
> > This patch introduces support for LXC specific public APIs. In
> > common with what was done for QEMU, this creates a libvirt_lxc.so
> > library and libvirt/libvirt-lxc.h header file.
> >
> > The actual APIs are
> >
> > int virDomainLxcOpenNamespace(virDomainPtr domain,
> > int **fdlist,
> > unsigned int flags);
> >
> > int virDomainLxcEnterNamespace(virDomainPtr domain,
> > unsigned int flags);
>
> This commit message signature...
Opps, that was from a work-in-progress version of the patch.
> > +++ b/src/driver.h
> > @@ -915,6 +915,11 @@ typedef int
> > unsigned long long minimum,
> > unsigned int flags);
> >
> > +typedef int
> > + (*virDrvDomainLxcOpenNamespace)(virDomainPtr dom,
> > + int **fdlist,
> > + unsigned int flags);
> > +
> > /**
> > * _virDriver:
> > *
> > @@ -1107,6 +1112,7 @@ struct _virDriver {
> > virDrvNodeGetCPUMap nodeGetCPUMap;
> > virDrvDomainFSTrim domainFSTrim;
> > virDrvDomainSendProcessSignal domainSendProcessSignal;
> > + virDrvDomainLxcOpenNamespace domainLxcOpenNamespace;
>
> No EnterNamespace driver callback?
The 'virDomainLxcEnterNamespace' API is special in that it is rnu
purely client-side, not in the daemon. It is pretty much just a
dumb wrapper around 'setns()' and 'readdir(/proc/self/ns)' to avoid
apps having to know about those low level impl details.
> > +++ b/src/lxc/lxc_driver.c
> > @@ -4544,6 +4544,7 @@ static virDriver lxcDriver = {
> > .domainShutdown = lxcDomainShutdown, /* 1.0.1 */
> > .domainShutdownFlags = lxcDomainShutdownFlags, /* 1.0.1 */
> > .domainReboot = lxcDomainReboot, /* 1.0.1 */
> > + .domainLxcOpenNamespace = lxcDomainOpenNamespace, /* 1.0.2 */
>
> Again, no EnterNamespace callback registration?
Same note as above - the driver API isn't used for this code since
it is client side.
> ACK with those issues fixed. It made it nice that we already have
> libvirt-qemu to copy from.
Indeed, it would have taken me ages to get this right without copying
from libvirt-qemu :-)
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
More information about the libvir-list
mailing list