It seems that systemd-run does not start the process in the specified slice when starting a transient scope instead of a service.
I have created a test.slice, and started it:
# systemctl status test.slice ● test.slice - Test slice Loaded: loaded (/usr/lib/systemd/system/test.slice; static; vendor preset: disabled) Active: active since Tue 2016-04-05 16:50:26 EDT; 2min 27s ago Memory: 0B
Apr 05 16:50:26 abrand04 systemd[1]: Created slice Test slice. Apr 05 16:50:26 abrand04 systemd[1]: Starting Test slice.
When running a process using systemd-run,
# systemd-run --scope --slice=test --unit=test sleep 60 & [1] 52359 # Running scope as unit test.scope.
the process is placed in the system.slice (see CGroup) instead of the test.slice as specified in the systemd-run command.
# systemctl status test.scope ● test.scope - /usr/bin/sleep 60 Loaded: loaded (/run/systemd/system/test.scope; static; vendor preset: disabled) Drop-In: /run/systemd/system/test.scope.d └─50-Description.conf Active: active (running) since Tue 2016-04-05 16:56:04 EDT; 11s ago Memory: 92.0K CGroup: /system.slice/test.scope └─52359 /usr/bin/sleep 60
Apr 05 16:56:04 abrand04 systemd[1]: Started /usr/bin/sleep 60. Apr 05 16:56:04 abrand04 systemd[1]: Starting /usr/bin/sleep 60.
CentOS Linux release 7.2.1511 (Core)
systemd 219
Am I doing something wrong here? When starting the process as a service, and not a transient scope, the process is correctly placed in the specified slice.