1. 01 2月, 2019 13 次提交
    • K
      vmdk: Reject excess extents in blockdev-create · 4a960ece
      Kevin Wolf 提交于
      Clarify that the number of extents provided in BlockdevCreateOptionsVmdk
      must match the number of extents that will actually be used. Providing
      more extents will result in an error now.
      
      This requires adapting the test case to provide the right number of
      extents.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      4a960ece
    • K
      iotests: Add VMDK tests for blockdev-create · 1c4e7b64
      Kevin Wolf 提交于
      Signed-off-by: NFam Zheng <famz@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      1c4e7b64
    • F
      iotests: Filter cid numbers in VMDK extent info · bab4feb2
      Fam Zheng 提交于
      Signed-off-by: NFam Zheng <famz@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      bab4feb2
    • F
      vmdk: Implement .bdrv_co_create callback · 3015372d
      Fam Zheng 提交于
      This makes VMDK support blockdev-create. The implementation reuses the
      image creation code in vmdk_co_create_opts which now acceptes a callback
      pointer to "retrieve" BlockBackend pointers from the caller. This way we
      separate the logic between file/extent acquisition and initialization.
      
      The QAPI command parameters are mostly the same as the old create_opts
      except the dropped legacy @compat6 switch, which is redundant with
      @hwversion.
      Signed-off-by: NFam Zheng <famz@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      3015372d
    • F
      vmdk: Refactor vmdk_create_extent · 5be28490
      Fam Zheng 提交于
      The extracted vmdk_init_extent takes a BlockBackend object and
      initializes the format metadata. It is the common part between "qemu-img
      create" and "blockdev-create".
      
      Add a "BlockBackend *pbb" parameter to vmdk_create_extent, to return the
      opened BB to the caller in the next patch.
      Signed-off-by: NFam Zheng <famz@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      5be28490
    • M
      iotests: Make 234 stable · 9a378495
      Max Reitz 提交于
      This test waits for a MIGRATION event with status=completed on the
      source VM before querying the migration status on both source and
      destination.  However, just because the source says migration has
      completed does not mean the destination thinks the same.  Therefore, in
      some cases, the destination VM may still report "active" instead of
      "completed" when asked for its migration status.
      
      Fix this by enabling migration events on both VMs and waiting until both
      source and destination emit a status=completed MIGRATION event.
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      9a378495
    • K
      block: Fix hangs in synchronous APIs with iothreads · 4720cbee
      Kevin Wolf 提交于
      In the block layer, synchronous APIs are often implemented by creating a
      coroutine that calls the asynchronous coroutine-based implementation and
      then waiting for completion with BDRV_POLL_WHILE().
      
      For this to work with iothreads (more specifically, when the synchronous
      API is called in a thread that is not the home thread of the block
      device, so that the coroutine will run in a different thread), we must
      make sure to call aio_wait_kick() at the end of the operation. Many
      places are missing this, so that BDRV_POLL_WHILE() keeps hanging even if
      the condition has long become false.
      
      Note that bdrv_dec_in_flight() involves an aio_wait_kick() call. This
      corresponds to the BDRV_POLL_WHILE() in the drain functions, but it is
      generally not enough for most other operations because they haven't set
      the return value in the coroutine entry stub yet. To avoid race
      conditions there, we need to kick after setting the return value.
      
      The race window is small enough that the problem doesn't usually surface
      in the common path. However, it does surface and causes easily
      reproducible hangs if the operation can return early before even calling
      bdrv_inc/dec_in_flight, which many of them do (trivial error or no-op
      success paths).
      
      The bug in bdrv_truncate(), bdrv_check() and bdrv_invalidate_cache() is
      slightly different: These functions even neglected to schedule the
      coroutine in the home thread of the node. This avoids the hang, but is
      obviously wrong, too. Fix those to schedule the coroutine in the right
      AioContext in addition to adding aio_wait_kick() calls.
      
      Cc: qemu-stable@nongnu.org
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
      4720cbee
    • M
      block: Replace qdict_put() by qdict_put_obj() where appropriate · 4e20c1be
      Markus Armbruster 提交于
      Patch created mechanically by rerunning:
      
        $  spatch --sp-file scripts/coccinelle/qobject.cocci \
      	    --macro-file scripts/cocci-macro-file.h \
      	    --dir block --in-place
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NAlberto Garcia <berto@igalia.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      4e20c1be
    • Y
      qemu-iotests: add test case for dmg · 76f1cf0a
      yuchenlin 提交于
      Recently, some bugs in dmg file have been fixed. To prevent reading dmg
      is broken someday in the future, add a simple test which ensures the
      conversion from dmg to raw should not hang or face any I/O error.
      Signed-off-by: Nyuchenlin <npes87184@gmail.com>
      Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      76f1cf0a
    • A
      qcow2: Assert that refcount block offsets fit in the refcount table · cdc674c7
      Alberto Garcia 提交于
      Refcount table entries have a field to store the offset of the
      refcount block. The rest of the bits of the entry are currently
      reserved.
      
      The offset is always taken from the entry using REFT_OFFSET_MASK to
      ensure that we only use the bits that belong to that field.
      
      While that mask is used every time we read from the refcount table, it
      is never used when we write to it. Due to the other constraints of the
      qcow2 format QEMU can never produce refcount block offsets that don't
      fit in that field so any such offset when allocating a refcount block
      would indicate a bug in QEMU.
      Signed-off-by: NAlberto Garcia <berto@igalia.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      cdc674c7
    • A
      mirror: Block the source BlockDriverState in mirror_start_job() · 67b24427
      Alberto Garcia 提交于
      The mirror_start_job() function used for the commit-active job blocks
      the source, target and all intermediate nodes for the duration of the
      job.
      
         target <- intermediate <- source
      
      Since 4ef85a9c this function creates a dummy mirror_top_bs that
      goes on top of the source node, and it is this dummy node that gets
      blocked instead. The source node is never blocked or added to the
      job's list of nodes.
      
         target <- intermediate <- source <- mirror_top
      
      At the moment I don't think it is possible to exploit this problem
      because any additional job on 'source' would either be forbidden for
      other reasons or it would need to involve an additional node that is
      blocked, causing an error.
      
      This can be seen in the error messages, however, because they never
      refer to the source node being blocked:
      
        $ qemu-img create -f qcow2 hd0.qcow2 1M
        $ qemu-img create -f qcow2 -b hd0.qcow2 hd1.qcow2
        $ qemu-io -c 'write 0 1M' hd0.qcow2
        $ $QEMU -drive if=none,file=hd1.qcow2,node-name=hd1
        { "execute": "qmp_capabilities" }
        { "execute": "block-commit", "arguments": {"device": "hd1", "speed": 256}}
        { "execute": "block-stream", "arguments": {"device": "hd1"}}
        { "error": {"class": "GenericError",
          "desc": "Node 'hd0' is busy: block device is in use by block job: commit"}}
      
      After this patch the error message refers to 'hd1', as it should.
      
      The expected output of iotest 141 also needs to be updated for the
      same reason.
      Signed-off-by: NAlberto Garcia <berto@igalia.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      67b24427
    • A
      mirror: Release the dirty bitmap if mirror_start_job() fails · e917e2cb
      Alberto Garcia 提交于
      At the moment I don't see how to make this function fail after the
      dirty bitmap has been created, but if that was possible then we would
      hit the assert(QLIST_EMPTY(&bs->dirty_bitmaps)) in bdrv_close().
      Signed-off-by: NAlberto Garcia <berto@igalia.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      e917e2cb
    • P
      Merge remote-tracking branch 'remotes/xanclic/tags/pull-block-2019-01-31' into staging · cfe6c547
      Peter Maydell 提交于
      Block patches:
      - New debugging QMP command to explore block graphs
      - Converted DPRINTF()s to trace events
      - Fixed qemu-io's use of getopt() for systems with optreset
      - Minor NVMe emulation fixes
      - An iotest fix
      
      # gpg: Signature made Thu 31 Jan 2019 00:51:46 GMT
      # gpg:                using RSA key F407DB0061D5CF40
      # gpg: Good signature from "Max Reitz <mreitz@redhat.com>" [full]
      # Primary key fingerprint: 91BE B60A 30DB 3E88 57D1  1829 F407 DB00 61D5 CF40
      
      * remotes/xanclic/tags/pull-block-2019-01-31:
        iotests: Allow 147 to be run concurrently
        iotests: Bind qemu-nbd to localhost in 147
        iotests.py: Add qemu_nbd_pipe()
        nvme: use pci_dev directly in nvme_realize
        nvme: ensure the num_queues is not zero
        nvme: use TYPE_NVME instead of constant string
        qemu-io: Add generic function for reinitializing optind.
        block/sheepdog: Convert from DPRINTF() macro to trace events
        block/file-posix: Convert from DPRINTF() macro to trace events
        block/curl: Convert from DPRINTF() macro to trace events
        block/ssh: Convert from DPRINTF() macro to trace events
        scripts: add render_block_graph function for QEMUMachine
        qapi: add x-debug-query-block-graph
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      cfe6c547
  2. 31 1月, 2019 17 次提交
    • P
      Merge remote-tracking branch 'remotes/vivier2/tags/trivial-branch-pull-request' into staging · e8977901
      Peter Maydell 提交于
      - add device category (edu, i8042, sd memory card)
      - code clean-up
      - LGPL information clean-up
      - fix typo (acpi)
      
      # gpg: Signature made Wed 30 Jan 2019 13:21:50 GMT
      # gpg:                using RSA key F30C38BD3F2FBE3C
      # gpg: Good signature from "Laurent Vivier <lvivier@redhat.com>" [full]
      # gpg:                 aka "Laurent Vivier <laurent@vivier.eu>" [full]
      # gpg:                 aka "Laurent Vivier (Red Hat) <lvivier@redhat.com>" [full]
      # Primary key fingerprint: CD2F 75DD C8E3 A4DC 2E4F  5173 F30C 38BD 3F2F BE3C
      
      * remotes/vivier2/tags/trivial-branch-pull-request:
        virtio-blk: remove duplicate definition of VirtIOBlock *s pointer
        hw/block: clean up stale xen_disk trace entries
        target/m68k: Fix LGPL information in the file headers
        target/s390x: Fix LGPL version in the file header comments
        tcg: Fix LGPL version number
        target/tricore: Fix LGPL version number
        target/openrisc: Fix LGPL version number
        COPYING.LIB: Synchronize the LGPL 2.1 with the version from gnu.org
        Don't talk about the LGPL if the file is licensed under the GPL
        hw: sd: set category of the sd memory card
        hw: input: set category of the i8042 device
        typo: apci->acpi
        hw: edu: set category of the edu device
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      e8977901
    • P
      Merge remote-tracking branch 'remotes/kraxel/tags/usb-20190130-pull-request' into staging · aefcd283
      Peter Maydell 提交于
      usb: xhci: fix iso transfers.
      usb: mtp: break up writes, bugfixes.
      usb: fix lgpl info in headers.
      usb: hid: unique serials.
      
      # gpg: Signature made Wed 30 Jan 2019 07:33:21 GMT
      # gpg:                using RSA key 4CB6D8EED3E87138
      # gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" [full]
      # gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>" [full]
      # gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>" [full]
      # Primary key fingerprint: A032 8CFF B93A 17A7 9901  FE7D 4CB6 D8EE D3E8 7138
      
      * remotes/kraxel/tags/usb-20190130-pull-request:
        usb-mtp: replace the homebrew write with qemu_write_full
        usb-mtp: breakup MTP write into smaller chunks
        usb-mtp: Reallocate buffer in multiples of MTP_WRITE_BUF_SZ
        usb: implement XHCI underrun/overrun events
        usb: XHCI shall not halt isochronous endpoints
        hw/usb: Fix LGPL information in the file headers
        usb: dev-mtp: close fd in usb_mtp_object_readdir()
        usb: assign unique serial numbers to hid devices
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      aefcd283
    • P
      Merge remote-tracking branch 'remotes/stefanha/tags/tracing-pull-request' into staging · 460da100
      Peter Maydell 提交于
      Pull request
      
      User-visible changes:
       * The new qemu-trace-stap script makes it convenient to collect traces without
         writing SystemTap scripts.  See "man qemu-trace-stap" for details.
      
      # gpg: Signature made Wed 30 Jan 2019 03:17:57 GMT
      # gpg:                using RSA key 9CA4ABB381AB73C8
      # gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>" [full]
      # gpg:                 aka "Stefan Hajnoczi <stefanha@gmail.com>" [full]
      # Primary key fingerprint: 8695 A8BF D3F9 7CDA AC35  775A 9CA4 ABB3 81AB 73C8
      
      * remotes/stefanha/tags/tracing-pull-request:
        trace: rerun tracetool after ./configure changes
        trace: improve runstate tracing
        trace: add ability to do simple printf logging via systemtap
        trace: forbid use of %m in trace event format strings
        trace: enforce that every trace-events file has a final newline
        display: ensure qxl log_buf is a nul terminated string
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      460da100
    • P
      Merge remote-tracking branch 'remotes/ehabkost/tags/machine-next-pull-request' into staging · 006dce5f
      Peter Maydell 提交于
      Machine queue, 2019-01-28
      
      * Fix small leak on NUMA code
      * Improve memory backend error messages
      
      # gpg: Signature made Mon 28 Jan 2019 19:42:40 GMT
      # gpg:                using RSA key 2807936F984DC5A6
      # gpg: Good signature from "Eduardo Habkost <ehabkost@redhat.com>" [full]
      # Primary key fingerprint: 5A32 2FD5 ABC4 D3DB ACCF  D1AA 2807 936F 984D C5A6
      
      * remotes/ehabkost/tags/machine-next-pull-request:
        hostmem: add more information in error messages
        numa: Fixed the memory leak of numa error message
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      006dce5f
    • M
      iotests: Allow 147 to be run concurrently · 908b3016
      Max Reitz 提交于
      To do this, we need to allow creating the NBD server on various ports
      instead of a single one (which may not even work if you run just one
      instance, because something entirely else might be using that port).
      
      So we just pick a random port in [32768, 32768 + 1024) and try to create
      a server there.  If that fails, we just retry until something sticks.
      
      For the IPv6 test, we need a different range, though (just above that
      one).  This is because "localhost" resolves to both 127.0.0.1 and ::1.
      This means that if you bind to it, it will bind to both, if possible, or
      just one if the other is already in use.  Therefore, if the IPv6 test
      has already taken [::1]:some_port and we then try to take
      localhost:some_port, that will work -- only the second server will be
      bound to 127.0.0.1:some_port alone and not [::1]:some_port in addition.
      So we have two different servers on the same port, one for IPv4 and one
      for IPv6.
      
      But when we then try to connect to the server through
      localhost:some_port, we will always end up at the IPv6 one (as long as
      it is up), and this may not be the one we want.
      
      Thus, we must make sure not to create an IPv6-only NBD server on the
      same port as a normal "dual-stack" NBD server -- which is done by using
      distinct port ranges, as explained above.
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      Message-id: 20181221234750.23577-4-mreitz@redhat.com
      Reviewed-by: NJohn Snow <jsnow@redhat.com>
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      908b3016
    • M
      iotests: Bind qemu-nbd to localhost in 147 · dfadac9a
      Max Reitz 提交于
      By default, qemu-nbd binds to 0.0.0.0.  However, we then proceed to
      connect to "localhost".  Usually, this works out fine; but if this test
      is run concurrently, some other test function may have bound a different
      server to ::1 (on the same port -- you can bind different serves to the
      same port, as long as one is on IPv4 and the other on IPv6).
      
      So running qemu-nbd works, it can bind to 0.0.0.0:NBD_PORT.  But
      potentially a concurrent test has successfully taken [::1]:NBD_PORT.  In
      this case, trying to connect to "localhost" will lead us to the IPv6
      instance, where we do not want to end up.
      
      Fix this by just binding to "localhost".  This will make qemu-nbd error
      out immediately and not give us cryptic errors later.
      
      (Also, it will allow us to just try a different port as of a future
      patch.)
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      Message-id: 20181221234750.23577-3-mreitz@redhat.com
      Reviewed-by: NJohn Snow <jsnow@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      dfadac9a
    • M
      iotests.py: Add qemu_nbd_pipe() · e1e6eccd
      Max Reitz 提交于
      In some cases, we may want to deal with qemu-nbd errors (e.g. by
      launching it in a different configuration until it no longer throws
      any).  In that case, we do not want its output ending up in the test
      output.
      
      It may still be useful for handling the error, though, so add a new
      function that works basically like qemu_nbd(), only that it returns the
      qemu-nbd output instead of making it end up in the log.  In contrast to
      qemu_img_pipe(), it does still return the exit code as well, though,
      because that is even more important for error handling.
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      Message-id: 20181221234750.23577-2-mreitz@redhat.com
      Reviewed-by: NJohn Snow <jsnow@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      e1e6eccd
    • L
      nvme: use pci_dev directly in nvme_realize · a3d25ddd
      Li Qiang 提交于
      There is no need to make another reference.
      Signed-off-by: NLi Qiang <liq3ea@163.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Reviewed-by: NPhilippe Mathieu-Daudé <philmd@redhat.com>
      Message-id: 20190120055558.32984-4-liq3ea@163.com
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      a3d25ddd
    • L
      nvme: ensure the num_queues is not zero · 2410e133
      Li Qiang 提交于
      When it is zero, it causes segv.
      Using following command:
      
      "-drive file=//home/test/test1.img,if=none,id=id0
      -device nvme,drive=id0,serial=test,num_queues=0"
      causes following Backtrack:
      
      Thread 4 "qemu-system-x86" received signal SIGSEGV, Segmentation fault.
      [Switching to Thread 0x7fffe9735700 (LWP 30952)]
      0x0000555555a7a77c in nvme_start_ctrl (n=0x5555577473f0) at hw/block/nvme.c:825
      825	    if (unlikely(n->cq[0])) {
      (gdb) bt
      0  0x0000555555a7a77c in nvme_start_ctrl (n=0x5555577473f0)
          at hw/block/nvme.c:825
      1  0x0000555555a7af7f in nvme_write_bar (n=0x5555577473f0, offset=20,
          data=4587521, size=4) at hw/block/nvme.c:969
      2  0x0000555555a7b81a in nvme_mmio_write (opaque=0x5555577473f0, addr=20,
          data=4587521, size=4) at hw/block/nvme.c:1163
      3  0x0000555555869236 in memory_region_write_accessor (mr=0x555557747cd0,
          addr=20, value=0x7fffe97320f8, size=4, shift=0, mask=4294967295, attrs=...)
          at /home/test/qemu1/qemu/memory.c:502
      4  0x0000555555869446 in access_with_adjusted_size (addr=20,
          value=0x7fffe97320f8, size=4, access_size_min=2, access_size_max=8,
          access_fn=0x55555586914d <memory_region_write_accessor>,
          mr=0x555557747cd0, attrs=...) at /home/test/qemu1/qemu/memory.c:568
      5  0x000055555586c479 in memory_region_dispatch_write (mr=0x555557747cd0,
          addr=20, data=4587521, size=4, attrs=...)
          at /home/test/qemu1/qemu/memory.c:1499
      6  0x00005555558030af in flatview_write_continue (fv=0x7fffe0061130,
          addr=4273930260, attrs=..., buf=0x7ffff7ff0028 "\001", len=4, addr1=20,
          l=4, mr=0x555557747cd0) at /home/test/qemu1/qemu/exec.c:3234
      7  0x00005555558031f9 in flatview_write (fv=0x7fffe0061130, addr=4273930260,
          attrs=..., buf=0x7ffff7ff0028 "\001", len=4)
          at /home/test/qemu1/qemu/exec.c:3273
      8  0x00005555558034ff in address_space_write (
      ---Type <return> to continue, or q <return> to quit---
          as=0x555556758480 <address_space_memory>, addr=4273930260, attrs=...,
          buf=0x7ffff7ff0028 "\001", len=4) at /home/test/qemu1/qemu/exec.c:3363
      9  0x0000555555803550 in address_space_rw (
          as=0x555556758480 <address_space_memory>, addr=4273930260, attrs=...,
          buf=0x7ffff7ff0028 "\001", len=4, is_write=true)
          at /home/test/qemu1/qemu/exec.c:3374
      10 0x00005555558884a1 in kvm_cpu_exec (cpu=0x555556920e40)
          at /home/test/qemu1/qemu/accel/kvm/kvm-all.c:2031
      11 0x000055555584cd9d in qemu_kvm_cpu_thread_fn (arg=0x555556920e40)
          at /home/test/qemu1/qemu/cpus.c:1281
      12 0x0000555555dbaf6d in qemu_thread_start (args=0x5555569438a0)
          at util/qemu-thread-posix.c:502
      13 0x00007ffff5dc86db in start_thread (arg=0x7fffe9735700)
          at pthread_create.c:463
      14 0x00007ffff5af188f in clone ()
          at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      Signed-off-by: NLi Qiang <liq3ea@163.com>
      Reviewed-by: NPhilippe Mathieu-Daudé <philmd@redhat.com>
      Message-id: 20190120055558.32984-3-liq3ea@163.com
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      2410e133
    • L
      nvme: use TYPE_NVME instead of constant string · 08db59e1
      Li Qiang 提交于
      Signed-off-by: NLi Qiang <liq3ea@163.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Reviewed-by: NPhilippe Mathieu-Daudé <philmd@redhat.com>
      Message-id: 20190120055558.32984-2-liq3ea@163.com
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      08db59e1
    • R
      qemu-io: Add generic function for reinitializing optind. · d339d766
      Richard W.M. Jones 提交于
      On FreeBSD 11.2:
      
        $ nbdkit memory size=1M --run './qemu-io -f raw -c "aio_write 0 512" $nbd'
        Parsing error: non-numeric argument, or extraneous/unrecognized suffix -- aio_write
      
      After main option parsing, we reinitialize optind so we can parse each
      command.  However reinitializing optind to 0 does not work on FreeBSD.
      What happens when you do this is optind remains 0 after the option
      parsing loop, and the result is we try to parse argv[optind] ==
      argv[0] == "aio_write" as if it was the first parameter.
      
      The FreeBSD manual page says:
      
        In order to use getopt() to evaluate multiple sets of arguments, or to
        evaluate a single set of arguments multiple times, the variable optreset
        must be set to 1 before the second and each additional set of calls to
        getopt(), and the variable optind must be reinitialized.
      
      (From the rest of the man page it is clear that optind must be
      reinitialized to 1).
      
      The glibc man page says:
      
        A program that scans multiple argument vectors,  or  rescans  the  same
        vector  more than once, and wants to make use of GNU extensions such as
        '+' and '-' at  the  start  of  optstring,  or  changes  the  value  of
        POSIXLY_CORRECT  between scans, must reinitialize getopt() by resetting
        optind to 0, rather than the traditional value of 1.  (Resetting  to  0
        forces  the  invocation  of  an  internal  initialization  routine that
        rechecks POSIXLY_CORRECT and checks for GNU extensions in optstring.)
      
      This commit introduces an OS-portability function called
      qemu_reset_optind which provides a way of resetting optind that works
      on FreeBSD and platforms that use optreset, while keeping it the same
      as now on other platforms.
      
      Note that the qemu codebase sets optind in many other places, but in
      those other places it's setting a local variable and not using getopt.
      This change is only needed in places where we are using getopt and the
      associated global variable optind.
      Signed-off-by: NRichard W.M. Jones <rjones@redhat.com>
      Message-id: 20190118101114.11759-2-rjones@redhat.com
      Reviewed-by: NDaniel P. Berrangé <berrange@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      d339d766
    • L
      block/sheepdog: Convert from DPRINTF() macro to trace events · 70018a14
      Laurent Vivier 提交于
      Signed-off-by: NLaurent Vivier <lvivier@redhat.com>
      Reviewed-by: NPhilippe Mathieu-Daudé <philmd@redhat.com>
      Message-id: 20181213162727.17438-5-lvivier@redhat.com
      [mreitz: Fixed sheepdog_snapshot_create_inode's format string to use
               PRIx32 for uint32_ts]
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      70018a14
    • L
      block/file-posix: Convert from DPRINTF() macro to trace events · 4f7d28d7
      Laurent Vivier 提交于
      Signed-off-by: NLaurent Vivier <lvivier@redhat.com>
      Reviewed-by: NPhilippe Mathieu-Daudé <philmd@redhat.com>
      Message-id: 20181213162727.17438-4-lvivier@redhat.com
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      4f7d28d7
    • L
      block/curl: Convert from DPRINTF() macro to trace events · ed2a66de
      Laurent Vivier 提交于
      Signed-off-by: NLaurent Vivier <lvivier@redhat.com>
      Reviewed-by: NRichard W.M. Jones <rjones@redhat.com>
      Reviewed-by: NPhilippe Mathieu-Daudé <philmd@redhat.com>
      Message-id: 20181213162727.17438-3-lvivier@redhat.com
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      ed2a66de
    • L
      block/ssh: Convert from DPRINTF() macro to trace events · 023908a2
      Laurent Vivier 提交于
      Signed-off-by: NLaurent Vivier <lvivier@redhat.com>
      Reviewed-by: NRichard W.M. Jones <rjones@redhat.com>
      Reviewed-by: NPhilippe Mathieu-Daudé <philmd@redhat.com>
      Message-id: 20181213162727.17438-2-lvivier@redhat.com
      [mreitz: Fixed type of ssh_{read,write}_return's parameter to be ssize_t
               instead of size_t]
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      023908a2
    • V
      scripts: add render_block_graph function for QEMUMachine · dc2b651a
      Vladimir Sementsov-Ogievskiy 提交于
      Render block nodes graph with help of graphviz. This new function is
      for debugging, so there is no sense to put it into qemu.py as a method
      of QEMUMachine. Let's instead put it separately.
      Signed-off-by: NVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
      Acked-by: NEduardo Habkost <ehabkost@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Message-id: 20181221170909.25584-3-vsementsov@virtuozzo.com
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      dc2b651a
    • V
      qapi: add x-debug-query-block-graph · 5d3b4e99
      Vladimir Sementsov-Ogievskiy 提交于
      Add a new command, returning block nodes (and their users) graph.
      Signed-off-by: NVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
      Message-id: 20181221170909.25584-2-vsementsov@virtuozzo.com
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      5d3b4e99
  3. 30 1月, 2019 10 次提交