vhost-scsi: use spdk_vhost_scsi_dev_get_tgt while dumping JSON config
This is already done for JSON info dump. In addition, the spdk_vhost_scsi_dev_get_tgt function might implement additional logic to no return SCSI targets under removal process. Change-Id: I21d6f660926091dfd34da553705116926f27b30d Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/446910 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
3704b949fa
commit
e80efe8f61
@ -1458,12 +1458,11 @@ spdk_vhost_scsi_dump_info_json(struct spdk_vhost_dev *vdev, struct spdk_json_wri
|
||||
static void
|
||||
spdk_vhost_scsi_write_config_json(struct spdk_vhost_dev *vdev, struct spdk_json_write_ctx *w)
|
||||
{
|
||||
struct spdk_vhost_scsi_dev *svdev;
|
||||
struct spdk_scsi_dev *scsi_dev;
|
||||
struct spdk_scsi_lun *lun;
|
||||
uint32_t i;
|
||||
|
||||
svdev = to_scsi_dev(vdev);
|
||||
if (!svdev) {
|
||||
if (to_scsi_dev(vdev) == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1477,12 +1476,13 @@ spdk_vhost_scsi_write_config_json(struct spdk_vhost_dev *vdev, struct spdk_json_
|
||||
|
||||
spdk_json_write_object_end(w);
|
||||
|
||||
for (i = 0; i < SPDK_COUNTOF(svdev->scsi_dev_state); i++) {
|
||||
if (svdev->scsi_dev_state[i].dev == NULL || svdev->scsi_dev_state[i].removed) {
|
||||
for (i = 0; i < SPDK_VHOST_SCSI_CTRLR_MAX_DEVS; i++) {
|
||||
scsi_dev = spdk_vhost_scsi_dev_get_tgt(vdev, i);
|
||||
if (scsi_dev == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
lun = spdk_scsi_dev_get_lun(svdev->scsi_dev_state[i].dev, 0);
|
||||
lun = spdk_scsi_dev_get_lun(scsi_dev, 0);
|
||||
|
||||
spdk_json_write_object_begin(w);
|
||||
spdk_json_write_named_string(w, "method", "add_vhost_scsi_lun");
|
||||
|
Loading…
x
Reference in New Issue
Block a user