Skip to content
Snippets Groups Projects
  1. Aug 21, 2020
  2. Jul 13, 2020
  3. Jul 10, 2020
    • Markus Armbruster's avatar
      qapi: Smooth another visitor error checking pattern · b11a093c
      Markus Armbruster authored
      
      Convert
      
          visit_type_FOO(v, ..., &ptr, &err);
          ...
          if (err) {
              ...
          }
      
      to
      
          visit_type_FOO(v, ..., &ptr, errp);
          ...
          if (!ptr) {
              ...
          }
      
      for functions that set @ptr to non-null / null on success / error.
      
      Eliminate error_propagate() that are now unnecessary.  Delete @err
      that are now unused.
      
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: default avatarEric Blake <eblake@redhat.com>
      Message-Id: <20200707160613.848843-40-armbru@redhat.com>
      b11a093c
    • Markus Armbruster's avatar
      qapi: Use returned bool to check for failure, Coccinelle part · 62a35aaa
      Markus Armbruster authored
      
      The previous commit enables conversion of
      
          visit_foo(..., &err);
          if (err) {
              ...
          }
      
      to
      
          if (!visit_foo(..., errp)) {
              ...
          }
      
      for visitor functions that now return true / false on success / error.
      Coccinelle script:
      
          @@
          identifier fun =~ "check_list|input_type_enum|lv_start_struct|lv_type_bool|lv_type_int64|lv_type_str|lv_type_uint64|output_type_enum|parse_type_bool|parse_type_int64|parse_type_null|parse_type_number|parse_type_size|parse_type_str|parse_type_uint64|print_type_bool|print_type_int64|print_type_null|print_type_number|print_type_size|print_type_str|print_type_uint64|qapi_clone_start_alternate|qapi_clone_start_list|qapi_clone_start_struct|qapi_clone_type_bool|qapi_clone_type_int64|qapi_clone_type_null|qapi_clone_type_number|qapi_clone_type_str|qapi_clone_type_uint64|qapi_dealloc_start_list|qapi_dealloc_start_struct|qapi_dealloc_type_anything|qapi_dealloc_type_bool|qapi_dealloc_type_int64|qapi_dealloc_type_null|qapi_dealloc_type_number|qapi_dealloc_type_str|qapi_dealloc_type_uint64|qobject_input_check_list|qobject_input_check_struct|qobject_input_start_alternate|qobject_input_start_list|qobject_input_start_struct|qobject_input_type_any|qobject_input_type_bool|qobject_input_type_bool_keyval|qobject_input_type_int64|qobject_input_type_int64_keyval|qobject_input_type_null|qobject_input_type_number|qobject_input_type_number_keyval|qobject_input_type_size_keyval|qobject_input_type_str|qobject_input_type_str_keyval|qobject_input_type_uint64|qobject_input_type_uint64_keyval|qobject_output_start_list|qobject_output_start_struct|qobject_output_type_any|qobject_output_type_bool|qobject_output_type_int64|qobject_output_type_null|qobject_output_type_number|qobject_output_type_str|qobject_output_type_uint64|start_list|visit_check_list|visit_check_struct|visit_start_alternate|visit_start_list|visit_start_struct|visit_type_.*";
          expression list args;
          typedef Error;
          Error *err;
          @@
          -    fun(args, &err);
          -    if (err)
          +    if (!fun(args, &err))
               {
                   ...
               }
      
      A few line breaks tidied up manually.
      
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: default avatarEric Blake <eblake@redhat.com>
      Reviewed-by: default avatarVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
      Message-Id: <20200707160613.848843-19-armbru@redhat.com>
      62a35aaa
    • Markus Armbruster's avatar
      hmp: Eliminate a variable in hmp_migrate_set_parameter() · 3c4b89c3
      Markus Armbruster authored
      
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: default avatarEric Blake <eblake@redhat.com>
      Reviewed-by: default avatarVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
      Message-Id: <20200707160613.848843-17-armbru@redhat.com>
      3c4b89c3
  4. Jul 03, 2020
  5. Jun 17, 2020
  6. Jun 12, 2020
  7. Jun 10, 2020
    • Philippe Mathieu-Daudé's avatar
      memory: Make 'info mtree' not display disabled regions by default · 2261d393
      Philippe Mathieu-Daudé authored
      
      We might have many disabled memory regions, making the 'info mtree'
      output too verbose to be useful.
      Remove the disabled regions in the default output, but allow the
      monitor user to display them using the '-D' option.
      
      Before:
      
        (qemu) info mtree
        memory-region: system
          0000000000000000-ffffffffffffffff (prio 0, i/o): system
            0000000000000000-0000000007ffffff (prio 0, ram): alias ram-below-4g @pc.ram 0000000000000000-0000000007ffffff
            0000000000000000-ffffffffffffffff (prio -1, i/o): pci
              00000000000a0000-00000000000bffff (prio 1, i/o): vga-lowmem
              00000000000c0000-00000000000dffff (prio 1, rom): pc.rom
              00000000000e0000-00000000000fffff (prio 1, rom): alias isa-bios @pc.bios 0000000000020000-000000000003ffff
              00000000fffc0000-00000000ffffffff (prio 0, rom): pc.bios
            00000000000a0000-00000000000bffff (prio 1, i/o): alias smram-region @pci 00000000000a0000-00000000000bffff
            00000000000c0000-00000000000c3fff (prio 1, ram): alias pam-ram @pc.ram 00000000000c0000-00000000000c3fff [disabled]
            00000000000c0000-00000000000c3fff (prio 1, ram): alias pam-pci @pc.ram 00000000000c0000-00000000000c3fff [disabled]
            00000000000c0000-00000000000c3fff (prio 1, ram): alias pam-rom @pc.ram 00000000000c0000-00000000000c3fff [disabled]
            00000000000c0000-00000000000c3fff (prio 1, i/o): alias pam-pci @pci 00000000000c0000-00000000000c3fff
            00000000000c4000-00000000000c7fff (prio 1, ram): alias pam-ram @pc.ram 00000000000c4000-00000000000c7fff [disabled]
            00000000000c4000-00000000000c7fff (prio 1, ram): alias pam-pci @pc.ram 00000000000c4000-00000000000c7fff [disabled]
            00000000000c4000-00000000000c7fff (prio 1, ram): alias pam-rom @pc.ram 00000000000c4000-00000000000c7fff [disabled]
            00000000000c4000-00000000000c7fff (prio 1, i/o): alias pam-pci @pci 00000000000c4000-00000000000c7fff
            00000000000c8000-00000000000cbfff (prio 1, ram): alias pam-ram @pc.ram 00000000000c8000-00000000000cbfff [disabled]
            00000000000c8000-00000000000cbfff (prio 1, ram): alias pam-pci @pc.ram 00000000000c8000-00000000000cbfff [disabled]
            00000000000c8000-00000000000cbfff (prio 1, ram): alias pam-rom @pc.ram 00000000000c8000-00000000000cbfff [disabled]
            00000000000c8000-00000000000cbfff (prio 1, i/o): alias pam-pci @pci 00000000000c8000-00000000000cbfff
            00000000000cc000-00000000000cffff (prio 1, ram): alias pam-ram @pc.ram 00000000000cc000-00000000000cffff [disabled]
            00000000000cc000-00000000000cffff (prio 1, ram): alias pam-pci @pc.ram 00000000000cc000-00000000000cffff [disabled]
            00000000000cc000-00000000000cffff (prio 1, ram): alias pam-rom @pc.ram 00000000000cc000-00000000000cffff [disabled]
            00000000000cc000-00000000000cffff (prio 1, i/o): alias pam-pci @pci 00000000000cc000-00000000000cffff
            00000000000d0000-00000000000d3fff (prio 1, ram): alias pam-ram @pc.ram 00000000000d0000-00000000000d3fff [disabled]
            00000000000d0000-00000000000d3fff (prio 1, ram): alias pam-pci @pc.ram 00000000000d0000-00000000000d3fff [disabled]
            00000000000d0000-00000000000d3fff (prio 1, ram): alias pam-rom @pc.ram 00000000000d0000-00000000000d3fff [disabled]
            00000000000d0000-00000000000d3fff (prio 1, i/o): alias pam-pci @pci 00000000000d0000-00000000000d3fff
            00000000000d4000-00000000000d7fff (prio 1, ram): alias pam-ram @pc.ram 00000000000d4000-00000000000d7fff [disabled]
            00000000000d4000-00000000000d7fff (prio 1, ram): alias pam-pci @pc.ram 00000000000d4000-00000000000d7fff [disabled]
            00000000000d4000-00000000000d7fff (prio 1, ram): alias pam-rom @pc.ram 00000000000d4000-00000000000d7fff [disabled]
            00000000000d4000-00000000000d7fff (prio 1, i/o): alias pam-pci @pci 00000000000d4000-00000000000d7fff
            00000000000d8000-00000000000dbfff (prio 1, ram): alias pam-ram @pc.ram 00000000000d8000-00000000000dbfff [disabled]
            00000000000d8000-00000000000dbfff (prio 1, ram): alias pam-pci @pc.ram 00000000000d8000-00000000000dbfff [disabled]
            00000000000d8000-00000000000dbfff (prio 1, ram): alias pam-rom @pc.ram 00000000000d8000-00000000000dbfff [disabled]
            00000000000d8000-00000000000dbfff (prio 1, i/o): alias pam-pci @pci 00000000000d8000-00000000000dbfff
            00000000000dc000-00000000000dffff (prio 1, ram): alias pam-ram @pc.ram 00000000000dc000-00000000000dffff [disabled]
            00000000000dc000-00000000000dffff (prio 1, ram): alias pam-pci @pc.ram 00000000000dc000-00000000000dffff [disabled]
            00000000000dc000-00000000000dffff (prio 1, ram): alias pam-rom @pc.ram 00000000000dc000-00000000000dffff [disabled]
            00000000000dc000-00000000000dffff (prio 1, i/o): alias pam-pci @pci 00000000000dc000-00000000000dffff
            00000000000e0000-00000000000e3fff (prio 1, ram): alias pam-ram @pc.ram 00000000000e0000-00000000000e3fff [disabled]
            00000000000e0000-00000000000e3fff (prio 1, ram): alias pam-pci @pc.ram 00000000000e0000-00000000000e3fff [disabled]
            00000000000e0000-00000000000e3fff (prio 1, ram): alias pam-rom @pc.ram 00000000000e0000-00000000000e3fff [disabled]
            00000000000e0000-00000000000e3fff (prio 1, i/o): alias pam-pci @pci 00000000000e0000-00000000000e3fff
            00000000000e4000-00000000000e7fff (prio 1, ram): alias pam-ram @pc.ram 00000000000e4000-00000000000e7fff [disabled]
            00000000000e4000-00000000000e7fff (prio 1, ram): alias pam-pci @pc.ram 00000000000e4000-00000000000e7fff [disabled]
            00000000000e4000-00000000000e7fff (prio 1, ram): alias pam-rom @pc.ram 00000000000e4000-00000000000e7fff [disabled]
            00000000000e4000-00000000000e7fff (prio 1, i/o): alias pam-pci @pci 00000000000e4000-00000000000e7fff
            00000000000e8000-00000000000ebfff (prio 1, ram): alias pam-ram @pc.ram 00000000000e8000-00000000000ebfff [disabled]
            00000000000e8000-00000000000ebfff (prio 1, ram): alias pam-pci @pc.ram 00000000000e8000-00000000000ebfff [disabled]
            00000000000e8000-00000000000ebfff (prio 1, ram): alias pam-rom @pc.ram 00000000000e8000-00000000000ebfff [disabled]
            00000000000e8000-00000000000ebfff (prio 1, i/o): alias pam-pci @pci 00000000000e8000-00000000000ebfff
            00000000000ec000-00000000000effff (prio 1, ram): alias pam-ram @pc.ram 00000000000ec000-00000000000effff [disabled]
            00000000000ec000-00000000000effff (prio 1, ram): alias pam-pci @pc.ram 00000000000ec000-00000000000effff [disabled]
            00000000000ec000-00000000000effff (prio 1, ram): alias pam-rom @pc.ram 00000000000ec000-00000000000effff [disabled]
            00000000000ec000-00000000000effff (prio 1, i/o): alias pam-pci @pci 00000000000ec000-00000000000effff
            00000000000f0000-00000000000fffff (prio 1, ram): alias pam-ram @pc.ram 00000000000f0000-00000000000fffff [disabled]
            00000000000f0000-00000000000fffff (prio 1, ram): alias pam-pci @pc.ram 00000000000f0000-00000000000fffff [disabled]
            00000000000f0000-00000000000fffff (prio 1, ram): alias pam-rom @pc.ram 00000000000f0000-00000000000fffff [disabled]
            00000000000f0000-00000000000fffff (prio 1, i/o): alias pam-pci @pci 00000000000f0000-00000000000fffff
            00000000fec00000-00000000fec00fff (prio 0, i/o): ioapic
            00000000fed00000-00000000fed003ff (prio 0, i/o): hpet
            00000000fee00000-00000000feefffff (prio 4096, i/o): apic-msi
      
      After:
      
        (qemu) info mtree
        memory-region: system
          0000000000000000-ffffffffffffffff (prio 0, i/o): system
            0000000000000000-0000000007ffffff (prio 0, ram): alias ram-below-4g @pc.ram 0000000000000000-0000000007ffffff
            0000000000000000-ffffffffffffffff (prio -1, i/o): pci
              00000000000a0000-00000000000bffff (prio 1, i/o): vga-lowmem
              00000000000c0000-00000000000dffff (prio 1, rom): pc.rom
              00000000000e0000-00000000000fffff (prio 1, rom): alias isa-bios @pc.bios 0000000000020000-000000000003ffff
              00000000fffc0000-00000000ffffffff (prio 0, rom): pc.bios
            00000000000a0000-00000000000bffff (prio 1, i/o): alias smram-region @pci 00000000000a0000-00000000000bffff
            00000000000c0000-00000000000c3fff (prio 1, i/o): alias pam-pci @pci 00000000000c0000-00000000000c3fff
            00000000000c4000-00000000000c7fff (prio 1, i/o): alias pam-pci @pci 00000000000c4000-00000000000c7fff
            00000000000c8000-00000000000cbfff (prio 1, i/o): alias pam-pci @pci 00000000000c8000-00000000000cbfff
            00000000000cc000-00000000000cffff (prio 1, i/o): alias pam-pci @pci 00000000000cc000-00000000000cffff
            00000000000d0000-00000000000d3fff (prio 1, i/o): alias pam-pci @pci 00000000000d0000-00000000000d3fff
            00000000000d4000-00000000000d7fff (prio 1, i/o): alias pam-pci @pci 00000000000d4000-00000000000d7fff
            00000000000d8000-00000000000dbfff (prio 1, i/o): alias pam-pci @pci 00000000000d8000-00000000000dbfff
            00000000000dc000-00000000000dffff (prio 1, i/o): alias pam-pci @pci 00000000000dc000-00000000000dffff
            00000000000e0000-00000000000e3fff (prio 1, i/o): alias pam-pci @pci 00000000000e0000-00000000000e3fff
            00000000000e4000-00000000000e7fff (prio 1, i/o): alias pam-pci @pci 00000000000e4000-00000000000e7fff
            00000000000e8000-00000000000ebfff (prio 1, i/o): alias pam-pci @pci 00000000000e8000-00000000000ebfff
            00000000000ec000-00000000000effff (prio 1, i/o): alias pam-pci @pci 00000000000ec000-00000000000effff
            00000000000f0000-00000000000fffff (prio 1, i/o): alias pam-pci @pci 00000000000f0000-00000000000fffff
            00000000fec00000-00000000fec00fff (prio 0, i/o): ioapic
            00000000fed00000-00000000fed003ff (prio 0, i/o): hpet
            00000000fee00000-00000000feefffff (prio 4096, i/o): apic-msi
      
      The old behavior is preserved using 'info mtree -D'.
      
      Signed-off-by: default avatarPhilippe Mathieu-Daudé <philmd@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      2261d393
  8. May 15, 2020
  9. May 07, 2020
  10. May 04, 2020
  11. Apr 30, 2020
  12. Mar 25, 2020
  13. Mar 17, 2020
    • Eric Blake's avatar
      net: Track netdevs in NetClientState rather than QemuOpt · 08712fcb
      Eric Blake authored
      
      As mentioned in the previous patch, our use of QemuOpt group "netdev"
      has two purposes: collect the CLI arguments, and serve as a witness
      for monitor hotplug actions.  As the latter didn't use anything but an
      id, it felt rather unclean to have to touch QemuOpts at all when going
      through QMP, so let's instead track things with a bool field in
      NetClientState.
      
      Suggested-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: default avatarEric Blake <eblake@redhat.com>
      Message-Id: <20200317201711.322764-3-eblake@redhat.com>
      Reviewed-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      08712fcb
    • Eric Blake's avatar
      net: Complete qapi-fication of netdev_add · db2a380c
      Eric Blake authored
      
      We've had all the required pieces for doing a type-safe representation
      of netdev_add as a flat union for quite some time now (since
      0e55c381 in v2.7.0, released in 2016), but did not make the final
      switch to using it because of concern about whether a command-line
      regression in accepting "1" in place of 1 for integer arguments would
      be problematic.  Back then, we did not have the deprecation cycle to
      allow us to make progress.  But now that we have waited so long, other
      problems have crept in: for example, our desire to add
      qemu-storage-daemon is hampered by the inability to express net
      objects, and we are unable to introspect what we actually accept.
      Additionally, our round-trip through QemuOpts silently eats any
      argument that expands to an array, rendering dnssearch, hostfwd, and
      guestfwd useless through QMP:
      
      {"execute": "netdev_add", "arguments": { "id": "netdev0",
        "type": "user", "dnssearch": [
          { "str": "8.8.8.8" }, { "str": "8.8.4.4" }
        ]}}
      
      So without further ado, let's turn on proper QAPI.  netdev_add() was a
      trivial wrapper around net_client_init(), which did a few steps prior
      to calling net_client_init1(); with this patch, we now skip directly
      to net_client_init1().  In addition to fixing array parameters, the
      following additional differences occur:
      
      -  {"execute": "netdev_add", "arguments": {"type": "help"}}
      no longer attempts to print help to stdout and exit.  Bug fix, broken
      in 547203ea 'net: List available netdevs with "-netdev help"',
      v2.12.0.
      
      -  {"execute": "netdev_add", "arguments': {... "ipv6-net": "..." }}
      no longer attempts to desugar the undocumented ipv6-net magic string
      into the proper "ipv6-prefix" and "ipv6-prefixlen".  Undocumented
      misfeature, introduced in commit 7aac531e "qapi-schema, qemu-options
      & slirp: Adding Qemu options for IPv6 addresses", v2.6.0.
      
      -  {'execute':'netdev_add',
           'arguments':{'id':'net2', 'type':'hubport', 'hubid':"2"}}
         {"error": {"class": "GenericError", "desc": "Invalid parameter type for 'hubid', expected: integer"}}
      Used to succeed: since our command line treats everything as strings,
      our not-so-round-trip conversion from QAPI -> QemuOpts -> QAPI lost
      the original typing and turned everything into a string; now that we
      skip the QemuOpts, the JSON input has to match the exact QAPI type.
      But this stricter QMP is desirable, and introspection is sufficient
      for any affected applications to make sure they use it correctly.
      
      In qmp_netdev_add(), we still have to create a QemuOpts object so that
      qmp_netdev_del() will be able to remove a hotplugged network device;
      but the opts->head remains empty since we now manage all parsing
      through the QAPI object rather than QemuOpts; a separate patch will
      address the abuse of QemuOpts as a witness for whether a
      NetClientState is a netdev.  In the meantime, our argument that we are
      okay requires auditing all uses of option group "netdev":
      
      - qemu_netdev_opts: option group definition, empty .desc[]
      - CLI (CLI netdev parsing ends before monitors start, so while
        monitors can mess with CLI netdevs, CLI cannot mess with
        monitor netdevs):
        - main() case QEMU_OPTION_netdev: store CLI definition
        - main() case QEMU_OPTION_readconfig, case QEMU_OPTION_writeconfig:
        similar, dealing only with CLI
        - net_init_clients(): Pass CLI to net_client_init()
      - Monitor:
        - hmp_netdev_add(): straightforward parse into net_client_init()
        - qmp_netdev_add(): subject of this patch, used to add full
        object to option group, now just adds bare-bones id
        - qmp_netdev_del(), netdev_del_completion(): check the option group
        solely for id, as a 'is this a netdev' predicate
      
      Reported-by: default avatarAlex Kirillov <lekiravi@yandex-team.ru>
      Signed-off-by: default avatarEric Blake <eblake@redhat.com>
      Message-Id: <20200317201711.322764-2-eblake@redhat.com>
      Reviewed-by: default avatarMarkus Armbruster <armbru@redhat.com>
      [Commit message typo fixed]
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      db2a380c
    • Marc-André Lureau's avatar
      qmp: constify QmpCommand and list · f0ccc00b
      Marc-André Lureau authored
      
      Since 0b69f6f7 "qapi: remove
      qmp_unregister_command()", the command list can be declared const.
      
      Signed-off-by: default avatarMarc-André Lureau <marcandre.lureau@redhat.com>
      Reviewed-by: default avatarDamien Hedde <damien.hedde@greensocs.com>
      Message-Id: <20200316171824.2319695-1-marcandre.lureau@redhat.com>
      [Rebased]
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      f0ccc00b
  14. Mar 13, 2020
  15. Mar 09, 2020
Loading