mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
Introduce an LXC specific public API & library
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 nfdlist,
int *fdlist,
unsigned int *noldfdlist,
int **oldfdlist,
unsigned int flags);
which provide a way to use the setns() system call to move the
calling process into the container's namespace. It is not
practical to write in a generically applicable manner. The
nearest that we could get to such an API would be an API which
allows to pass a command + argv to be executed inside a
container. Even if we had such a generic API, this LXC specific
API is still useful, because it allows the caller to maintain
the current process context, in particular any I/O streams they
have open.
NB the virDomainLxcEnterNamespace() API is special in that it
runs client side, so does not involve the internal driver API.
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
@@ -33,6 +33,11 @@ qemu_included_files = {
|
||||
"libvirt-qemu.c": "Implementations for the QEMU specific APIs",
|
||||
}
|
||||
|
||||
lxc_included_files = {
|
||||
"libvirt-lxc.h": "header with LXC specific API definitions",
|
||||
"libvirt-lxc.c": "Implementations for the LXC specific APIs",
|
||||
}
|
||||
|
||||
ignored_words = {
|
||||
"ATTRIBUTE_UNUSED": (0, "macro keyword"),
|
||||
"ATTRIBUTE_SENTINEL": (0, "macro keyword"),
|
||||
@@ -1945,6 +1950,8 @@ class docBuilder:
|
||||
self.includes = includes + included_files.keys()
|
||||
elif name == "libvirt-qemu":
|
||||
self.includes = includes + qemu_included_files.keys()
|
||||
elif name == "libvirt-lxc":
|
||||
self.includes = includes + lxc_included_files.keys()
|
||||
self.modules = {}
|
||||
self.headers = {}
|
||||
self.idx = index()
|
||||
@@ -2463,7 +2470,7 @@ class docBuilder:
|
||||
|
||||
|
||||
def rebuild(name):
|
||||
if name not in ["libvirt", "libvirt-qemu"]:
|
||||
if name not in ["libvirt", "libvirt-qemu", "libvirt-lxc"]:
|
||||
self.warning("rebuild() failed, unknown module %s") % name
|
||||
return None
|
||||
builder = None
|
||||
@@ -2506,6 +2513,7 @@ if __name__ == "__main__":
|
||||
else:
|
||||
rebuild("libvirt")
|
||||
rebuild("libvirt-qemu")
|
||||
rebuild("libvirt-lxc")
|
||||
if warnings > 0:
|
||||
sys.exit(2)
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user