Introduce new domain create APIs to pass pre-opened FDs to LXC

With container based virt, it is useful to be able to pass
pre-opened file descriptors to the container init process.
This allows for containers to be auto-activated from incoming
socket connections, passing the active socket into the container.

To do this, introduce a pair of new APIs, virDomainCreateXMLWithFiles
and virDomainCreateWithFiles, which accept an array of file
descriptors. For the LXC driver, UNIX file descriptor passing
will be used to send them to libvirtd, which will them pass
them down to libvirt_lxc, which will then pass them to the container
init process.

This will only be implemented for LXC right now, but the design
is generic enough it could work with other hypervisors, hence
I suggest adding this to libvirt.so, rather than libvirt-lxc.so

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrange
2013-07-09 17:12:38 +01:00
parent d9301a9ae3
commit d76227bea3
8 changed files with 339 additions and 0 deletions

View File

@@ -1575,6 +1575,11 @@ virConnectPtr virDomainGetConnect (virDomainPtr domain);
virDomainPtr virDomainCreateXML (virConnectPtr conn,
const char *xmlDesc,
unsigned int flags);
virDomainPtr virDomainCreateXMLWithFiles(virConnectPtr conn,
const char *xmlDesc,
unsigned int nfiles,
int *files,
unsigned int flags);
virDomainPtr virDomainLookupByName (virConnectPtr conn,
const char *name);
virDomainPtr virDomainLookupByID (virConnectPtr conn,
@@ -2178,6 +2183,11 @@ int virDomainCreate (virDomainPtr domain);
int virDomainCreateWithFlags (virDomainPtr domain,
unsigned int flags);
int virDomainCreateWithFiles (virDomainPtr domain,
unsigned int nfiles,
int *files,
unsigned int flags);
int virDomainGetAutostart (virDomainPtr domain,
int *autostart);
int virDomainSetAutostart (virDomainPtr domain,