D-Bus interface to update multiple properties in one shot

Deepak Kodihalli dkodihal at linux.vnet.ibm.com
Fri Sep 7 20:15:54 AEST 2018


Hi,

I've come across openbmc apps that implement D-Bus interfaces comprised 
of more than one D-Bus property (phosphor-networkd is a good example), 
and they need to react only after all the properties or a specific set 
of properties have been set, and not after every individual property is 
set. This can be due to functional or performance reasons. For instance 
in the case of phosphor-networkd, it has to restart a networkd systemd 
unit when a property changes. Multiple restarts can actually cause 
systemd to prevent the unit from further restarts. Multiple restarts is 
also not desirable in terms of the app's performance. What 
phosphor-networkd does today is to start a 5 (or 10) second timer when a 
property is set, and restart the networkd unit after the timeout, so as 
to accumulate other properties being set in this time. I believe other 
daemons are doing this as well.

One solution is to design these APIs as D-Bus methods as opposed to a 
set of D-Bus properties. We've avoided this in general because you'd 
then need to define separate getters and setters, and like mentioned 
earlier, a caller may want to set only a subset of all the properties in 
the interface.

A proposal we discussed in a meet recently is to implement a new 
xyz.openbmc_project.Object.Properties D-Bus interface with a method 
called 'Update', which accepts a dictionary of property-value pairs. A 
D-Bus object may implement this interface to be able to set multiple 
properties in one go. The type of the value would need to be a variant 
of all native D-Bus data types. Supporting container data types is 
probably going to be hard, so this may have to be restricted to 
non-container data types. The key would be a string - the property name. 
Thoughts on this proposal?

Thanks,
Deepak



More information about the openbmc mailing list