qemu-config: use qemu_opts_from_qdict
authorPaolo Bonzini <pbonzini@redhat.com>
Wed, 9 Jun 2021 12:34:35 +0000 (14:34 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 15 Jun 2021 15:17:09 +0000 (17:17 +0200)
commite7d85d955a7a3405934a104f35228aae1d338a6d
tree1f37c371276ecc0ea1f6dd4e5b3cf1fd9ebb57f2
parent38f71349c7c4969bc14da4da1c70b8cc4078d596
qemu-config: use qemu_opts_from_qdict

Using qemu_opts_absorb_qdict, and then checking for any leftover options,
is redundant because there is already a function that does the same,
qemu_opts_from_qdict.  qemu_opts_from_qdict consumes the whole dictionary
and therefore can just return an error message if an option fails to validate.

This also fixes a bug, because the "id" entry was retrieved in
qemu_config_do_parse and then left there by qemu_opts_absorb_qdict.
As a result, it was reported as an unrecognized option.

Reported-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Fixes: 3770141139 ("qemu-config: parse configuration files to a QDict")
Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
util/qemu-config.c