qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] block: Error out on image creation with conflicting size opt


From: Eric Blake
Subject: Re: [PATCH] block: Error out on image creation with conflicting size options
Date: Tue, 26 Nov 2019 10:39:14 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.1

On 11/26/19 10:26 AM, Kevin Wolf wrote:

Actually, your patch fails to diagnose:

$ qemu-img create -o size=1m,size=2m -f qcow2 x.qcow2
Formatting 'x.qcow2', fmt=qcow2 size=2097152 cluster_size=65536
lazy_refcounts=off refcount_bits=16

so you may want to enhance this patch to also catch the case of -o size used
more than once.

Hm... Isn't this something that QemuOpts should already catch? Or do we
have callers that actually expect the same option specified multiple
times?

QemuOpts is horrible. It allows duplication, and leaves it up to the client what to do about it. Some clients use the duplication to collect multiple arguments (such as specifying more than one cpu), some callers treat duplication by honoring only the FIRST option specified (and ignoring later uses - I find this ugly), and yet other callers treat duplication by honoring only the LAST option specified.


Somehow I'm almost sure that Markus will know an example...

Probably of all three (ab)uses of QemuOpt duplication.


But anyway, I figure the same problem exists for almost all options.

Kevin


--
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org




reply via email to

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