On 30.12.21 17:12, Vladimir Sementsov-Ogievskiy wrote:
22.12.2021 14:41, Hanna Reitz wrote:
This option does basically the same as --fork does for qemu-nbd:

Can we share the code?

Before this patch we already have --fork code-path of qemu-nbd and -daemonize code-path of QEMU.. Now we have one more. Did you consider improving and sharing the old code instead?

I didn’t really, to be honest.  I disliked sharing code with qemu-nbd, because, well, that would mean touching qemu-nbd (which I’d rather avoid).  Then again, I suppose we could theoretically just drop the daemonizing code from qemu-nbd, and replace it by calls to daemonize() and daemon_detach().  The only problem with that would be that we need some file into which to put it, that is linked into both qemu-nbd and the QSD.

QEMU proper already has os_daemonize() and os_setup_post(), but they’re quite different from what qemu-nbd does, for example, it doesn’t call qemu_daemon(), and it chdir()s to / (which we probably don’t want?).

I preferred to go with what qemu-nbd does, because I thought if it works for qemu-nbd, it should work for QSD, too.  Maybe I’m wrong, though, maybe we should just use os_daemonize() and os_setup_post().

Hanna


Reply via email to