qemu-block
[Top][All Lists]
Advanced

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

Re: [Qemu-block] [Qemu-devel] [PATCH 4/7] qemu-io: add support for --obj


From: Eric Blake
Subject: Re: [Qemu-block] [Qemu-devel] [PATCH 4/7] qemu-io: add support for --object command line arg
Date: Tue, 22 Dec 2015 09:55:17 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0

On 12/22/2015 04:06 AM, Daniel P. Berrange wrote:
> Allow creation of user creatable object types with qemu-io
> via a --object command line arg. This will be used to supply
> passwords and/or encryption keys to the various block driver
> backends via the recently added 'secret' object type.
> 
>  # echo -n letmein > mypasswd.txt
>  # qemu-io --object secret,id=sec0,file=mypasswd.txt \
>       ...other args...

Same comments as on 3/7.

> 
> Signed-off-by: Daniel P. Berrange <address@hidden>
> ---
>  qemu-io.c | 87 
> +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 87 insertions(+)

> @@ -205,6 +207,9 @@ static void usage(const char *name)
>  "Usage: %s [-h] [-V] [-rsnm] [-f FMT] [-c STRING] ... [file]\n"
>  "QEMU Disk exerciser\n"
>  "\n"
> +"  --object OBJECTDEF   define a object such as 'secret' for\n"

s/a object/an object/

> +"                       providing passwords and/or encryption\n"
> +"                       keys\n"

3 lines feels long; you got away with only 2 lines in 3/7 by using
longer line wrapping, while still fitting in the user's 80 column output:

+"  --object type,id=ID,...   define an object such as 'secret' for
providing\n"
+"                            passwords and/or encryption keys\n"


>  
> +enum {
> +    OPTION_OBJECT = 258,
> +};

256 would work. But 258 doesn't hurt.


> +static int object_create(void *opaque, QemuOpts *opts, Error **errp)
> +{
> +    Error *err = NULL;
> +    char *type = NULL;
> +    char *id = NULL;
> +    void *dummy = NULL;
> +    OptsVisitor *ov;
> +    QDict *pdict;
> +
> +    ov = opts_visitor_new(opts);
> +    pdict = qemu_opts_to_qdict(opts, NULL);
> +
> +    visit_start_struct(opts_get_visitor(ov), &dummy, NULL, NULL, 0, &err);

Same comments as on 3/7.

We now have 5 very similar functions (hmp.c, vl.c, and your three
additions); should this be factored into a common reusable function
rather than open-coding it into each client?

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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