1. 22 1月, 2013 1 次提交
  2. 19 12月, 2012 3 次提交
  3. 28 11月, 2012 3 次提交
  4. 15 11月, 2012 1 次提交
  5. 24 9月, 2012 1 次提交
  6. 21 9月, 2012 2 次提交
  7. 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
  8. 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
  9. 15 8月, 2012 1 次提交
  10. 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
  11. 08 8月, 2012 2 次提交
  12. 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
  13. 12 6月, 2012 1 次提交
  14. 28 5月, 2012 5 次提交
  15. 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
  16. 19 4月, 2012 1 次提交
  17. 09 2月, 2012 1 次提交
    • R
      iSCSI: add configuration variables for iSCSI · f9dadc98
      Ronnie Sahlberg 提交于
      This patch adds configuration variables for iSCSI to set
      initiator-name to use when logging in to the target,
      which type of header-digest to negotiate with the target
      and username and password for CHAP authentication.
      
      This allows specifying a initiator-name either from the command line
      -iscsi initiator-name=iqn.2004-01.com.example:test
      or from a configuration file included with -readconfig
          [iscsi]
            initiator-name = iqn.2004-01.com.example:test
            header-digest = CRC32C|CRC32C-NONE|NONE-CRC32C|NONE
            user = CHAP username
            password = CHAP password
      
      If you use several different targets, you can also configure this on a per
      target basis by using a group name:
          [iscsi "iqn.target.name"]
          ...
      
      The configuration file can be read using -readconfig.
      Example :
      qemu-system-i386 -drive file=iscsi://127.0.0.1/iqn.ronnie.test/1
       -readconfig iscsi.conf
      Signed-off-by: NRonnie Sahlberg <ronniesahlberg@gmail.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      f9dadc98
  18. 29 10月, 2011 1 次提交
    • R
      iSCSI block driver · c589b249
      Ronnie Sahlberg 提交于
      This provides built-in support for iSCSI to QEMU.
      
      This has the advantage that the iSCSI devices need not be made visible to the host, which is useful if you have very many virtual machines and very many iscsi devices.
      It also has the benefit that non-root users of QEMU can access iSCSI devices across the network without requiring root privilege on the host.
      
      This driver interfaces with the multiplatform posix library for iscsi initiator/client access to iscsi devices hosted at
          git://github.com/sahlberg/libiscsi.git
      
      The patch adds the driver to interface with the iscsi library.
      It also updated the configure script to
      * by default, probe is libiscsi is available and if so, build
        qemu against libiscsi.
      * --enable-libiscsi
        Force a build against libiscsi. If libiscsi is not available
        the build will fail.
      * --disable-libiscsi
        Do not link against libiscsi, even if it is available.
      
      When linked with libiscsi, qemu gains support to access iscsi resources such as disks and cdrom directly, without having to make the devices visible to the host.
      
      You can specify devices using a iscsi url of the form :
      iscsi://[<username>[:<password>@]]<host>[:<port]/<target-iqn-name>/<lun>
      When using authentication, the password can optionally be set with
      LIBISCSI_CHAP_PASSWORD="password" to avoid it showing up in the process list
      Signed-off-by: NRonnie Sahlberg <ronniesahlberg@gmail.com>
      Reviewed-by: NStefan Hajnoczi <stefanha@linux.vnet.ibm.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      c589b249