On 03/02/2017 10:56, Richard W.M. Jones wrote: > On Fri, Feb 03, 2017 at 09:31:43AM -0800, Paolo Bonzini wrote: >> >> >> On 03/02/2017 09:09, Richard W.M. Jones wrote: >>> + const char *port, >>> + bool fork_process) >>> +{ >>> + if (device != NULL) { >>> + return "NBD device can't be set when using socket activation"; >>> + } >>> + >>> + if (sockpath != NULL) { >>> + return "Unix socket can't be set when using socket activation"; >>> + } >>> + >>> + if (address != NULL) { >>> + return "The interface can't be set when using socket activation"; >>> + } >>> + >>> + if (port != NULL) { >>> + return "TCP port number can't be set when using socket activation"; >>> + } >>> + >>> + if (fork_process) { >>> + return "Fork (--fork) can't be used with socket activation"; >>> + } >> >> Why not? You could have a Type=forking foo.service, which makes little >> sense but would work. > > The answer, I think, is because systemd will lose track of the PID of > the qemu-nbd process. This would be important because systemd can > kill a socket-activated service which is idle. > > Normally you would work around that by using PIDFile=... in the unit > file, but it looks like qemu-nbd doesn't support pid files.
PIDFile is recommended indeed but GuessMainPID=yes (the default for no PIDFile) should work, since qemu-nbd only has one parent process. Paolo