[libvirt] [PATCH 1/4] Add APIs for formatting systemd slice/scope names
Richard Weinberger
richard at nod.at
Mon Dec 16 10:56:23 UTC 2013
Am Montag, 16. Dezember 2013, 10:51:01 schrieb Daniel P. Berrange:
> On Sun, Dec 15, 2013 at 07:09:19PM +0100, Richard Weinberger wrote:
> > On Fri, Jul 26, 2013 at 5:48 PM, Daniel P. Berrange <berrange at redhat.com>
wrote:
> > > +char *virSystemdMakeScopeName(const char *name,
> > > + const char *drivername,
> > > + const char *partition)
> > > +{
> > > + virBuffer buf = VIR_BUFFER_INITIALIZER;
> > > +
> > > + if (*partition == '/')
> > > + partition++;
> > > +
> > > + virSystemdEscapeName(&buf, partition);
> > > + virBufferAddChar(&buf, '-');
> > > + virSystemdEscapeName(&buf, drivername);
> > > + virBufferAddLit(&buf, "\\x2d");
> >
> > What is the idea behind this?
> > Now we end up with paths like:
> > /sys/fs/cgroup/memory/machine.slice/machine-lxc\x2dmyfunnycontainer.scope
>
> The string prefix 'machine' is a special systemd string. The second part
> is the libvirt name 'lxc-$containername'. Systemd requires that the '-' be
> escaped hence we use '\x2d' here. You'll see this in a number of other
> systemd unit names too.
Srsly?
I really hoped that this is a libvirt bug and not something by
(systemd-)design. :-\
Thanks,
//richard
More information about the libvir-list
mailing list