[libvirt] [PATCH 09/14] qemu: Start PR daemons on domain startup

Peter Krempa pkrempa at redhat.com
Mon Feb 12 17:27:46 UTC 2018


On Mon, Feb 12, 2018 at 17:10:23 +0000, Daniel Berrange wrote:
> On Mon, Feb 12, 2018 at 05:54:19PM +0100, Peter Krempa wrote:
> > On Thu, Jan 18, 2018 at 17:04:41 +0100, Michal Privoznik wrote:
> > > Before we exec() qemu we have to spawn pr-helper processes for
> > > all managed reservations (well, technically there can only one).
> > > The only caveat there is that we should place the process into
> > > the same namespace and cgroup as qemu (so that it shares the same
> > > view of the system). But we can do that only after we've forked.
> > > That means calling the setup function between fork() and exec().
> > > 
> > > Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
> > > ---
> > >  src/qemu/qemu_process.c | 151 ++++++++++++++++++++++++++++++++++++++++++++++++
> > >  1 file changed, 151 insertions(+)
> > > 
> > > diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
> > > index 25ec464d3..02608c1f3 100644
> > > --- a/src/qemu/qemu_process.c
> > > +++ b/src/qemu/qemu_process.c
> > > @@ -2507,6 +2507,151 @@ qemuProcessSetupEmulator(virDomainObjPtr vm)
> > >  }
> > >  
> > >  
> > > +static int
> > > +qemuProcessSetupOnePRDaemonHook(void *opaque)
> > > +{
> > > +    virDomainObjPtr vm = opaque;
> > > +    size_t i, nfds = 0;
> > > +    int *fds = NULL;
> > > +    int ret = -1;
> > > +
> > > +    if (virProcessGetNamespaces(vm->pid, &nfds, &fds) < 0)
> > 
> > If this detects '0' namespaces ...
> > 
> > > +        return ret;
> > > +
> > > +    if (virProcessSetNamespaces(nfds, fds) < 0)
> > 
> > ... this call will be unhappy.
> 
> Namespaces have been around since at least RHEL-5 vintage so I reckon
> we can assume non-zero number of namespaces. In fact perhaps we should
> just make virProcessGetNamespaces() return an explicit error in the
> unlikely case it finds zero namespaces.

Fair enough, but it still does not look like the right usage semantics
in this case.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20180212/162a45f6/attachment-0001.sig>


More information about the libvir-list mailing list