From edb18971479bcb61053f6716f50b73c392225478 Mon Sep 17 00:00:00 2001 From: Pawel Kaminski Date: Mon, 30 Sep 2019 07:01:44 -0400 Subject: [PATCH] rpc: Rename remove_vhost_controller to vhost_delete_controller Change-Id: I819cecbd8456f3f978cc3560f31e285bb2cbbe5d Signed-off-by: Pawel Kaminski Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/469863 Tested-by: SPDK CI Jenkins Reviewed-by: Maciej Wawryk Reviewed-by: Ben Walker Reviewed-by: Jim Harris Community-CI: Broadcom SPDK FC-NVMe CI --- doc/jsonrpc.md | 4 ++-- doc/vhost.md | 2 +- lib/vhost/vhost_rpc.c | 23 ++++++++++++----------- scripts/rpc.py | 9 +++++---- scripts/rpc/vhost.py | 7 ++++--- scripts/spdkcli/ui_node.py | 2 +- scripts/spdkcli/ui_root.py | 4 ++-- test/json_config/clear_config.py | 2 +- test/vhost/fiotest/fio.sh | 2 +- test/vhost/hotplug/blk_hotremove.sh | 18 +++++++++--------- test/vhost/hotplug/scsi_hotplug.sh | 16 ++++++++-------- test/vhost/hotplug/scsi_hotremove.sh | 8 ++++---- test/vhost/lvol/lvol_test.sh | 4 ++-- test/vhost/migration/migration-tc1.sh | 4 ++-- test/vhost/migration/migration-tc2.sh | 4 ++-- test/vhost/migration/migration-tc3a.sh | 2 +- test/vhost/migration/migration-tc3b.sh | 2 +- test/vhost/other/negative.sh | 4 ++-- test/vhost/readonly/readonly.sh | 4 ++-- test/vhost/vhost_boot/vhost_boot.sh | 4 ++-- 20 files changed, 64 insertions(+), 61 deletions(-) diff --git a/doc/jsonrpc.md b/doc/jsonrpc.md index e0943fbb7..a9128ec5d 100644 --- a/doc/jsonrpc.md +++ b/doc/jsonrpc.md @@ -4772,7 +4772,7 @@ Example response: } ~~~ -## remove_vhost_controller {#rpc_remove_vhost_controller} +## vhost_delete_controller {#rpc_vhost_delete_controller} Remove vhost target. @@ -4795,7 +4795,7 @@ Example request: "ctrlr": "VhostNvme0" }, "jsonrpc": "2.0", - "method": "remove_vhost_controller", + "method": "vhost_delete_controller", "id": 1 } ~~~ diff --git a/doc/vhost.md b/doc/vhost.md index 0e0045b5c..e9ce04b71 100644 --- a/doc/vhost.md +++ b/doc/vhost.md @@ -188,7 +188,7 @@ Users can use the following command to remove the controller, all the block devices attached to controller's Namespace will be removed automatically. ~~~{.sh} -$rpc_py remove_vhost_controller vhost.2 +$rpc_py vhost_delete_controller vhost.2 ~~~ ## QEMU {#vhost_qemu_config} diff --git a/lib/vhost/vhost_rpc.c b/lib/vhost/vhost_rpc.c index 9d904c09e..baba3126b 100644 --- a/lib/vhost/vhost_rpc.c +++ b/lib/vhost/vhost_rpc.c @@ -291,31 +291,31 @@ invalid: SPDK_RPC_REGISTER("construct_vhost_blk_controller", spdk_rpc_construct_vhost_blk_controller, SPDK_RPC_RUNTIME) -struct rpc_remove_vhost_ctrlr { +struct rpc_delete_vhost_ctrlr { char *ctrlr; }; -static const struct spdk_json_object_decoder rpc_remove_vhost_ctrlr[] = { - {"ctrlr", offsetof(struct rpc_remove_vhost_ctrlr, ctrlr), spdk_json_decode_string }, +static const struct spdk_json_object_decoder rpc_delete_vhost_ctrlr_decoder[] = { + {"ctrlr", offsetof(struct rpc_delete_vhost_ctrlr, ctrlr), spdk_json_decode_string }, }; static void -free_rpc_remove_vhost_ctrlr(struct rpc_remove_vhost_ctrlr *req) +free_rpc_delete_vhost_ctrlr(struct rpc_delete_vhost_ctrlr *req) { free(req->ctrlr); } static void -spdk_rpc_remove_vhost_controller(struct spdk_jsonrpc_request *request, +spdk_rpc_vhost_delete_controller(struct spdk_jsonrpc_request *request, const struct spdk_json_val *params) { - struct rpc_remove_vhost_ctrlr req = {0}; + struct rpc_delete_vhost_ctrlr req = {0}; struct spdk_json_write_ctx *w; struct spdk_vhost_dev *vdev; int rc; - if (spdk_json_decode_object(params, rpc_remove_vhost_ctrlr, - SPDK_COUNTOF(rpc_remove_vhost_ctrlr), &req)) { + if (spdk_json_decode_object(params, rpc_delete_vhost_ctrlr_decoder, + SPDK_COUNTOF(rpc_delete_vhost_ctrlr_decoder), &req)) { SPDK_DEBUGLOG(SPDK_LOG_VHOST_RPC, "spdk_json_decode_object failed\n"); rc = -EINVAL; goto invalid; @@ -335,7 +335,7 @@ spdk_rpc_remove_vhost_controller(struct spdk_jsonrpc_request *request, goto invalid; } - free_rpc_remove_vhost_ctrlr(&req); + free_rpc_delete_vhost_ctrlr(&req); w = spdk_jsonrpc_begin_result(request); spdk_json_write_bool(w, true); @@ -344,12 +344,13 @@ spdk_rpc_remove_vhost_controller(struct spdk_jsonrpc_request *request, return; invalid: - free_rpc_remove_vhost_ctrlr(&req); + free_rpc_delete_vhost_ctrlr(&req); spdk_jsonrpc_send_error_response(request, SPDK_JSONRPC_ERROR_INVALID_PARAMS, spdk_strerror(-rc)); } -SPDK_RPC_REGISTER("remove_vhost_controller", spdk_rpc_remove_vhost_controller, SPDK_RPC_RUNTIME) +SPDK_RPC_REGISTER("vhost_delete_controller", spdk_rpc_vhost_delete_controller, SPDK_RPC_RUNTIME) +SPDK_RPC_REGISTER_ALIAS_DEPRECATED(vhost_delete_controller, remove_vhost_controller) struct rpc_get_vhost_ctrlrs { char *name; diff --git a/scripts/rpc.py b/scripts/rpc.py index 738bc6a4c..63e36d516 100755 --- a/scripts/rpc.py +++ b/scripts/rpc.py @@ -1937,13 +1937,14 @@ Format: 'user:u1 secret:s1 muser:mu1 msecret:ms1,user:u2 secret:s2 muser:mu2 mse p.add_argument('-n', '--name', help="Name of vhost controller", required=False) p.set_defaults(func=get_vhost_controllers) - def remove_vhost_controller(args): - rpc.vhost.remove_vhost_controller(args.client, + def vhost_delete_controller(args): + rpc.vhost.vhost_delete_controller(args.client, ctrlr=args.ctrlr) - p = subparsers.add_parser('remove_vhost_controller', help='Remove a vhost controller') + p = subparsers.add_parser('vhost_delete_controller', aliases=['remove_vhost_controller'], + help='Delete a vhost controller') p.add_argument('ctrlr', help='controller name') - p.set_defaults(func=remove_vhost_controller) + p.set_defaults(func=vhost_delete_controller) def bdev_virtio_attach_controller(args): print_array(rpc.vhost.bdev_virtio_attach_controller(args.client, diff --git a/scripts/rpc/vhost.py b/scripts/rpc/vhost.py index 4a90e8223..81b80dea8 100644 --- a/scripts/rpc/vhost.py +++ b/scripts/rpc/vhost.py @@ -124,13 +124,14 @@ def get_vhost_controllers(client, name=None): return client.call('get_vhost_controllers', params) -def remove_vhost_controller(client, ctrlr): - """Remove vhost controller from configuration. +@deprecated_alias('remove_vhost_controller') +def vhost_delete_controller(client, ctrlr): + """Delete vhost controller from configuration. Args: ctrlr: controller name to remove """ params = {'ctrlr': ctrlr} - return client.call('remove_vhost_controller', params) + return client.call('vhost_delete_controller', params) @deprecated_alias('construct_virtio_dev') diff --git a/scripts/spdkcli/ui_node.py b/scripts/spdkcli/ui_node.py index 5184672ad..4c578d121 100644 --- a/scripts/spdkcli/ui_node.py +++ b/scripts/spdkcli/ui_node.py @@ -668,7 +668,7 @@ class UIVhost(UINode): Arguments: name - Controller name. """ - self.get_root().remove_vhost_controller(ctrlr=name) + self.get_root().vhost_delete_controller(ctrlr=name) class UIVhostBlk(UIVhost): diff --git a/scripts/spdkcli/ui_root.py b/scripts/spdkcli/ui_root.py index 95f862886..389a44f50 100644 --- a/scripts/spdkcli/ui_root.py +++ b/scripts/spdkcli/ui_root.py @@ -278,8 +278,8 @@ class UIRoot(UINode): yield VhostCtrlr(ctrlr) @verbose - def remove_vhost_controller(self, **kwargs): - rpc.vhost.remove_vhost_controller(self.client, **kwargs) + def vhost_delete_controller(self, **kwargs): + rpc.vhost.vhost_delete_controller(self.client, **kwargs) @verbose def create_vhost_scsi_controller(self, **kwargs): diff --git a/test/json_config/clear_config.py b/test/json_config/clear_config.py index fef3216f4..259abf06a 100755 --- a/test/json_config/clear_config.py +++ b/test/json_config/clear_config.py @@ -150,7 +150,7 @@ def clear_vhost_subsystem(args, vhost_config): "scsi_target_num": vhost['params']['scsi_target_num']}) elif method in ['construct_vhost_scsi_controller', 'construct_vhost_blk_controller', 'construct_vhost_nvme_controller']: - args.client.call("remove_vhost_controller", {'ctrlr': vhost['params']['ctrlr']}) + args.client.call("vhost_delete_controller", {'ctrlr': vhost['params']['ctrlr']}) def call_test_cmd(func): diff --git a/test/vhost/fiotest/fio.sh b/test/vhost/fiotest/fio.sh index 428cc69c1..95706c44c 100755 --- a/test/vhost/fiotest/fio.sh +++ b/test/vhost/fiotest/fio.sh @@ -242,7 +242,7 @@ if ! $no_shutdown; then $rpc_py remove_vhost_scsi_target naa.$disk.${conf[0]} 0 fi - $rpc_py remove_vhost_controller naa.$disk.${conf[0]} + $rpc_py vhost_delete_controller naa.$disk.${conf[0]} if [[ $disk == "RaidBdev2" ]]; then notice "Removing lvol bdev and lvol store" $rpc_py bdev_lvol_delete lvs_0/lbd_0 diff --git a/test/vhost/hotplug/blk_hotremove.sh b/test/vhost/hotplug/blk_hotremove.sh index 7dd4ad698..8ecae1e25 100644 --- a/test/vhost/hotplug/blk_hotremove.sh +++ b/test/vhost/hotplug/blk_hotremove.sh @@ -31,11 +31,11 @@ function prepare_fio_cmd_tc1() { done } -function remove_vhost_controllers() { - $rpc_py remove_vhost_controller naa.Nvme0n1p0.0 - $rpc_py remove_vhost_controller naa.Nvme0n1p1.0 - $rpc_py remove_vhost_controller naa.Nvme0n1p2.1 - $rpc_py remove_vhost_controller naa.Nvme0n1p3.1 +function vhost_delete_controllers() { + $rpc_py vhost_delete_controller naa.Nvme0n1p0.0 + $rpc_py vhost_delete_controller naa.Nvme0n1p1.0 + $rpc_py vhost_delete_controller naa.Nvme0n1p2.1 + $rpc_py vhost_delete_controller naa.Nvme0n1p3.1 } # Vhost blk hot remove test cases @@ -90,7 +90,7 @@ function blk_hotremove_tc2() { # Expected: Fio should return error message and return code != 0. check_fio_retcode "Blk hotremove test case 2: Iteration 2." 1 $retcode vm_shutdown_all - remove_vhost_controllers + vhost_delete_controllers add_nvme "HotInNvme1" "$traddr" sleep 1 } @@ -132,7 +132,7 @@ function blk_hotremove_tc3() { # Expected: Fio should return error message and return code != 0. check_fio_retcode "Blk hotremove test case 3: Iteration 2." 1 $retcode vm_shutdown_all - remove_vhost_controllers + vhost_delete_controllers add_nvme "HotInNvme2" "$traddr" sleep 1 } @@ -183,7 +183,7 @@ function blk_hotremove_tc4() { check_fio_retcode "Blk hotremove test case 4: Iteration 3." 1 $retcode vm_shutdown_all - remove_vhost_controllers + vhost_delete_controllers add_nvme "HotInNvme3" "$traddr" sleep 1 } @@ -223,7 +223,7 @@ function blk_hotremove_tc5() { # Expected: Fio should return error message and return code != 0. check_fio_retcode "Blk hotremove test case 5: Iteration 2." 1 $retcode vm_shutdown_all - remove_vhost_controllers + vhost_delete_controllers add_nvme "HotInNvme4" "$traddr" sleep 1 } diff --git a/test/vhost/hotplug/scsi_hotplug.sh b/test/vhost/hotplug/scsi_hotplug.sh index 0277eda2c..01fed2ef2 100755 --- a/test/vhost/hotplug/scsi_hotplug.sh +++ b/test/vhost/hotplug/scsi_hotplug.sh @@ -43,14 +43,14 @@ function clear_vhost_config() { $rpc_py remove_vhost_scsi_target naa.Nvme0n1p6.3 1 $rpc_py remove_vhost_scsi_target naa.Nvme0n1p7.3 0 $rpc_py remove_vhost_scsi_target naa.Nvme0n1p7.3 1 - $rpc_py remove_vhost_controller naa.Nvme0n1p0.0 - $rpc_py remove_vhost_controller naa.Nvme0n1p1.0 - $rpc_py remove_vhost_controller naa.Nvme0n1p2.1 - $rpc_py remove_vhost_controller naa.Nvme0n1p3.1 - $rpc_py remove_vhost_controller naa.Nvme0n1p4.2 - $rpc_py remove_vhost_controller naa.Nvme0n1p5.2 - $rpc_py remove_vhost_controller naa.Nvme0n1p6.3 - $rpc_py remove_vhost_controller naa.Nvme0n1p7.3 + $rpc_py vhost_delete_controller naa.Nvme0n1p0.0 + $rpc_py vhost_delete_controller naa.Nvme0n1p1.0 + $rpc_py vhost_delete_controller naa.Nvme0n1p2.1 + $rpc_py vhost_delete_controller naa.Nvme0n1p3.1 + $rpc_py vhost_delete_controller naa.Nvme0n1p4.2 + $rpc_py vhost_delete_controller naa.Nvme0n1p5.2 + $rpc_py vhost_delete_controller naa.Nvme0n1p6.3 + $rpc_py vhost_delete_controller naa.Nvme0n1p7.3 } trap 'error_exit "${FUNCNAME}" "${LINENO}"' ERR diff --git a/test/vhost/hotplug/scsi_hotremove.sh b/test/vhost/hotplug/scsi_hotremove.sh index 91b55037d..482258e74 100644 --- a/test/vhost/hotplug/scsi_hotremove.sh +++ b/test/vhost/hotplug/scsi_hotremove.sh @@ -218,10 +218,10 @@ function pre_scsi_hotremove_test_case() { } function post_scsi_hotremove_test_case() { - $rpc_py remove_vhost_controller naa.Nvme0n1p0.0 - $rpc_py remove_vhost_controller naa.Nvme0n1p1.0 - $rpc_py remove_vhost_controller naa.Nvme0n1p2.1 - $rpc_py remove_vhost_controller naa.Nvme0n1p3.1 + $rpc_py vhost_delete_controller naa.Nvme0n1p0.0 + $rpc_py vhost_delete_controller naa.Nvme0n1p1.0 + $rpc_py vhost_delete_controller naa.Nvme0n1p2.1 + $rpc_py vhost_delete_controller naa.Nvme0n1p3.1 } pre_scsi_hotremove_test_case diff --git a/test/vhost/lvol/lvol_test.sh b/test/vhost/lvol/lvol_test.sh index abaf064e0..598a3e80e 100755 --- a/test/vhost/lvol/lvol_test.sh +++ b/test/vhost/lvol/lvol_test.sh @@ -263,13 +263,13 @@ if [[ "$ctrl_type" == "spdk_vhost_scsi" ]]; then notice "Removed device $j" done notice "Removing vhost SCSI controller naa.0.$i" - $rpc_py remove_vhost_controller naa.0.$i + $rpc_py vhost_delete_controller naa.0.$i done elif [[ "$ctrl_type" == "spdk_vhost_blk" ]]; then for (( i=0; i<$vm_count; i++)); do for (( j=0; j<${#bdevs[@]}; j++)); do notice "Removing vhost BLK controller naa.$j.$i" - $rpc_py remove_vhost_controller naa.$j.$i + $rpc_py vhost_delete_controller naa.$j.$i notice "Removed naa.$j.$i" done done diff --git a/test/vhost/migration/migration-tc1.sh b/test/vhost/migration/migration-tc1.sh index 7c034a51a..940bd06f8 100644 --- a/test/vhost/migration/migration-tc1.sh +++ b/test/vhost/migration/migration-tc1.sh @@ -8,8 +8,8 @@ function migration_tc1_clean_vhost_config() $rpc bdev_malloc_delete Malloc0 # Delete controllers - $rpc remove_vhost_controller $incoming_vm_ctrlr - $rpc remove_vhost_controller $target_vm_ctrlr + $rpc vhost_delete_controller $incoming_vm_ctrlr + $rpc vhost_delete_controller $target_vm_ctrlr unset -v incoming_vm target_vm incoming_vm_ctrlr target_vm_ctrlr rpc } diff --git a/test/vhost/migration/migration-tc2.sh b/test/vhost/migration/migration-tc2.sh index 9298ae9d6..ef37373aa 100644 --- a/test/vhost/migration/migration-tc2.sh +++ b/test/vhost/migration/migration-tc2.sh @@ -46,10 +46,10 @@ function migration_tc2_cleanup_vhost_config() notice "Removing vhost devices & controllers via RPC ..." # Delete bdev first to remove all LUNs and SCSI targets $rpc_0 delete_nvme_controller Nvme0 - $rpc_0 remove_vhost_controller $incoming_vm_ctrlr + $rpc_0 vhost_delete_controller $incoming_vm_ctrlr $rpc_1 delete_nvme_controller Nvme0 - $rpc_1 remove_vhost_controller $target_vm_ctrlr + $rpc_1 vhost_delete_controller $target_vm_ctrlr notice "killing vhost app" vhost_kill 0 diff --git a/test/vhost/migration/migration-tc3a.sh b/test/vhost/migration/migration-tc3a.sh index 87e8550c8..84c28324b 100644 --- a/test/vhost/migration/migration-tc3a.sh +++ b/test/vhost/migration/migration-tc3a.sh @@ -85,7 +85,7 @@ function host1_cleanup_vhost() notice "Removing bdev & controller from vhost on local server" $rpc_0 delete_nvme_controller Nvme0 - $rpc_0 remove_vhost_controller $incoming_vm_ctrlr + $rpc_0 vhost_delete_controller $incoming_vm_ctrlr notice "Shutting down vhost app" vhost_kill 0 diff --git a/test/vhost/migration/migration-tc3b.sh b/test/vhost/migration/migration-tc3b.sh index aa2085e55..8cbacb168 100644 --- a/test/vhost/migration/migration-tc3b.sh +++ b/test/vhost/migration/migration-tc3b.sh @@ -17,7 +17,7 @@ function host_2_cleanup_vhost() notice "Removing bdev & controller from vhost 1 on remote server" $rpc delete_nvme_controller Nvme0 - $rpc remove_vhost_controller $target_vm_ctrl + $rpc vhost_delete_controller $target_vm_ctrl notice "Shutting down vhost app" vhost_kill 1 diff --git a/test/vhost/other/negative.sh b/test/vhost/other/negative.sh index eb3ce2988..a24c4804c 100755 --- a/test/vhost/other/negative.sh +++ b/test/vhost/other/negative.sh @@ -77,7 +77,7 @@ if [[ $RUN_NIGHTLY -eq 1 ]]; then # General commands notice "Trying to remove nonexistent controller" - if $rpc_py remove_vhost_controller unk0 > /dev/null; then + if $rpc_py vhost_delete_controller unk0 > /dev/null; then error "Removing nonexistent controller succeeded, but it shouldn't" fi @@ -131,7 +131,7 @@ if [[ $RUN_NIGHTLY -eq 1 ]]; then fi notice "Trying to remove nonexistent block controller" - if $rpc_py remove_vhost_controller vhost.nonexistent.name; then + if $rpc_py vhost_delete_controller vhost.nonexistent.name; then error "Removing nonexistent block controller succeeded, but it shouldn't" fi diff --git a/test/vhost/readonly/readonly.sh b/test/vhost/readonly/readonly.sh index 9f63282bb..f74be0c4c 100755 --- a/test/vhost/readonly/readonly.sh +++ b/test/vhost/readonly/readonly.sh @@ -97,7 +97,7 @@ function blk_ro_tc1() vm_shutdown_all #Create readonly controller and test readonly feature notice "Removing controller and creating new one with readonly flag" - $rpc_py remove_vhost_controller $vhost_blk_name + $rpc_py vhost_delete_controller $vhost_blk_name $rpc_py construct_vhost_blk_controller -r $vhost_blk_name $disk_name vm_run $vm_no @@ -109,7 +109,7 @@ function blk_ro_tc1() vm_shutdown_all #Delete file from disk and delete partition echo "INFO: Removing controller and creating new one" - $rpc_py remove_vhost_controller $vhost_blk_name + $rpc_py vhost_delete_controller $vhost_blk_name $rpc_py construct_vhost_blk_controller $vhost_blk_name $disk_name vm_run $vm_no diff --git a/test/vhost/vhost_boot/vhost_boot.sh b/test/vhost/vhost_boot/vhost_boot.sh index 4006f47b8..1b47e0098 100755 --- a/test/vhost/vhost_boot/vhost_boot.sh +++ b/test/vhost/vhost_boot/vhost_boot.sh @@ -18,7 +18,7 @@ function err_clean error "Error on $1 $2" vm_kill_all $rpc_py remove_vhost_scsi_target naa.vhost_vm.$vm_no 0 - $rpc_py remove_vhost_controller naa.vhost_vm.$vm_no + $rpc_py vhost_delete_controller naa.vhost_vm.$vm_no $rpc_py bdev_lvol_delete $lvb_u $rpc_py bdev_lvol_delete_lvstore -u $lvs_u vhost_kill 0 @@ -116,7 +116,7 @@ vm_shutdown_all timing_enter clean_vhost $rpc_py remove_vhost_scsi_target naa.vhost_vm.$vm_no 0 -$rpc_py remove_vhost_controller naa.vhost_vm.$vm_no +$rpc_py vhost_delete_controller naa.vhost_vm.$vm_no $rpc_py bdev_lvol_delete $lvb_u $rpc_py bdev_lvol_delete_lvstore -u $lvs_u vhost_kill 0