1. 17 2月, 2016 1 次提交
    • D
      nbd: convert block client to use I/O channels for connection setup · 064097d9
      Daniel P. Berrange 提交于
      This converts the NBD block driver client to use the QIOChannelSocket
      class for initial connection setup. The NbdClientSession struct has
      two pointers, one to the master QIOChannelSocket providing the raw
      data channel, and one to a QIOChannel which is the current channel
      used for I/O. Initially the two point to the same object, but when
      TLS support is added, they will point to different objects.
      
      The qemu-img & qemu-io tools now need to use MODULE_INIT_QOM to
      ensure the QIOChannel object classes are registered. The qemu-nbd
      tool already did this.
      
      In this initial conversion though, all I/O is still actually done
      using the raw POSIX sockets APIs.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      Message-Id: <1455129674-17255-4-git-send-email-berrange@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      064097d9
  2. 20 1月, 2016 1 次提交
  3. 18 12月, 2015 1 次提交
  4. 02 11月, 2015 1 次提交
    • E
      block: Convert to new qapi union layout · 6a8f9661
      Eric Blake 提交于
      We have two issues with our qapi union layout:
      1) Even though the QMP wire format spells the tag 'type', the
      C code spells it 'kind', requiring some hacks in the generator.
      2) The C struct uses an anonymous union, which places all tag
      values in the same namespace as all non-variant members. This
      leads to spurious collisions if a tag value matches a non-variant
      member's name.
      
      Make the conversion to the new layout for block-related code.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1445898903-12082-16-git-send-email-eblake@redhat.com>
      [Commit message tweaked slightly]
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      6a8f9661
  5. 25 9月, 2015 1 次提交
  6. 18 3月, 2015 1 次提交
  7. 10 3月, 2015 1 次提交
  8. 26 2月, 2015 1 次提交
  9. 16 2月, 2015 1 次提交
    • M
      nbd: Drop BDS backpointer · f53a829b
      Max Reitz 提交于
      Before this patch, the "opaque" pointer in an NBD BDS points to a
      BDRVNBDState, which contains an NbdClientSession object, which in turn
      contains a pointer to the BDS. This pointer may become invalid due to
      bdrv_swap(), so drop it, and instead pass the BDS directly to the
      nbd-client.c functions which then retrieve the NbdClientSession object
      from there.
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      Reviewed-by: NPaolo Bonzini <pbonzini@redhat.com>
      Message-id: 1423256778-3340-2-git-send-email-mreitz@redhat.com
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      f53a829b
  10. 07 2月, 2015 2 次提交
    • D
      nbd: fix max_discard/max_transfer_length · fa21e6fa
      Denis V. Lunev 提交于
      nbd_co_discard calls nbd_client_session_co_discard which uses uint32_t
      as the length in bytes of the data to discard due to the following
      definition:
      
      struct nbd_request {
          uint32_t magic;
          uint32_t type;
          uint64_t handle;
          uint64_t from;
          uint32_t len; <-- the length of data to be discarded, in bytes
      } QEMU_PACKED;
      
      Thus we should limit bl_max_discard to UINT32_MAX >> BDRV_SECTOR_BITS to
      avoid overflow.
      
      NBD read/write code uses the same structure for transfers. Fix
      max_transfer_length accordingly.
      Signed-off-by: NDenis V. Lunev <den@openvz.org>
      CC: Peter Lieven <pl@kamp.de>
      CC: Kevin Wolf <kwolf@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      fa21e6fa
    • M
      nbd: Improve error messages · 1ce52846
      Max Reitz 提交于
      This patch makes use of the Error object for nbd_receive_negotiate() so
      that errors during negotiation look nicer.
      
      Furthermore, this patch adds an additional error message if the received
      magic was wrong, but would be correct for the other protocol version,
      respectively: So if an export name was specified, but the NBD server
      magic corresponds to an old handshake, this condition is explicitly
      signaled to the user, and vice versa.
      
      As these messages are now part of the "Could not open image" error
      message, additional filtering has to be employed in iotest 083, which
      this patch does as well.
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      Reviewed-by: NPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      1ce52846
  11. 20 10月, 2014 1 次提交
    • M
      nbd: Fix filename generation · ec0de768
      Max Reitz 提交于
      Export names may be used with nbd+unix, too, fix nbd_refresh_filename()
      accordingly. Also, for nbd+tcp, the documented path schema is
      "nbd://host[:port]/export", so use it. Furthermore, as can be seen from
      that schema, the port is optional.
      
      That makes six single cases for how the filename can be formatted; it is
      not easy to generalize these cases without the resulting statement being
      completely unreadable, thus there is simply one snprintf() per case.
      
      Finally, taking the options from BDRVNBDState::socket_opts is wrong,
      because those will not contain the export name. Just use
      BlockDriverState::options instead.
      Reported-by: NStefan Hajnoczi <stefanha@redhat.com>
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      Reviewed-by: NPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      ec0de768
  12. 20 8月, 2014 1 次提交
  13. 04 6月, 2014 1 次提交
  14. 26 4月, 2014 1 次提交
  15. 22 2月, 2014 2 次提交
    • P
      nbd: correctly propagate errors · 77e8b9ca
      Paolo Bonzini 提交于
      Before:
          $ ./qemu-io-old
          qemu-io-old> open -r -o file.driver=nbd
          one of path and host must be specified.
          qemu-io-old: can't open device (null): Could not open image: Invalid argument
          $ ./qemu-io-old
          qemu-io-old> open -r -o file.driver=nbd,file.host=foo,file.path=bar
          path and host may not be used at the same time.
          qemu-io-old: can't open device (null): Could not open image: Invalid argument
      
      After:
          $ ./qemu-io
          qemu-io> open -r -o file.driver=nbd
          qemu-io: can't open device (null): one of path and host must be specified.
          $ ./qemu-io
          qemu-io> open -r -o file.driver=nbd,file.host=foo,file.path=bar
          qemu-io: can't open device (null): path and host may not be used at the same time.
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      Reviewed-by: NFam Zheng <famz@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      77e8b9ca
    • P
      nbd: produce a better error if neither host nor port is passed · a69d9af4
      Paolo Bonzini 提交于
      Before:
          $ qemu-io-old
          qemu-io-old> open -r -o file.driver=nbd
          qemu-io-old: can't open device (null): Could not open image: Invalid argument
          $ ./qemu-io-old
          qemu-io-old> open -r -o file.driver=nbd,file.host=foo,file.path=bar
          path and host may not be used at the same time.
          qemu-io-old: can't open device (null): Could not open image: Invalid argument
      
      After:
          $ ./qemu-io
          qemu-io> open -r -o file.driver=nbd
          one of path and host must be specified.
          qemu-io: can't open device (null): Could not open image: Invalid argument
          $ ./qemu-io
          qemu-io> open -r -o file.driver=nbd,file.host=foo,file.path=bar
          path and host may not be used at the same time.
          qemu-io: can't open device (null): Could not open image: Invalid argument
      
      Next patch will fix the error propagation.
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      Reviewed-by: NFam Zheng <famz@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      a69d9af4
  16. 18 2月, 2014 1 次提交
  17. 07 1月, 2014 1 次提交
  18. 16 12月, 2013 2 次提交
  19. 12 9月, 2013 1 次提交
  20. 19 8月, 2013 2 次提交
  21. 18 6月, 2013 1 次提交
  22. 12 5月, 2013 1 次提交
  23. 22 4月, 2013 1 次提交
  24. 15 4月, 2013 3 次提交
  25. 02 4月, 2013 1 次提交
  26. 23 3月, 2013 6 次提交
  27. 19 12月, 2012 2 次提交
  28. 12 11月, 2012 1 次提交