Re: [PATCH 07/21] virQEMUBuildCommandLineJSON: Allow skipping certain keys

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

 



On 5/15/20 10:27 AM, Peter Krempa wrote:
Allow reusing this for formatting of netdev_add arguments into -netdev.
We need to be able to skip the 'type' property as it's used without the
prefix.

Not quite true.  In qemu's net/net.c, there is:

QemuOptsList qemu_netdev_opts = {
    .name = "netdev",
    .implied_opt_name = "type",
    .head = QTAILQ_HEAD_INITIALIZER(qemu_netdev_opts.head),
    .desc = {
        /*
         * no elements => accept any params
         * validation will happen later
         */
        { /* end of list */ }
    },

The handling of .implied_opt_name means that the following two commands are identical:

qemu-kvm -netdev user,id=net0
qemu-kvm -netdev type=user,id=net0

So you don't have to specifically handle type= specially. That said, I don't see any problem in adding this special-casing.


Add infrastructure which allows skipping a certainly named property.

Maybe s/certainly/specifically/


Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
  src/util/virqemu.c          | 30 +++++++++++++++++++++---------
  src/util/virqemu.h          | 10 +++++++---
  tests/qemucommandutiltest.c |  2 +-
  3 files changed, 29 insertions(+), 13 deletions(-)
Reviewed-by: Eric Blake <eblake@xxxxxxxxxx>

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




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux