1. 28 7月, 2020 10 次提交
    • V
      block/nbd: split nbd_establish_connection out of nbd_client_connect · fa35591b
      Vladimir Sementsov-Ogievskiy 提交于
      We are going to implement non-blocking version of
      nbd_establish_connection, which for a while will be used only for
      nbd_reconnect_attempt, not for nbd_open, so we need to call it
      separately.
      
      Refactor nbd_reconnect_attempt in a way which makes next commit
      simpler.
      Signed-off-by: NVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
      Message-Id: <20200727184751.15704-2-vsementsov@virtuozzo.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NEric Blake <eblake@redhat.com>
      fa35591b
    • N
      iotests: Test convert to qcow2 compressed to NBD · 03a970bb
      Nir Soffer 提交于
      Add test for "qemu-img convert -O qcow2 -c" to NBD target. The tests    
      create a OVA file and write compressed qcow2 disk content directly into
      the OVA file via qemu-nbd.
      Signed-off-by: NNir Soffer <nsoffer@redhat.com>
      Message-Id: <20200727215846.395443-5-nsoffer@redhat.com>
      Tested-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NEric Blake <eblake@redhat.com>
      03a970bb
    • N
      iotests: Add more qemu_img helpers · 4b914b01
      Nir Soffer 提交于
      Add 2 helpers for measuring and checking images:
      - qemu_img_measure()
      - qemu_img_check()
      
      Both use --output-json and parse the returned json to make easy to use
      in other tests. I'm going to use them in a new test, and I hope they
      will be useful in may other tests.
      Signed-off-by: NNir Soffer <nsoffer@redhat.com>
      Message-Id: <20200727215846.395443-4-nsoffer@redhat.com>
      Reviewed-by: NVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
      Signed-off-by: NEric Blake <eblake@redhat.com>
      4b914b01
    • N
      iotests: Make qemu_nbd_popen() a contextmanager · b7719bca
      Nir Soffer 提交于
      Instead of duplicating the code to wait until the server is ready and
      remember to terminate the server and wait for it, make it possible to
      use like this:
      
          with qemu_nbd_popen('-k', sock, image):
              # Access image via qemu-nbd socket...
      
      Only test 264 used this helper, but I had to modify the output since it
      did not consistently when starting and stopping qemu-nbd.
      Signed-off-by: NNir Soffer <nsoffer@redhat.com>
      Message-Id: <20200727215846.395443-3-nsoffer@redhat.com>
      Reviewed-by: NVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
      Signed-off-by: NEric Blake <eblake@redhat.com>
      b7719bca
    • N
      block: nbd: Fix convert qcow2 compressed to nbd · a2b333c0
      Nir Soffer 提交于
      When converting to qcow2 compressed format, the last step is a special
      zero length compressed write, ending in a call to bdrv_co_truncate(). This
      call always fails for the nbd driver since it does not implement
      bdrv_co_truncate().
      
      For block devices, which have the same limits, the call succeeds since
      the file driver implements bdrv_co_truncate(). If the caller asked to
      truncate to the same or smaller size with exact=false, the truncate
      succeeds. Implement the same logic for nbd.
      
      Example failing without this change:
      
      In one shell start qemu-nbd:
      
      $ truncate -s 1g test.tar
      $ qemu-nbd --socket=/tmp/nbd.sock --persistent --format=raw --offset 1536 test.tar
      
      In another shell convert an image to qcow2 compressed via NBD:
      
      $ echo "disk data" > disk.raw
      $ truncate -s 1g disk.raw
      $ qemu-img convert -f raw -O qcow2 -c disk1.raw nbd+unix:///?socket=/tmp/nbd.sock; echo $?
      1
      
      qemu-img failed, but the conversion was successful:
      
      $ qemu-img info nbd+unix:///?socket=/tmp/nbd.sock
      image: nbd+unix://?socket=/tmp/nbd.sock
      file format: qcow2
      virtual size: 1 GiB (1073741824 bytes)
      ...
      
      $ qemu-img check nbd+unix:///?socket=/tmp/nbd.sock
      No errors were found on the image.
      1/16384 = 0.01% allocated, 100.00% fragmented, 100.00% compressed clusters
      Image end offset: 393216
      
      $ qemu-img compare disk.raw nbd+unix:///?socket=/tmp/nbd.sock
      Images are identical.
      
      Fixes: https://bugzilla.redhat.com/1860627Signed-off-by: NNir Soffer <nsoffer@redhat.com>
      Message-Id: <20200727215846.395443-2-nsoffer@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
      [eblake: typo fixes]
      Signed-off-by: NEric Blake <eblake@redhat.com>
      a2b333c0
    • E
      nbd: Fix large trim/zero requests · 890cbccb
      Eric Blake 提交于
      Although qemu as NBD client limits requests to <2G, the NBD protocol
      allows clients to send requests almost all the way up to 4G.  But
      because our block layer is not yet 64-bit clean, we accidentally wrap
      such requests into a negative size, and fail with EIO instead of
      performing the intended operation.
      
      The bug is visible in modern systems with something as simple as:
      
      $ qemu-img create -f qcow2 /tmp/image.img 5G
      $ sudo qemu-nbd --connect=/dev/nbd0 /tmp/image.img
      $ sudo blkdiscard /dev/nbd0
      
      or with user-space only:
      
      $ truncate --size=3G file
      $ qemu-nbd -f raw file
      $ nbdsh -u nbd://localhost:10809 -c 'h.trim(3*1024*1024*1024,0)'
      
      Although both blk_co_pdiscard and blk_pwrite_zeroes currently return 0
      on success, this is also a good time to fix our code to a more robust
      paradigm that treats all non-negative values as success.
      
      Alas, our iotests do not currently make it easy to add external
      dependencies on blkdiscard or nbdsh, so we have to rely on manual
      testing for now.
      
      This patch can be reverted when we later improve the overall block
      layer to be 64-bit clean, but for now, a minimal fix was deemed less
      risky prior to release.
      
      CC: qemu-stable@nongnu.org
      Fixes: 1f4d6d18
      Fixes: 1c6c4bb7
      Fixes: https://github.com/systemd/systemd/issues/16242Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <20200722212231.535072-1-eblake@redhat.com>
      Reviewed-by: NVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
      [eblake: rework success tests to use >=0]
      890cbccb
    • P
      Merge remote-tracking branch 'remotes/mcayland/tags/qemu-openbios-20200727' into staging · 1b242c3b
      Peter Maydell 提交于
      qemu-openbios queue
      
      # gpg: Signature made Mon 27 Jul 2020 16:09:34 BST
      # gpg:                using RSA key CC621AB98E82200D915CC9C45BC2C56FAE0F321F
      # gpg:                issuer "mark.cave-ayland@ilande.co.uk"
      # gpg: Good signature from "Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>" [full]
      # Primary key fingerprint: CC62 1AB9 8E82 200D 915C  C9C4 5BC2 C56F AE0F 321F
      
      * remotes/mcayland/tags/qemu-openbios-20200727:
        Update OpenBIOS images to 7f28286f built from submodule.
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      1b242c3b
    • P
      Merge remote-tracking branch 'remotes/maxreitz/tags/pull-block-2020-07-27' into staging · 23ae2878
      Peter Maydell 提交于
      Block patches for 5.1:
      - Coverity fix
      - iotests fix for rx and avr
      - iotests fix for qcow2 -o compat=0.10
      
      # gpg: Signature made Mon 27 Jul 2020 15:36:23 BST
      # gpg:                using RSA key 91BEB60A30DB3E8857D11829F407DB0061D5CF40
      # gpg:                issuer "mreitz@redhat.com"
      # gpg: Good signature from "Max Reitz <mreitz@redhat.com>" [full]
      # Primary key fingerprint: 91BE B60A 30DB 3E88 57D1  1829 F407 DB00 61D5 CF40
      
      * remotes/maxreitz/tags/pull-block-2020-07-27:
        iotests/197: Fix for compat=0.10
        iotests: Select a default machine for the rx and avr targets
        block/amend: Check whether the node exists
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      23ae2878
    • P
      Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging · 93ea4843
      Peter Maydell 提交于
      virtio,pci: bugfixes
      
      Minor bugfixes all over the places, including one CVE.
      
      Additionally, a fix for an ancient bug in migration -
      one has to wonder how come no one noticed.
      
      The fix is also non-trivial since we dare not break all
      existing machine types with pci - we have a work around
      in the works, for now we just skip the work-around for
      old machine types.
      
      Great job by Hogan Wang noticing, debugging and fixing it,
      and thanks to Dr. David Alan Gilbert for reviewing the patches.
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      
      # gpg: Signature made Mon 27 Jul 2020 16:34:58 BST
      # gpg:                using RSA key 5D09FD0871C8F85B94CA8A0D281F0DB8D28D5469
      # gpg:                issuer "mst@redhat.com"
      # gpg: Good signature from "Michael S. Tsirkin <mst@kernel.org>" [full]
      # gpg:                 aka "Michael S. Tsirkin <mst@redhat.com>" [full]
      # Primary key fingerprint: 0270 606B 6F3C DF3D 0B17  0970 C350 3912 AFBE 8E67
      #      Subkey fingerprint: 5D09 FD08 71C8 F85B 94CA  8A0D 281F 0DB8 D28D 5469
      
      * remotes/mst/tags/for_upstream:
        virtio-pci: fix virtio_pci_queue_enabled()
        MAINTAINERS: Cover the firmware JSON schema
        vhost-vdpa :Fix Coverity CID 1430270 / CID 1420267
        libvhost-user: Report descriptor index on panic
        Fix vhost-user buffer over-read on ram hot-unplug
        hw/pci-host: save/restore pci host config register
        virtio-mem-pci: force virtio version 1
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      93ea4843
    • P
      Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20200727' into staging · 9303ecb6
      Peter Maydell 提交于
      fixes for protected virtualization and loadparm handling
      
      # gpg: Signature made Mon 27 Jul 2020 15:01:32 BST
      # gpg:                using RSA key C3D0D66DC3624FF6A8C018CEDECF6B93C6F02FAF
      # gpg:                issuer "cohuck@redhat.com"
      # gpg: Good signature from "Cornelia Huck <conny@cornelia-huck.de>" [marginal]
      # gpg:                 aka "Cornelia Huck <huckc@linux.vnet.ibm.com>" [full]
      # gpg:                 aka "Cornelia Huck <cornelia.huck@de.ibm.com>" [full]
      # gpg:                 aka "Cornelia Huck <cohuck@kernel.org>" [marginal]
      # gpg:                 aka "Cornelia Huck <cohuck@redhat.com>" [marginal]
      # Primary key fingerprint: C3D0 D66D C362 4FF6 A8C0  18CE DECF 6B93 C6F0 2FAF
      
      * remotes/cohuck/tags/s390x-20200727:
        s390x/s390-virtio-ccw: fix loadparm property getter
        s390x/protvirt: allow to IPL secure guests with -no-reboot
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      9303ecb6
  2. 27 7月, 2020 30 次提交