From 2976fbd2a384f261a871be4e02438c8ff45d92b7 Mon Sep 17 00:00:00 2001 From: Pawel Kaminski Date: Mon, 30 Sep 2019 08:00:12 -0400 Subject: [PATCH] rpc: rename get_vhost_controllers to vhost_get_controllers Change-Id: I597da89241c221e82f11cf843d1e726613b9a768 Signed-off-by: Pawel Kaminski Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/469869 Tested-by: SPDK CI Jenkins Reviewed-by: Jim Harris Reviewed-by: Tomasz Zawadzki Reviewed-by: Shuhei Matsumoto --- doc/jsonrpc.md | 16 ++++++++-------- lib/vhost/vhost_rpc.c | 5 +++-- scripts/rpc.py | 9 +++++---- scripts/rpc/vhost.py | 5 +++-- scripts/spdkcli/ui_node.py | 8 ++++---- scripts/spdkcli/ui_root.py | 6 +++--- test/vhost/fiotest/fio.sh | 2 +- test/vhost/lvol/lvol_test.sh | 4 ++-- test/vhost/windows/windows.sh | 2 +- 9 files changed, 30 insertions(+), 27 deletions(-) diff --git a/doc/jsonrpc.md b/doc/jsonrpc.md index 5c7be01833..989c09622f 100644 --- a/doc/jsonrpc.md +++ b/doc/jsonrpc.md @@ -4623,7 +4623,7 @@ Example response: } ~~~ -## get_vhost_controllers {#rpc_get_vhost_controllers} +## vhost_get_controllers {#rpc_vhost_get_controllers} Display information about all or specific vhost controller(s). @@ -4637,7 +4637,7 @@ Name | Optional | Type | Description name | Optional | string | Vhost controller name -### Response {#rpc_get_vhost_controllers_response} +### Response {#rpc_vhost_get_controllers_response} Response is an array of objects describing requested controller(s). Common fields are: @@ -4649,7 +4649,7 @@ delay_base_us | number | Base (minimum) coalescing time in micros iops_threshold | number | Coalescing activation level backend_specific | object | Backend specific informations -### Vhost block {#rpc_get_vhost_controllers_blk} +### Vhost block {#rpc_vhost_get_controllers_blk} `backend_specific` contains one `block` object of type: @@ -4658,7 +4658,7 @@ Name | Type | Description bdev | string | Backing bdev name or Null if bdev is hot-removed readonly | boolean | True if controllers is readonly, false otherwise -### Vhost SCSI {#rpc_get_vhost_controllers_scsi} +### Vhost SCSI {#rpc_vhost_get_controllers_scsi} `backend_specific` contains `scsi` array of following objects: @@ -4667,9 +4667,9 @@ Name | Type | Description target_name | string | Name of this SCSI target id | number | Unique SPDK global SCSI target ID scsi_dev_num | number | SCSI target ID initiator will see when scanning this controller -luns | array | array of objects describing @ref rpc_get_vhost_controllers_scsi_luns +luns | array | array of objects describing @ref rpc_vhost_get_controllers_scsi_luns -### Vhost SCSI LUN {#rpc_get_vhost_controllers_scsi_luns} +### Vhost SCSI LUN {#rpc_vhost_get_controllers_scsi_luns} Object of type: @@ -4678,7 +4678,7 @@ Name | Type | Description id | number | SCSI LUN ID bdev_name | string | Backing bdev name -### Vhost NVMe {#rpc_get_vhost_controllers_nvme} +### Vhost NVMe {#rpc_vhost_get_controllers_nvme} `backend_specific` contains `namespaces` array of following objects: @@ -4694,7 +4694,7 @@ Example request: ~~~ { "jsonrpc": "2.0", - "method": "get_vhost_controllers", + "method": "vhost_get_controllers", "id": 1 } ~~~ diff --git a/lib/vhost/vhost_rpc.c b/lib/vhost/vhost_rpc.c index b7c7a1738a..c365272fca 100644 --- a/lib/vhost/vhost_rpc.c +++ b/lib/vhost/vhost_rpc.c @@ -394,7 +394,7 @@ free_rpc_get_vhost_ctrlrs(struct rpc_get_vhost_ctrlrs *req) } static void -spdk_rpc_get_vhost_controllers(struct spdk_jsonrpc_request *request, +spdk_rpc_vhost_get_controllers(struct spdk_jsonrpc_request *request, const struct spdk_json_val *params) { struct rpc_get_vhost_ctrlrs req = {0}; @@ -452,7 +452,8 @@ invalid: spdk_jsonrpc_send_error_response(request, SPDK_JSONRPC_ERROR_INTERNAL_ERROR, spdk_strerror(-rc)); } -SPDK_RPC_REGISTER("get_vhost_controllers", spdk_rpc_get_vhost_controllers, SPDK_RPC_RUNTIME) +SPDK_RPC_REGISTER("vhost_get_controllers", spdk_rpc_vhost_get_controllers, SPDK_RPC_RUNTIME) +SPDK_RPC_REGISTER_ALIAS_DEPRECATED(vhost_get_controllers, get_vhost_controllers) struct rpc_vhost_ctrlr_coalescing { diff --git a/scripts/rpc.py b/scripts/rpc.py index 93d486844a..9d668aa223 100755 --- a/scripts/rpc.py +++ b/scripts/rpc.py @@ -1938,12 +1938,13 @@ Format: 'user:u1 secret:s1 muser:mu1 msecret:ms1,user:u2 secret:s2 muser:mu2 mse p.add_argument('bdev_name', help='block device name for a new Namespace') p.set_defaults(func=vhost_nvme_controller_add_ns) - def get_vhost_controllers(args): - print_dict(rpc.vhost.get_vhost_controllers(args.client, args.name)) + def vhost_get_controllers(args): + print_dict(rpc.vhost.vhost_get_controllers(args.client, args.name)) - p = subparsers.add_parser('get_vhost_controllers', help='List all or specific vhost controller(s)') + p = subparsers.add_parser('vhost_get_controllers', aliases=['get_vhost_controllers'], + help='List all or specific vhost controller(s)') p.add_argument('-n', '--name', help="Name of vhost controller", required=False) - p.set_defaults(func=get_vhost_controllers) + p.set_defaults(func=vhost_get_controllers) def vhost_delete_controller(args): rpc.vhost.vhost_delete_controller(args.client, diff --git a/scripts/rpc/vhost.py b/scripts/rpc/vhost.py index c8fe482e03..d35db12e8f 100644 --- a/scripts/rpc/vhost.py +++ b/scripts/rpc/vhost.py @@ -115,7 +115,8 @@ def construct_vhost_blk_controller(client, ctrlr, dev_name, cpumask=None, readon return client.call('construct_vhost_blk_controller', params) -def get_vhost_controllers(client, name=None): +@deprecated_alias('get_vhost_controllers') +def vhost_get_controllers(client, name=None): """Get information about configured vhost controllers. Args: @@ -127,7 +128,7 @@ def get_vhost_controllers(client, name=None): params = {} if name: params['name'] = name - return client.call('get_vhost_controllers', params) + return client.call('vhost_get_controllers', params) @deprecated_alias('remove_vhost_controller') diff --git a/scripts/spdkcli/ui_node.py b/scripts/spdkcli/ui_node.py index 6053323833..22c2b846f6 100644 --- a/scripts/spdkcli/ui_node.py +++ b/scripts/spdkcli/ui_node.py @@ -678,7 +678,7 @@ class UIVhostBlk(UIVhost): def refresh(self): self._children = set([]) - for ctrlr in self.get_root().get_vhost_controllers(ctrlr_type=self.name): + for ctrlr in self.get_root().vhost_get_controllers(ctrlr_type=self.name): UIVhostBlkCtrlObj(ctrlr, self) def ui_command_create(self, name, bdev, cpumask=None, readonly=False): @@ -706,7 +706,7 @@ class UIVhostScsi(UIVhost): def refresh(self): self._children = set([]) - for ctrlr in self.get_root().get_vhost_controllers(ctrlr_type=self.name): + for ctrlr in self.get_root().vhost_get_controllers(ctrlr_type=self.name): UIVhostScsiCtrlObj(ctrlr, self) def ui_command_create(self, name, cpumask=None): @@ -756,7 +756,7 @@ class UIVhostScsiCtrlObj(UIVhostCtrl): """ self.get_root().vhost_scsi_controller_remove_target(ctrlr=self.ctrlr.ctrlr, scsi_target_num=int(target_num)) - for ctrlr in self.get_root().get_vhost_controllers(ctrlr_type="scsi"): + for ctrlr in self.get_root().vhost_get_controllers(ctrlr_type="scsi"): if ctrlr.ctrlr == self.ctrlr.ctrlr: self.ctrlr = ctrlr @@ -773,7 +773,7 @@ class UIVhostScsiCtrlObj(UIVhostCtrl): self.get_root().vhost_scsi_controller_add_target(ctrlr=self.ctrlr.ctrlr, scsi_target_num=int(target_num), bdev_name=bdev_name) - for ctrlr in self.get_root().get_vhost_controllers(ctrlr_type="scsi"): + for ctrlr in self.get_root().vhost_get_controllers(ctrlr_type="scsi"): if ctrlr.ctrlr == self.ctrlr.ctrlr: self.ctrlr = ctrlr diff --git a/scripts/spdkcli/ui_root.py b/scripts/spdkcli/ui_root.py index edb974ef0a..2af3ad7daa 100644 --- a/scripts/spdkcli/ui_root.py +++ b/scripts/spdkcli/ui_root.py @@ -267,11 +267,11 @@ class UIRoot(UINode): def list_vhost_ctrls(self): if self.is_init: - self.current_vhost_ctrls = rpc.vhost.get_vhost_controllers(self.client) + self.current_vhost_ctrls = rpc.vhost.vhost_get_controllers(self.client) @verbose @is_method_available - def get_vhost_controllers(self, ctrlr_type): + def vhost_get_controllers(self, ctrlr_type): if self.is_init: self.list_vhost_ctrls() for ctrlr in [x for x in self.current_vhost_ctrls if ctrlr_type in list(x["backend_specific"].keys())]: @@ -516,7 +516,7 @@ class VhostCtrlr(object): def __init__(self, ctrlr_info): """ All class attributes are set based on what information is received - from get_vhost_controllers RPC call. + from vhost_get_controllers RPC call. # TODO: Document in docstring parameters which describe bdevs. # TODO: Possible improvement: JSON schema might be used here in future """ diff --git a/test/vhost/fiotest/fio.sh b/test/vhost/fiotest/fio.sh index 9fc4f15fa3..0650cd14e1 100755 --- a/test/vhost/fiotest/fio.sh +++ b/test/vhost/fiotest/fio.sh @@ -137,7 +137,7 @@ for vm_conf in ${vms[@]}; do done done <<< "${conf[2]}" unset IFS; - $rpc_py get_vhost_controllers + $rpc_py vhost_get_controllers fi setup_cmd="vm_setup --force=${conf[0]} --disk-type=$test_type" diff --git a/test/vhost/lvol/lvol_test.sh b/test/vhost/lvol/lvol_test.sh index 2290036cec..acae0a01e0 100755 --- a/test/vhost/lvol/lvol_test.sh +++ b/test/vhost/lvol/lvol_test.sh @@ -216,7 +216,7 @@ for (( i=0; i<$vm_count; i++)); do used_vms+=" $i" done -$rpc_py get_vhost_controllers +$rpc_py vhost_get_controllers # Run VMs vm_run $used_vms @@ -279,7 +279,7 @@ clean_lvol_cfg $rpc_py bdev_lvol_get_lvstores $rpc_py bdev_get_bdevs -$rpc_py get_vhost_controllers +$rpc_py vhost_get_controllers notice "Shutting down SPDK vhost app..." vhost_kill 0 diff --git a/test/vhost/windows/windows.sh b/test/vhost/windows/windows.sh index 6164e33261..348cf1186f 100755 --- a/test/vhost/windows/windows.sh +++ b/test/vhost/windows/windows.sh @@ -116,7 +116,7 @@ elif [[ "$ctrl_type" == "spdk_vhost_blk" ]]; then $rpc_py construct_vhost_blk_controller naa.2.0 Aio0 setup_cmd+=" --disk-type=spdk_vhost_blk --disks=0:1:2" fi -$rpc_py get_vhost_controllers +$rpc_py vhost_get_controllers $setup_cmd # Spin up VM