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

Lennart Poettering lennart at poettering.net
Thu Oct 10 09:46:53 PDT 2013


On Sun, 06.10.13 21:11, Brandon Philips (brandon at ifup.co) wrote:

> 
> On Sun, Oct 6, 2013 at 3:10 PM, Lennart Poettering
> <lennart at poettering.net> 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 at .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.

Hmm, so I thought a bit about the issue. 

If I got this right, then you get the UnitNew, immediately issue a
Get/GetAll, then you get a UnitRemoved, then you get another UnitNew,
and then the response to Get/GetAll, right? If so, it would work to
simply ignore all UnitNew signals between the response and the request,
no?

Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list