From: Paolo Bonzini <pbonzini@redhat.com>
To: Michael Tokarev <mjt@tls.msk.ru>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] qemu-nbd daemonizing?
Date: Sun, 15 Jan 2012 18:43:52 +0100 [thread overview]
Message-ID: <4F131058.4020103@redhat.com> (raw)
In-Reply-To: <4F1304AD.202@msgid.tls.msk.ru>
On 01/15/2012 05:54 PM, Michael Tokarev wrote:
> On 15.01.2012 20:17, Paolo Bonzini wrote:
>> On 01/15/2012 01:59 PM, Michael Tokarev wrote:
>>> On 15.01.2012 14:51, Paolo Bonzini wrote:
>>>> On 01/14/2012 10:26 AM, Michael Tokarev wrote:
>>>>> After looking at the yesterdays issue with non-absolute
>>>>> paths for qemu-nbd arguments and daemon(3), I've a
>>>>> question.
>>>>>
>>>>> Why qemu-nbd daemonizes, and does that only when device
>>>>> argument is given (dropping -v/verbose case for now)?
>>>>>
>>>>> This raises two questions:
>>>>>
>>>>> - shouldn't it do the same daemonizing in case of usual
>>>>> tcp export?
>>>>
>>>> Perhaps yes, but in that case you cannot use "qemu-nbd -d" to
>>>> kill the daemonized process.
>>>
>>> Sorry? qemu-nbd -d will connect to the socket the daemonized
>>> daemon is listening on, the same way as it is done now --
>>> nothing really changes there.
>>
>> No, "qemu-nbd -d" will connect to the /dev/nbdX device and tell
>> thekernel to disconnect. This will terminate the daemon (as long as you
>> didn't use --persistent, at least).
>
> Whatever. In any case qemu-nbd is able to terminate currently
> running daemon, nothing changes with addition daemonizing here
> or without - that was my point.
Not "whatever", and not "in any case". qemu-nbd is able to terminate a
currently running daemon indirectly, by detaching /dev/nbd. The same
cannot be done in the TCP export case (where --persistent is used more
often than not). The point is that qemu-nbd only daemonizes when there
is a simple way to terminate it externally.
Could it have been done better? Yes. Do we have to deal with it? Yes.
>>> The primary question was why -c daemonizes unconditionally.
>>
>> I don't know. But I don't think daemonizing is really a feature,
>> just something historical that we have to deal with.
>
> Aha. So can't it just go away, or be controlled by another
> option, not related to -c ? I think it should be good.
I think it could go away, but I'm quite torn. It does make sense.
Leaving the current historical default "as is", but also allowing
daemonization in the TCP case makes sense too. However, you need to
preserve the way exit statuses are sent for initialization problems,
even where daemonizing.
To fix this you would have to add three options: --pidfile (to terminate
a currently running daemon), --daemonize, --no-daemonize. Honestly, I
don't think it's worth it, but I wouldn't refuse patches and, of course,
improving the documentation would also be a very good idea.
>>> qemu-nbd was runnable on win32 before, so historically it
>>> was exactly the opposite. I asked you because you mentioned
>>> it is linux-only for the first time, but indeed, at that
>>> time it wasn't compilable on win32 already.
>>
>> Fixing it would be good indeed. We can use qemu-thread for that
>> forexample. But it looks like the third commit ever to qemu-nbd.c already
>> made it non-Linux-only. I don't think there ever was a release that
>> supported qemu-nbd on Win32, right?
>
> It is kinda trivial to fix this. But this task becomes
> completely unrealistic if that will involve another
> discussion like we currently have.
I'm pretty sure it shouldn't. This discussion is happening because you
haven't completely read the code, which has more nuances than you think.
Threads, daemonization, error messages, exit statuses, all this
together makes it quite complex.
Paolo
prev parent reply other threads:[~2012-01-15 17:43 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-14 9:26 [Qemu-devel] qemu-nbd daemonizing? Michael Tokarev
2012-01-15 10:51 ` Paolo Bonzini
2012-01-15 12:59 ` Michael Tokarev
2012-01-15 16:17 ` Paolo Bonzini
2012-01-15 16:54 ` Michael Tokarev
2012-01-15 17:43 ` Paolo Bonzini [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4F131058.4020103@redhat.com \
--to=pbonzini@redhat.com \
--cc=mjt@tls.msk.ru \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).