vhost_rpc:add sessions information for vhost_get_controllers
we can get sessions information by vhost_get_controllers Signed-off-by: zhipeng Lu <luzhipeng@cestc.cn> Change-Id: I8e63aea64d02b3467a62f30a712e1dcbf6fb8854 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16315 Reviewed-by: Jim Harris <james.r.harris@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com> Community-CI: Mellanox Build Bot
This commit is contained in:
parent
a4a73fec9c
commit
216991edec
@ -1956,3 +1956,24 @@ vhost_user_fini(spdk_vhost_fini_cb vhost_cb)
|
||||
}
|
||||
pthread_detach(tid);
|
||||
}
|
||||
|
||||
void
|
||||
vhost_session_info_json(struct spdk_vhost_dev *vdev, struct spdk_json_write_ctx *w)
|
||||
{
|
||||
struct spdk_vhost_session *vsession;
|
||||
struct spdk_vhost_user_dev *user_dev;
|
||||
|
||||
user_dev = to_user_dev(vdev);
|
||||
pthread_mutex_lock(&user_dev->lock);
|
||||
TAILQ_FOREACH(vsession, &user_dev->vsessions, tailq) {
|
||||
spdk_json_write_object_begin(w);
|
||||
spdk_json_write_named_uint32(w, "vid", vsession->vid);
|
||||
spdk_json_write_named_uint32(w, "id", vsession->id);
|
||||
spdk_json_write_named_string(w, "name", vsession->name);
|
||||
spdk_json_write_named_bool(w, "started", vsession->started);
|
||||
spdk_json_write_named_uint32(w, "max_queues", vsession->max_queues);
|
||||
spdk_json_write_named_uint32(w, "inflight_task_cnt", vsession->task_cnt);
|
||||
spdk_json_write_object_end(w);
|
||||
}
|
||||
pthread_mutex_unlock(&user_dev->lock);
|
||||
}
|
||||
|
@ -595,6 +595,7 @@ struct spdk_virtio_blk_transport *virtio_blk_tgt_get_transport(const char *trans
|
||||
const struct spdk_virtio_blk_transport_ops *virtio_blk_get_transport_ops(
|
||||
const char *transport_name);
|
||||
|
||||
void vhost_session_info_json(struct spdk_vhost_dev *vdev, struct spdk_json_write_ctx *w);
|
||||
|
||||
/*
|
||||
* Macro used to register new transports.
|
||||
|
@ -332,6 +332,9 @@ _rpc_get_vhost_controller(struct spdk_json_write_ctx *w, struct spdk_vhost_dev *
|
||||
spdk_json_write_named_uint32(w, "delay_base_us", delay_base_us);
|
||||
spdk_json_write_named_uint32(w, "iops_threshold", iops_threshold);
|
||||
spdk_json_write_named_string(w, "socket", vdev->path);
|
||||
spdk_json_write_named_array_begin(w, "sessions");
|
||||
vhost_session_info_json(vdev, w);
|
||||
spdk_json_write_array_end(w);
|
||||
|
||||
spdk_json_write_named_object_begin(w, "backend_specific");
|
||||
vhost_dump_info_json(vdev, w);
|
||||
|
@ -18,5 +18,6 @@
|
||||
"ctrlr": "vhost_scsi1",
|
||||
"delay_base_us": 20,
|
||||
"iops_threshold": 1000000,
|
||||
"sessions": [],
|
||||
"socket": "$(S)/vhost_scsi1"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user