The Wednesday 24 Sep 2014 à 16:46:29 (+0200), Kevin Wolf wrote : > While thinking about precedence of conflicting block device options from > different sources, I noticed that you can specify both an option and its > legacy alias at the same time (e.g. readonly=on,read-only=off). Rather > than specifying the order of precedence, we should simply forbid such > combinations. > > Signed-off-by: Kevin Wolf <kw...@redhat.com> > --- > blockdev.c | 16 ++++++++++++++-- > tests/qemu-iotests/051 | 23 +++++++++++++++++++++++ > tests/qemu-iotests/051.out | 45 +++++++++++++++++++++++++++++++++++++++++++++ > 3 files changed, 82 insertions(+), 2 deletions(-) > > diff --git a/blockdev.c b/blockdev.c > index 6a33fd2..7adecae 100644 > --- a/blockdev.c > +++ b/blockdev.c > @@ -532,12 +532,18 @@ err_no_opts: > return NULL; > } > > -static void qemu_opt_rename(QemuOpts *opts, const char *from, const char *to) > +static void qemu_opt_rename(QemuOpts *opts, const char *from, const char *to, > + Error **errp) > { > const char *value; > > value = qemu_opt_get(opts, from); > if (value) { > + if (qemu_opt_find(opts, to)) { > + error_setg(errp, "'%s' and its alias '%s' can't be used at the "
Maybe specify we are talking about options in the error message so the user is provided with a bit of context about what's happening. > + error_setg(errp, "the option '%s' and its alias '%s' can't be > used at the " > + "same time", to, from); > + return; > + } Anyway: Reviewed-by: Benoît Canet <benoit.ca...@nodalink.com>