[systemd-devel] [RFC] [PATCH] core: avoid duplicate unit property set
WaLyong Cho
walyong.cho at samsung.com
Mon Dec 8 07:36:02 PST 2014
On 12/09/2014 12:10 AM, Lennart Poettering wrote:
> On Mon, 08.12.14 15:32, WaLyong Cho (walyong.cho at samsung.com) wrote:
>
>> Hi,
>>
>> First, I'd like to ask unit property should be applied immediately when
>> systemctl set-property is called?
>> If yes, after systemctl set-property, why we can see the message for
>> daemon-reload. I think that should be re-loaded automatically.
>> If no, some of unit properties are set immediatly.
>>
>> See below:
>> # systemctl set-property dbus.service CPUShares=1200
>> # systemctl status dbus.service
>> * dbus.service - D-Bus System Message Bus
>> Loaded: loaded (/usr/lib/systemd/system/dbus.service; enabled; vendor
>> preset: disabled)
>> Active: active (running) since Mon 2014-12-08 14:59:12 KST; 1min 30s ago
>> Docs: man:dbus-daemon(1)
>> Main PID: 31 (dbus-daemon)
>> CGroup: /machine.slice/machine-container.scope/system.slice/dbus.service
>> `-31 /usr/bin/dbus-daemon --system --address=systemd:
>> --nofork --nopidfile --systemd-activation
>>
>> Dec 08 14:59:12 container systemd[1]: Starting D-Bus System Message Bus...
>> Dec 08 14:59:12 container systemd[1]: Started D-Bus System Message Bus.
>> Dec 08 14:59:12 container dbus[31]: [system] Successfully activated
>> service 'org.freedesktop.systemd1'
>>
>> Warning: Unit file changed on disk, 'systemctl daemon-reload' recommended.
>>
>> systemctl status saied "systemctl daemon-reload" is needed. It sound
>> something is changed and to apply that daemon-reload is needed.
>> But I can notice that property already applied.
>
> Hmm, yeah, that message shouldn't be shown. Are you sure it was
> triggered by the set-property call though? Maybe it was there already before?
See this log:
[root at container ~]# systemctl status dbus.service
* dbus.service - D-Bus System Message Bus
Loaded: loaded (/usr/lib/systemd/system/dbus.service; enabled; vendor
preset: disabled)
Active: active (running) since Tue 2014-12-09 00:22:50 KST; 10s ago
Docs: man:dbus-daemon(1)
Main PID: 32 (dbus-daemon)
CGroup: /machine.slice/machine-container.scope/system.slice/dbus.service
`-32 /usr/bin/dbus-daemon --system --address=systemd:
--nofork --nopidfile --systemd-activation
Dec 09 00:22:50 container systemd[1]: Starting D-Bus System Message Bus...
Dec 09 00:22:50 container systemd[1]: Started D-Bus System Message Bus.
Dec 09 00:22:50 container dbus[32]: [system] Successfully activated
service 'org.freedesktop.systemd1'
[root at container ~]#
[root at container ~]# systemctl set-property dbus.service CPUShares=777
[root at container ~]#
[root at container ~]# systemctl status dbus.service
* dbus.service - D-Bus System Message Bus
Loaded: loaded (/usr/lib/systemd/system/dbus.service; enabled; vendor
preset: disabled)
Active: active (running) since Tue 2014-12-09 00:22:50 KST; 29s ago
Docs: man:dbus-daemon(1)
Main PID: 32 (dbus-daemon)
CGroup: /machine.slice/machine-container.scope/system.slice/dbus.service
`-32 /usr/bin/dbus-daemon --system --address=systemd:
--nofork --nopidfile --systemd-activation
Dec 09 00:22:50 container systemd[1]: Starting D-Bus System Message Bus...
Dec 09 00:22:50 container systemd[1]: Started D-Bus System Message Bus.
Dec 09 00:22:50 container dbus[32]: [system] Successfully activated
service 'org.freedesktop.systemd1'
Warning: Unit file changed on disk, 'systemctl daemon-reload' recommended.
[root at container ~]#
[root at container ~]# cat
/sys/fs/cgroup/cpu/machine.slice/machine-container.scope/system.slice/dbus.service/cpu.shares
777
set-property is applied immediately well. I will try to prepare patch
for this.
And if the property set should be applied immediately then it seems
there are duplicate property set by unit_load_dropin(). Should we skip
unit_load_dropin() if the unit is transient?
WaLyong
>
> Lennart
>
More information about the systemd-devel
mailing list