From: Kevin Wolf <kwolf@redhat.com>
To: Ashijeet Acharya <ashijeetacharya@gmail.com>
Cc: eblake@redhat.com, pl@kamp.de, jcody@redhat.com,
mreitz@redhat.com, armbru@redhat.com, qemu-devel@nongnu.org,
qemu-block@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v5 1/2] block/nfs: Introduce runtime_opts in NFS
Date: Mon, 31 Oct 2016 12:53:40 +0100 [thread overview]
Message-ID: <20161031115340.GC5522@noname.redhat.com> (raw)
In-Reply-To: <1477674570-25927-2-git-send-email-ashijeetacharya@gmail.com>
Am 28.10.2016 um 19:09 hat Ashijeet Acharya geschrieben:
> Make NFS block driver use various fine grained runtime_opts.
> Set .bdrv_parse_filename() to nfs_parse_filename() and introduce two
> new functions nfs_parse_filename() and nfs_parse_uri() to help parsing
> the URI.
> Add a new option "server" which then accepts a new struct NFSServer.
> "host" is supported as a legacy option and is mapped to its NFSServer
> representation.
This sentence isn't up to date any more and should be removed.
> Signed-off-by: Ashijeet Acharya <ashijeetacharya@gmail.com>
> ---
> block/nfs.c | 430 +++++++++++++++++++++++++++++++++++++++++++++++-------------
> 1 file changed, 337 insertions(+), 93 deletions(-)
> +static void nfs_refresh_filename(BlockDriverState *bs, QDict *options)
> +{
> + NFSClient *client = bs->opaque;
> + QDict *opts = qdict_new();
> + QObject *server_qdict;
> + Visitor *ov;
> +
> + qdict_put(opts, "driver", qstring_from_str("nfs"));
> +
> + snprintf(bs->exact_filename, sizeof(bs->exact_filename),
> + "nfs://%s/%s?uid=%" PRId64 "&gid=%" PRId64 "&tcp-syncnt=%" PRId64
> + "&readahead=%" PRId64 "&pagecache=%" PRId64 "&debug=%" PRId64,
> + client->server->host, client->path, client->uid, client->gid,
> + client->tcp_syncnt, client->readahead, client->pagecache,
> + client->debug);
bs->exact_filename should contain only the parameters that are actually
necessary to identify the image, but not general runtime options. This
is what the comment for bdrv_refresh_filename() says:
* - exact_filename: A filename which may be used for opening a block device
* which (mostly) equals the given BDS (even without any
* other options; so reading and writing must return the same
* results, but caching etc. may be different)
So I believe you can remove most of the query parameters here.
'uid' and 'gid' aren't completely clear, they could possibly be argued
to be part of identifying the image, but we should still omit them if
the defaults were used.
More importantly, the path you're returning doesn't include the
filename! Also, the double slash between host and path doesn't look
perfect:
$ ./qemu-img info nfs://localhost/home/kwolf/images/hd.img
image: nfs://localhost//home/kwolf/images?uid=0&gid=0&tcp-syncnt=0&readahead=0&pagecache=0&debug=0
file format: raw
virtual size: 64M (67108864 bytes)
disk size: 64M
> + ov = qobject_output_visitor_new(&server_qdict);
The visitor is leaked, you're missing a visit_free().
> + visit_type_NFSServer(ov, NULL, &client->server, &error_abort);
> + visit_complete(ov, &client->server);
> + assert(qobject_type(server_qdict) == QTYPE_QDICT);
This even fails an assertion for me, I got the above result only after
fixing this:
$ ./qemu-img info nfs://localhost/home/kwolf/images/hd.img
qemu-img: qapi/qobject-output-visitor.c:206: qobject_output_complete: Assertion `opaque == qov->result' failed.
Abgebrochen (Speicherabzug geschrieben)
The reason is that visit_complete() should get &server_qdict rather than
&client->server.
Kevin
next prev parent reply other threads:[~2016-10-31 11:53 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-28 17:09 [Qemu-devel] [PATCH v5 0/2] allow blockdev-add for NFS Ashijeet Acharya
2016-10-28 17:09 ` [Qemu-devel] [PATCH v5 1/2] block/nfs: Introduce runtime_opts in NFS Ashijeet Acharya
2016-10-31 11:53 ` Kevin Wolf [this message]
2016-10-28 17:09 ` [Qemu-devel] [PATCH v5 2/2] qapi: allow blockdev-add for NFS Ashijeet Acharya
2016-10-28 20:08 ` Eric Blake
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=20161031115340.GC5522@noname.redhat.com \
--to=kwolf@redhat.com \
--cc=armbru@redhat.com \
--cc=ashijeetacharya@gmail.com \
--cc=eblake@redhat.com \
--cc=jcody@redhat.com \
--cc=mreitz@redhat.com \
--cc=pl@kamp.de \
--cc=qemu-block@nongnu.org \
--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 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.