qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-block] block/nfs: Fine grained runtime options in nfs


From: Ashijeet Acharya
Subject: Re: [Qemu-block] block/nfs: Fine grained runtime options in nfs
Date: Mon, 17 Oct 2016 23:30:12 +0530

On Fri, Oct 14, 2016 at 9:16 PM, Stefan Hajnoczi <address@hidden> wrote:
> On Mon, Oct 10, 2016 at 10:39:30AM +0530, Ashijeet Acharya wrote:
>> Hi all,
>>
>> I was working on trying to add blockdev-add compatibility for the nfs
>> block driver but before that runtime options need to be separated into
>> various options rather than just a simple "filename" option.
>>
>> I have added the following until now:
>> a) host
>> b) port (not sure about this one, do we just use a default port number?)
>> c) export
>> d) path (path to the file)
>>
>> I have matched these with the URI but still let me know if i have
>> missed anyone :)
>>
>> Now, in order to parse the uri for different runtime options, I have
>> made two new functions nfs_parse_filename() and nfs_parse_uri() which
>> is pretty similar to the way how other network block drivers do it.
>>
>> Currently we parse the uri in a nfs_client_open() function which takes
>> 'const char *filename' as one of its parameters but I dont think
>> that's the right way anymore because we pass 'qemu_opt_get(opts,
>> "filename")' which is invalid due to no runtime option named
>> "filename" available anymore. Right?
>>
>> While parsing uri we check for the query parameters inside a 'for
>> loop', so I have moved that too inside
>>
>> nfs_parse_uri(const char *filename, QDict *options, Error **errp)
>>
>> but the problem is there is no struct NFSClient parameter here, so I
>> cannot fill up its important fields while parsing the query
>> parameters. I cannot do the same inside nfs_client_open() because I no
>> longer parse the uri over there.....OR CAN I? A completely different
>> approach will work too :)
>>
>> I can attach a pastebin link containing a raw patch if you want to get
>> a clear view but I am afraid it doesn't compile at the moment due to
>> the problems mentioned above.
>
> Please post the code and annotate the relevant places where you are
> stuck.

I have solved the issues I was facing earlier (thanks to Max!).
One more relatively easy question though, will we include @port as an
option in runtime_opts while converting NFS to use several
runtime_opts? The reason I ask this because the uri syntax for NFS in
QEMU looks like this:

       nfs://<host>/<export>/<filename>[?param=value[&param2=value2[&...]]]

At the moment my runtime_opts looks like this:

static QemuOptsList runtime_opts = {
    .name = "nfs",
    .head = QTAILQ_HEAD_INITIALIZER(runtime_opts.head),
    .desc = {
        {
            .name = "host",
            .type = QEMU_OPT_STRING,
            .help = "Host to connect to",
        },
        {
            .name = "export",
            .type = QEMU_OPT_STRING,
            .help = "Name of the NFS export to open",
        },
        {
            .name = "path",
            .type = QEMU_OPT_STRING,
            .help = "Path of the image on the host",
        },
        {
            .name = "uid",
            .type = QEMU_OPT_NUMBER,
            .help = "UID value to use when talking to the server",
        },
        {
            .name = "gid",
            .type = QEMU_OPT_NUMBER,
            .help = "GID value to use when talking to the server",
        },
        {
            .name = "tcp-syncnt",
            .type = QEMU_OPT_NUMBER,
            .help = "Number of SYNs to send during the session establish",
        },
        {
            .name = "readahead",
            .type = QEMU_OPT_NUMBER,
            .help = "Set the readahead size in bytes",
        },
        {
            .name = "pagecache",
            .type = QEMU_OPT_NUMBER,
            .help = "Set the pagecache size in bytes",
        },
        {
            .name = "debug",
            .type = QEMU_OPT_NUMBER,
            .help = "Set the NFS debug level (max 2)",
        },
        { /* end of list */ }
    },
};

Any comment on including several query params of the uri in
runtime_opts will be helpful too.

Ashijeet

> Stefan



reply via email to

[Prev in Thread] Current Thread [Next in Thread]