vhost/scsi: do not fail scsi_dev_add_tgt() if hotplug is not supported
Print an error message instead. The driver can still do a manual rescan if it wants to see the new SCSI target. Change-Id: Ieb76ada8625bf00ad068a791b860e4b08ad5cb83 Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com> Reviewed-on: https://review.gerrithub.io/417268 Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com> Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
5aa5f3dc22
commit
2470278c92
@ -202,9 +202,9 @@ int spdk_vhost_scsi_dev_construct(const char *name, const char *cpumask);
|
||||
* LUN0 associated with given SPDK bdev. Currently only one LUN per
|
||||
* device is supported.
|
||||
*
|
||||
* If vhost SCSI device has an active socket connection, it is
|
||||
* required that it has negotiated \c VIRTIO_SCSI_F_HOTPLUG feature
|
||||
* flag. Otherwise an -ENOTSUP error code is returned.
|
||||
* If the vhost SCSI device has an active connection and has negotiated
|
||||
* \c VIRTIO_SCSI_F_HOTPLUG feature, the new SCSI target should be
|
||||
* automatically detected by the other side.
|
||||
*
|
||||
* \param vdev vhost SCSI device.
|
||||
* \param scsi_tgt_num slot to attach to.
|
||||
|
@ -823,11 +823,6 @@ spdk_vhost_scsi_dev_add_tgt(struct spdk_vhost_dev *vdev, unsigned scsi_tgt_num,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (vdev->lcore != -1 && !spdk_vhost_dev_has_feature(vdev, VIRTIO_SCSI_F_HOTPLUG)) {
|
||||
SPDK_ERRLOG("Controller %s is in use and hotplug is not supported\n", vdev->name);
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
if (svdev->scsi_dev[scsi_tgt_num] != NULL) {
|
||||
SPDK_ERRLOG("Controller %s target %u already occupied\n", vdev->name, scsi_tgt_num);
|
||||
return -EEXIST;
|
||||
@ -852,13 +847,25 @@ spdk_vhost_scsi_dev_add_tgt(struct spdk_vhost_dev *vdev, unsigned scsi_tgt_num,
|
||||
}
|
||||
spdk_scsi_dev_add_port(svdev->scsi_dev[scsi_tgt_num], 0, "vhost");
|
||||
|
||||
if (vdev->lcore != -1) {
|
||||
spdk_scsi_dev_allocate_io_channels(svdev->scsi_dev[scsi_tgt_num]);
|
||||
eventq_enqueue(svdev, scsi_tgt_num, VIRTIO_SCSI_T_TRANSPORT_RESET, VIRTIO_SCSI_EVT_RESET_RESCAN);
|
||||
}
|
||||
|
||||
SPDK_INFOLOG(SPDK_LOG_VHOST, "Controller %s: defined target '%s' using bdev '%s'\n",
|
||||
vdev->name, target_name, bdev_name);
|
||||
|
||||
if (vdev->lcore == -1) {
|
||||
/* All done. */
|
||||
return 0;
|
||||
}
|
||||
|
||||
spdk_scsi_dev_allocate_io_channels(svdev->scsi_dev[scsi_tgt_num]);
|
||||
|
||||
if (spdk_vhost_dev_has_feature(vdev, VIRTIO_SCSI_F_HOTPLUG)) {
|
||||
eventq_enqueue(svdev, scsi_tgt_num, VIRTIO_SCSI_T_TRANSPORT_RESET,
|
||||
VIRTIO_SCSI_EVT_RESET_RESCAN);
|
||||
} else {
|
||||
SPDK_NOTICELOG("Device %s does not support hotplug. "
|
||||
"Please restart the driver or perform a rescan.\n",
|
||||
vdev->name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user