Re: [PATCH 1/4] Add APIs for formatting systemd slice/scope names

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx> 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.

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 :|

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]