1. 22 4月, 2013 2 次提交
  2. 09 4月, 2013 1 次提交
    • P
      hw: move headers to include/ · 0d09e41a
      Paolo Bonzini 提交于
      Many of these should be cleaned up with proper qdev-/QOM-ification.
      Right now there are many catch-all headers in include/hw/ARCH depending
      on cpu.h, and this makes it necessary to compile these files per-target.
      However, fixing this does not belong in these patches.
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      0d09e41a
  3. 23 3月, 2013 1 次提交
  4. 06 3月, 2013 2 次提交
    • P
      iscsi: add iscsi_truncate support · cb1b83e7
      Peter Lieven 提交于
      this patch adds iscsi_truncate which effectively allows for
      online resizing of iscsi volumes. for this to work you have
      to resize the volume on your storage and then call
      block_resize command in qemu which will issue a
      readcapacity16 to update the capacity.
      
      v4:
        - factor out complete readcapacity logic into a separate function
        - handle capacity change check condition in readcapacity function
          (this happens if the block_resize cmd is the first iscsi task
          executed after a resize on the storage)
      
      v3:
        - remove switch statement in iscsi_open
        - create separate patch for brdv_drain_all() in bdrv_truncate()
      
      v2:
        - add a general bdrv_drain_all() before bdrv_truncate() to avoid
          in-flight AIOs while the device is truncated
        - since no AIOs are in flight we can use a sync libiscsi call
          to re-read the capacity
        - factor out the readcapacity16 logic as it is redundant
          to iscsi_open() and iscsi_truncate().
      Signed-off-by: NPeter Lieven <pl@kamp.de>
      [allow any type of unit attention check condition in iscsi_readcapacity_sync(),
       as in Message-ID: <51263A2A.6070304@dlhnet.de> - Paolo]
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      cb1b83e7
    • P
      iscsi: retry read, write, flush and unmap on unit attention check conditions · 1dde716e
      Peter Lieven 提交于
      the storage might return a check condition status for various reasons.
      (e.g. bus reset, capacity change, thin-provisioning info etc.)
      
      currently all these informative status responses lead to an I/O error
      which is populated to the guest. this patch introduces a retry mechanism
      to avoid this.
      Signed-off-by: NPeter Lieven <pl@kamp.de>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      1dde716e
  5. 24 1月, 2013 2 次提交
  6. 22 1月, 2013 3 次提交
  7. 13 1月, 2013 1 次提交
  8. 19 12月, 2012 3 次提交
  9. 28 11月, 2012 3 次提交
  10. 15 11月, 2012 1 次提交
  11. 24 9月, 2012 1 次提交
  12. 21 9月, 2012 2 次提交
  13. 28 8月, 2012 1 次提交
    • R
      iscsi: Set number of blocks to 0 for blank CDROM devices · 135b9088
      Ronnie Sahlberg 提交于
      The number of blocks of the device is used to compute the device size
      in bdrv_getlength()/iscsi_getlength().
      For MMC devices, the ReturnedLogicalBlockAddress in the READCAPACITY10
      has a special meaning when it is 0.
      In this case it does not mean that LBA 0 is the last accessible LBA,
      and thus the device has 1 readable block, but instead it means that the
      disc is blank and there are no readable blocks.
      
      This change ensures that when the iSCSI LUN is loaded with a blank
      DVD-R disk or similar that bdrv_getlength() will return the correct
      size of the device as 0 bytes.
      Signed-off-by: NRonnie Sahlberg <ronniesahlberg@gmail.com>
      135b9088
  14. 20 8月, 2012 4 次提交
    • P
      iscsi: fix races between task completion and abort · 1bd075f2
      Paolo Bonzini 提交于
      This patch fixes two main issues with block/iscsi.c:
      
      1) iscsi_task_mgmt_abort_task_async calls iscsi_scsi_task_cancel which
      was also directly called in iscsi_aio_cancel
      
      2) a race between task completion and task abortion could happen cause
      the scsi_free_scsi_task were done before iscsi_schedule_bh has finished.
      To fix this, all the freeing of IscsiTasks and releasing of the AIOCBs
      is centralized in iscsi_bh_cb, independent of whether the SCSI command
      has completed or was cancelled.
      
      3) iscsi_aio_cancel was not synchronously waiting for the end of the
      command.
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      1bd075f2
    • P
      iscsi: simplify iscsi_schedule_bh · cfb3f506
      Paolo Bonzini 提交于
      It is always used with the same callback, remove the argument.  And
      its return value is never used, assume allocation succeeds.
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      cfb3f506
    • P
      iscsi: move iscsi_schedule_bh and iscsi_readv_writev_bh_cb · 27cbd828
      Paolo Bonzini 提交于
      Put these functions at the beginning, to avoid forward references
      in the next patches.
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      27cbd828
    • P
      Revert "iscsi: Fix NULL dereferences / races between task completion and abort" · b2090919
      Paolo Bonzini 提交于
      This reverts commit 64e69e80.  The commit
      returned immediately from iscsi_aio_cancel, risking corruption in case the
      following happens:
      
          guest                  qemu                 target
        =========================================================================
          send write 1 -------->
                                 send write 1 -------->
          cancel write 1 ------>
                                 cancel write 1 ------>
             <------------------ cancellation processed
          send write 2 -------->
                                 send write 2 -------->
                                     <---------------- completed write 2
             <------------------ completed write 2
                                     <---------------- completed write 1
                                     <---------------- cancellation not done
      
      Here, the guest would see write 2 superseding write 1, when in fact the
      outcome could have been the opposite.  The right behavior is to return
      only after the target says whether the cancellation was done or not, and
      it will be implemented by the next three patches.
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      b2090919
  15. 15 8月, 2012 1 次提交
  16. 09 8月, 2012 1 次提交
    • R
      iscsi: Pick default initiator-name based on the name of the VM · 31459f46
      Ronnie Sahlberg 提交于
      This patch updates the iscsi layer to automatically pick a 'unique'
      initiator-name based on the name of the vm in case the user has not set
      an explicit iqn-name to use.
      
      Create a new function qemu_get_vm_name() that returns the name of the VM,
      if specified.
      
      This way we can thus create default names to use as the initiator name
      based on the guest session.
      
      If the VM is not named via the '-name' command line argument, the iscsi
      initiator-name used wiull simply be
      
          iqn.2008-11.org.linux-kvm
      
      If a name for the VM was specified with the '-name' option, iscsi will
      use a default initiatorname of
      
          iqn.2008-11.org.linux-kvm:<name>
      
      These names are just the default iscsi initiator name that qemu will
      generate/use only when the user has not set an explicit initiator name
      via the commandlines or config files.
      Signed-off-by: NRonnie Sahlberg <ronniesahlberg@gmail.com>
      31459f46
  17. 08 8月, 2012 2 次提交
  18. 02 7月, 2012 2 次提交
    • R
      ISCSI: force use of sg for SMC and SSC devices · 622695a4
      Ronnie Sahlberg 提交于
      If the device we open is a SMC or SSC device, then force the use of sg. We
      dont have any medium changer or tape emulation so only passthrough via
      real sg or scsi-generic via iscsi would work anyway.
      
      Forcing sg also makes qemu skip trying to read from the device to guess
      the image format by reading from the device (find_image_format()).
      SMC devices do not implement READ6/10/12/16 so it is not possible to
      read from them (SSC have different CDBs).
      
      With this patch I can successfully manage a SMC device wiht iscsi in
      passthrough mode.
      Signed-off-by: NRonnie Sahlberg <ronniesahlberg@gmail.com>
      [Added TYPE_TAPE handling - Paolo]
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      622695a4
    • R
      ISCSI: Add SCSI passthrough via scsi-generic to libiscsi · 98392453
      Ronnie Sahlberg 提交于
      Update iscsi to allow passthrough of SG_IO scsi commands when the iscsi
      device is forced to be scsi-generic.
      
      Implement both bdrv_ioctl() and bdrv_aio_ioctl() in the iscsi backend,
      emulate the SG_IO ioctl and pass the SCSI commands across to the
      iscsi target.
      
      This allows end-to-end passthrough of SCSI all the way from the guest,
      to qemu, via scsi-generic, then libiscsi all the way to the iscsi target.
      
      To activate this you need to specify that the iscsi lun should be treated
      as a scsi-generic device.
      
      Example:
          -device lsi -device scsi-generic,drive=MyISCSI \
          -drive file=iscsi://10.1.1.125/iqn.ronnie.test/1,if=none,id=MyISCSI
      
      Note, you can currently not boot a qemu guest from a scsi device.
      
      Note,
      This only works when the host is linux, since the emulation relies on
      definitions of SG_IO from the scsi-generic implementation in the
      linux kernel.
      It should be fairly easy to re-implement some structures similar enough
      for non-linux hosts to do the same style of passthrough via a fake
      scsi generic layer and libiscsi if need be.
      Signed-off-by: NRonnie Sahlberg <ronniesahlberg@gmail.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      98392453
  19. 12 6月, 2012 1 次提交
  20. 28 5月, 2012 5 次提交
  21. 04 5月, 2012 1 次提交
    • R
      ISCSI: Add support for thin-provisioning via discard/UNMAP and bigger LUNs · fa6acb0c
      Ronnie Sahlberg 提交于
      Update the configure test for libiscsi support to detect version 1.3
      or later.  Version 1.3 of libiscsi provides both READCAPACITY16 as well
      as UNMAP commands.
      
      Update the iscsi block layer to use READCAPACITY16 to detect the size of
      the LUN instead of READCAPACITY10. This allows support for LUNs larger
      than 2TB.
      
      Update to implement bdrv_aio_discard() using the UNMAP command.
      This allows us to use thin-provisioned LUNs from TGTD and other iSCSI
      targets that support thin-provisioning.
      Signed-off-by: NRonnie Sahlberg <ronniesahlberg@gmail.com>
      [squashed in subsequent patch from Ronnie to fix off-by-one in LBA count]
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      fa6acb0c