From: "Michael S. Tsirkin" <mst@redhat.com>
To: Amos Kong <akong@redhat.com>
Cc: qemu-devel@nongnu.org, stefanha@redhat.com
Subject: Re: [Qemu-devel] [PATCH] net: clean up network at qemu process termination
Date: Tue, 11 Dec 2012 16:03:53 +0200 [thread overview]
Message-ID: <20121211140353.GB18083@redhat.com> (raw)
In-Reply-To: <1355233554-28130-1-git-send-email-akong@redhat.com>
On Tue, Dec 11, 2012 at 09:45:54PM +0800, Amos Kong wrote:
> We don't clean up network if fails to parse "-device" parameters without
> calling net_cleanup(). I touch a problem, the tap device which is
> created by qemu-ifup script could not be removed by qemu-ifdown script.
> Some similar problems also exist in vl.c
>
> In this patch, if network initialization successes, a cleanup function
> will be registered to be called at qemu process termination.
>
> Signed-off-by: Amos Kong <akong@redhat.com>
If there are multiple net clients, this still leaves
the problem where one client is initialized,
the second one fails, and we exit without ifdown.
I think registering before net_init_clients
will fix this case but please do test.
> ---
> vl.c | 4 +++-
> 1 files changed, 3 insertions(+), 1 deletions(-)
>
> diff --git a/vl.c b/vl.c
> index a3ab384..842f987 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -3749,6 +3749,9 @@ int main(int argc, char **argv, char **envp)
> exit(1);
> }
>
> + /* clean up network at qemu process termination */
> + atexit(&net_cleanup);
> +
> /* init the bluetooth world */
> if (foreach_device_config(DEV_BT, bt_parse))
> exit(1);
> @@ -3999,7 +4002,6 @@ int main(int argc, char **argv, char **envp)
> main_loop();
> bdrv_close_all();
> pause_all_vcpus();
> - net_cleanup();
> res_free();
>
> return 0;
> --
> 1.7.1
next prev parent reply other threads:[~2012-12-11 14:01 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-11 13:45 [Qemu-devel] [PATCH] net: clean up network at qemu process termination Amos Kong
2012-12-11 14:03 ` Michael S. Tsirkin [this message]
2012-12-11 14:20 ` [Qemu-devel] [PATCH v2] " Amos Kong
2012-12-11 15:07 ` Michael S. Tsirkin
2012-12-18 13:53 ` Stefan Hajnoczi
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=20121211140353.GB18083@redhat.com \
--to=mst@redhat.com \
--cc=akong@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.