Re: [systemd-devel] dbus API for unit state change?

2013-10-06 Thread Brandon Philips
On Sun, Oct 6, 2013 at 3:10 PM, Lennart Poettering
 wrote:
> So, yeah, if you respond to each UnitNew signal you get with a property
> Get/GetAll call, then this will result in endless ping pong, which is
> certainly not a good idea.
>
> What are you trying to do? Write some tool that tracks all units that
> are loaded?

Yes, I want to register services into a networked service registry. An
example use case would be an HTTP load balancer that is service
registry aware and adds machines to the load balancer based on certain
unit files appearing/leaving.

An alternative solution is making a user explicitly add a
service-registry-notifier@.service to my-application.service.wants but
I wanted to avoid making registration a special case. For example:
https://gist.github.com/philips/6710008

Maybe there is a middle ground solution? Does it makes sense to send
LoadState with UnitNew? I will have to look tomorrow because I think
without that trying to do other things gets racy with transient units.

Thanks,

Brandon
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH 2/2] Run with a custom SMACK domain (label).

2013-10-06 Thread Zbigniew Jędrzejewski-Szmek
On Wed, Oct 02, 2013 at 11:12:09AM -0700, Auke Kok wrote:
> Allows the systemd --system process to change its current
> SMACK label to a predefined custom label (usually "system")
> at boot time.
> 
> This is needed to have a few system-generated folders and
> sockets automatically be created with the right SMACK
> label. Without that, processes either cannot communicate with
> systemd or systemd fails to perform some actions.
> ---
Hi,
the patches look OK. I dont' have a system with smack support at hand,
but I tested them on Fedora, and didn't notice any adverse effects.
I you've tested them with smack, then they should be applied, imo.

Zbyszek
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] dbus API for unit state change?

2013-10-06 Thread Lennart Poettering
On Fri, 04.10.13 17:19, Brandon Philips (bran...@ifup.co) wrote:

> 
> Another dbus question:
> 
> Is it expected that a UnitNew and UnitRemove are sent when I use
> org.freedesktop.DBus.Properties.Get or GetAll? This also happens with
> `systemctl status doesnt-exist.service`

Yupp it kinda is.

The logic behing this is that systemd minimizes the unit file
descriptions it has loaded into memory. Basically, unit files are
unloaded if they are not active and if no other unit that is loaded
references them. Each time something is loaded or unloaded you get a
UnitNew or UnitRemoved signal, to keep you updated what is currently in
memory. Any unit request will implicitly load the units referenced by
it, in order to make this scheme race-free for the client.

> Here is an example of what I am seeing:
> https://gist.github.com/philips/6834913/raw/5bd36998829ca44c25c3798afd3c77c147b1ba27/gistfile1.txt
> 
> This isn't very nice because I need to explicitly guard against
> getting into an infinite loop of looking up properties on non-existent
> units.

So, yeah, if you respond to each UnitNew signal you get with a property
Get/GetAll call, then this will result in endless ping pong, which is
certainly not a good idea.

What are you trying to do? Write some tool that tracks all units that
are loaded?

Lennart

-- 
Lennart Poettering - Red Hat, Inc.
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel