[systemd-devel] [PATCH 3/3] run: introduce timer support option

Lennart Poettering lennart at poettering.net
Tue Oct 28 06:18:49 PDT 2014


On Tue, 28.10.14 21:17, WaLyong Cho (walyong.cho at samsung.com) wrote:

> On 10/28/2014 07:22 PM, Lennart Poettering wrote:
> > On Tue, 28.10.14 12:09, WaLyong Cho (walyong.cho at samsung.com) wrote:
> > 
> >>> The AccuracySec= and WakeSystem= stuff I think we don't need to cover
> >>> with a command line argument of its own, we can cover that with
> >>> --property=.
> >>>
> >> Rework is almost done. Now I'm testing. But the AccuracySec= and
> >> WakeSystem= options are hard to deal with --property= option. Currently
> >> the --property= option of systemd-run is designed for service or scope
> >> unit. If that option is specified then given string is parsed again by
> >> bus_append_unit_property_assignment(). We can AccuracySec=/WakeSystem=
> >> option to there. But we have to split given properties(by --property
> >> option) according to which unit can have that properties.
> > 
> > Hmm, the implied rule here is that we do not intrdouce properties with
> > the same name on different unit types that do not shrae the same
> > signature. That way it really doesn't matter to specify which
> > properties can be parsed for a specific unit type on the client side,
> > since the server side will already know.
> > 
> > Or in other words: go ahead, add this to
> > bus_append_unit_property_assignment(), and the server side will deny
> > what it doesn't like.
> > 
> Honestly, I'd tried. But that was denied by server side. The properties
> of received transient unit are set by bus_unit_set_properties.
> Currently, bus_unit_set_properties return fail for unknown property. See
> this example,

You need to register a callback that parses the timer unit properties
in the timer unit vtable, as field .bus_set_property. See how .service
and .scope units do this.

> 
> systemd-run --on-unit-active=30 --property="AccuracySec=100ms" touch
> /tmp/hello
> 
> On the client side, systemd-run ship the "AccuracySec=100ms" option to
> both timer and service(aux unit) property. Because
> bus_append_unit_property_assignment don't know that is working on which
> kind of unit. Anyway the message is successfully made and sent to
> systemd(server side). There is no problem on parse timer unit
> properties. But when parse aux unit(maybe run-xxx.service),
> bus_unit_set_properties try to parse "AccuracySec=" but it can not. And
> return fail with "Cannot set property AccuracySec, or unknown property."
> 
> I think we have to pass unit type to bus_append_unit_property_assignment
> and only be assigned what be supported by its unit type.

Sure, but that's already in place via the vtable indirection.

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list