rpc: Rename remove_vhost_controller to vhost_delete_controller

Change-Id: I819cecbd8456f3f978cc3560f31e285bb2cbbe5d
Signed-off-by: Pawel Kaminski <pawelx.kaminski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/469863
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Maciej Wawryk <maciejx.wawryk@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
This commit is contained in:
Pawel Kaminski 2019-09-30 07:01:44 -04:00 committed by Jim Harris
parent eda1ec6932
commit edb1897147
20 changed files with 64 additions and 61 deletions

View File

@ -4772,7 +4772,7 @@ Example response:
} }
~~~ ~~~
## remove_vhost_controller {#rpc_remove_vhost_controller} ## vhost_delete_controller {#rpc_vhost_delete_controller}
Remove vhost target. Remove vhost target.
@ -4795,7 +4795,7 @@ Example request:
"ctrlr": "VhostNvme0" "ctrlr": "VhostNvme0"
}, },
"jsonrpc": "2.0", "jsonrpc": "2.0",
"method": "remove_vhost_controller", "method": "vhost_delete_controller",
"id": 1 "id": 1
} }
~~~ ~~~

View File

@ -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. devices attached to controller's Namespace will be removed automatically.
~~~{.sh} ~~~{.sh}
$rpc_py remove_vhost_controller vhost.2 $rpc_py vhost_delete_controller vhost.2
~~~ ~~~
## QEMU {#vhost_qemu_config} ## QEMU {#vhost_qemu_config}

View File

@ -291,31 +291,31 @@ invalid:
SPDK_RPC_REGISTER("construct_vhost_blk_controller", spdk_rpc_construct_vhost_blk_controller, SPDK_RPC_REGISTER("construct_vhost_blk_controller", spdk_rpc_construct_vhost_blk_controller,
SPDK_RPC_RUNTIME) SPDK_RPC_RUNTIME)
struct rpc_remove_vhost_ctrlr { struct rpc_delete_vhost_ctrlr {
char *ctrlr; char *ctrlr;
}; };
static const struct spdk_json_object_decoder rpc_remove_vhost_ctrlr[] = { static const struct spdk_json_object_decoder rpc_delete_vhost_ctrlr_decoder[] = {
{"ctrlr", offsetof(struct rpc_remove_vhost_ctrlr, ctrlr), spdk_json_decode_string }, {"ctrlr", offsetof(struct rpc_delete_vhost_ctrlr, ctrlr), spdk_json_decode_string },
}; };
static void 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); free(req->ctrlr);
} }
static void 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) 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_json_write_ctx *w;
struct spdk_vhost_dev *vdev; struct spdk_vhost_dev *vdev;
int rc; int rc;
if (spdk_json_decode_object(params, rpc_remove_vhost_ctrlr, if (spdk_json_decode_object(params, rpc_delete_vhost_ctrlr_decoder,
SPDK_COUNTOF(rpc_remove_vhost_ctrlr), &req)) { SPDK_COUNTOF(rpc_delete_vhost_ctrlr_decoder), &req)) {
SPDK_DEBUGLOG(SPDK_LOG_VHOST_RPC, "spdk_json_decode_object failed\n"); SPDK_DEBUGLOG(SPDK_LOG_VHOST_RPC, "spdk_json_decode_object failed\n");
rc = -EINVAL; rc = -EINVAL;
goto invalid; goto invalid;
@ -335,7 +335,7 @@ spdk_rpc_remove_vhost_controller(struct spdk_jsonrpc_request *request,
goto invalid; goto invalid;
} }
free_rpc_remove_vhost_ctrlr(&req); free_rpc_delete_vhost_ctrlr(&req);
w = spdk_jsonrpc_begin_result(request); w = spdk_jsonrpc_begin_result(request);
spdk_json_write_bool(w, true); spdk_json_write_bool(w, true);
@ -344,12 +344,13 @@ spdk_rpc_remove_vhost_controller(struct spdk_jsonrpc_request *request,
return; return;
invalid: 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_jsonrpc_send_error_response(request, SPDK_JSONRPC_ERROR_INVALID_PARAMS,
spdk_strerror(-rc)); 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 { struct rpc_get_vhost_ctrlrs {
char *name; char *name;

View File

@ -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.add_argument('-n', '--name', help="Name of vhost controller", required=False)
p.set_defaults(func=get_vhost_controllers) p.set_defaults(func=get_vhost_controllers)
def remove_vhost_controller(args): def vhost_delete_controller(args):
rpc.vhost.remove_vhost_controller(args.client, rpc.vhost.vhost_delete_controller(args.client,
ctrlr=args.ctrlr) 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.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): def bdev_virtio_attach_controller(args):
print_array(rpc.vhost.bdev_virtio_attach_controller(args.client, print_array(rpc.vhost.bdev_virtio_attach_controller(args.client,

View File

@ -124,13 +124,14 @@ def get_vhost_controllers(client, name=None):
return client.call('get_vhost_controllers', params) return client.call('get_vhost_controllers', params)
def remove_vhost_controller(client, ctrlr): @deprecated_alias('remove_vhost_controller')
"""Remove vhost controller from configuration. def vhost_delete_controller(client, ctrlr):
"""Delete vhost controller from configuration.
Args: Args:
ctrlr: controller name to remove ctrlr: controller name to remove
""" """
params = {'ctrlr': ctrlr} params = {'ctrlr': ctrlr}
return client.call('remove_vhost_controller', params) return client.call('vhost_delete_controller', params)
@deprecated_alias('construct_virtio_dev') @deprecated_alias('construct_virtio_dev')

View File

@ -668,7 +668,7 @@ class UIVhost(UINode):
Arguments: Arguments:
name - Controller name. name - Controller name.
""" """
self.get_root().remove_vhost_controller(ctrlr=name) self.get_root().vhost_delete_controller(ctrlr=name)
class UIVhostBlk(UIVhost): class UIVhostBlk(UIVhost):

View File

@ -278,8 +278,8 @@ class UIRoot(UINode):
yield VhostCtrlr(ctrlr) yield VhostCtrlr(ctrlr)
@verbose @verbose
def remove_vhost_controller(self, **kwargs): def vhost_delete_controller(self, **kwargs):
rpc.vhost.remove_vhost_controller(self.client, **kwargs) rpc.vhost.vhost_delete_controller(self.client, **kwargs)
@verbose @verbose
def create_vhost_scsi_controller(self, **kwargs): def create_vhost_scsi_controller(self, **kwargs):

View File

@ -150,7 +150,7 @@ def clear_vhost_subsystem(args, vhost_config):
"scsi_target_num": vhost['params']['scsi_target_num']}) "scsi_target_num": vhost['params']['scsi_target_num']})
elif method in ['construct_vhost_scsi_controller', 'construct_vhost_blk_controller', elif method in ['construct_vhost_scsi_controller', 'construct_vhost_blk_controller',
'construct_vhost_nvme_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): def call_test_cmd(func):

View File

@ -242,7 +242,7 @@ if ! $no_shutdown; then
$rpc_py remove_vhost_scsi_target naa.$disk.${conf[0]} 0 $rpc_py remove_vhost_scsi_target naa.$disk.${conf[0]} 0
fi fi
$rpc_py remove_vhost_controller naa.$disk.${conf[0]} $rpc_py vhost_delete_controller naa.$disk.${conf[0]}
if [[ $disk == "RaidBdev2" ]]; then if [[ $disk == "RaidBdev2" ]]; then
notice "Removing lvol bdev and lvol store" notice "Removing lvol bdev and lvol store"
$rpc_py bdev_lvol_delete lvs_0/lbd_0 $rpc_py bdev_lvol_delete lvs_0/lbd_0

View File

@ -31,11 +31,11 @@ function prepare_fio_cmd_tc1() {
done done
} }
function remove_vhost_controllers() { function vhost_delete_controllers() {
$rpc_py remove_vhost_controller naa.Nvme0n1p0.0 $rpc_py vhost_delete_controller naa.Nvme0n1p0.0
$rpc_py remove_vhost_controller naa.Nvme0n1p1.0 $rpc_py vhost_delete_controller naa.Nvme0n1p1.0
$rpc_py remove_vhost_controller naa.Nvme0n1p2.1 $rpc_py vhost_delete_controller naa.Nvme0n1p2.1
$rpc_py remove_vhost_controller naa.Nvme0n1p3.1 $rpc_py vhost_delete_controller naa.Nvme0n1p3.1
} }
# Vhost blk hot remove test cases # Vhost blk hot remove test cases
@ -90,7 +90,7 @@ function blk_hotremove_tc2() {
# Expected: Fio should return error message and return code != 0. # Expected: Fio should return error message and return code != 0.
check_fio_retcode "Blk hotremove test case 2: Iteration 2." 1 $retcode check_fio_retcode "Blk hotremove test case 2: Iteration 2." 1 $retcode
vm_shutdown_all vm_shutdown_all
remove_vhost_controllers vhost_delete_controllers
add_nvme "HotInNvme1" "$traddr" add_nvme "HotInNvme1" "$traddr"
sleep 1 sleep 1
} }
@ -132,7 +132,7 @@ function blk_hotremove_tc3() {
# Expected: Fio should return error message and return code != 0. # Expected: Fio should return error message and return code != 0.
check_fio_retcode "Blk hotremove test case 3: Iteration 2." 1 $retcode check_fio_retcode "Blk hotremove test case 3: Iteration 2." 1 $retcode
vm_shutdown_all vm_shutdown_all
remove_vhost_controllers vhost_delete_controllers
add_nvme "HotInNvme2" "$traddr" add_nvme "HotInNvme2" "$traddr"
sleep 1 sleep 1
} }
@ -183,7 +183,7 @@ function blk_hotremove_tc4() {
check_fio_retcode "Blk hotremove test case 4: Iteration 3." 1 $retcode check_fio_retcode "Blk hotremove test case 4: Iteration 3." 1 $retcode
vm_shutdown_all vm_shutdown_all
remove_vhost_controllers vhost_delete_controllers
add_nvme "HotInNvme3" "$traddr" add_nvme "HotInNvme3" "$traddr"
sleep 1 sleep 1
} }
@ -223,7 +223,7 @@ function blk_hotremove_tc5() {
# Expected: Fio should return error message and return code != 0. # Expected: Fio should return error message and return code != 0.
check_fio_retcode "Blk hotremove test case 5: Iteration 2." 1 $retcode check_fio_retcode "Blk hotremove test case 5: Iteration 2." 1 $retcode
vm_shutdown_all vm_shutdown_all
remove_vhost_controllers vhost_delete_controllers
add_nvme "HotInNvme4" "$traddr" add_nvme "HotInNvme4" "$traddr"
sleep 1 sleep 1
} }

View File

@ -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.Nvme0n1p6.3 1
$rpc_py remove_vhost_scsi_target naa.Nvme0n1p7.3 0 $rpc_py remove_vhost_scsi_target naa.Nvme0n1p7.3 0
$rpc_py remove_vhost_scsi_target naa.Nvme0n1p7.3 1 $rpc_py remove_vhost_scsi_target naa.Nvme0n1p7.3 1
$rpc_py remove_vhost_controller naa.Nvme0n1p0.0 $rpc_py vhost_delete_controller naa.Nvme0n1p0.0
$rpc_py remove_vhost_controller naa.Nvme0n1p1.0 $rpc_py vhost_delete_controller naa.Nvme0n1p1.0
$rpc_py remove_vhost_controller naa.Nvme0n1p2.1 $rpc_py vhost_delete_controller naa.Nvme0n1p2.1
$rpc_py remove_vhost_controller naa.Nvme0n1p3.1 $rpc_py vhost_delete_controller naa.Nvme0n1p3.1
$rpc_py remove_vhost_controller naa.Nvme0n1p4.2 $rpc_py vhost_delete_controller naa.Nvme0n1p4.2
$rpc_py remove_vhost_controller naa.Nvme0n1p5.2 $rpc_py vhost_delete_controller naa.Nvme0n1p5.2
$rpc_py remove_vhost_controller naa.Nvme0n1p6.3 $rpc_py vhost_delete_controller naa.Nvme0n1p6.3
$rpc_py remove_vhost_controller naa.Nvme0n1p7.3 $rpc_py vhost_delete_controller naa.Nvme0n1p7.3
} }
trap 'error_exit "${FUNCNAME}" "${LINENO}"' ERR trap 'error_exit "${FUNCNAME}" "${LINENO}"' ERR

View File

@ -218,10 +218,10 @@ function pre_scsi_hotremove_test_case() {
} }
function post_scsi_hotremove_test_case() { function post_scsi_hotremove_test_case() {
$rpc_py remove_vhost_controller naa.Nvme0n1p0.0 $rpc_py vhost_delete_controller naa.Nvme0n1p0.0
$rpc_py remove_vhost_controller naa.Nvme0n1p1.0 $rpc_py vhost_delete_controller naa.Nvme0n1p1.0
$rpc_py remove_vhost_controller naa.Nvme0n1p2.1 $rpc_py vhost_delete_controller naa.Nvme0n1p2.1
$rpc_py remove_vhost_controller naa.Nvme0n1p3.1 $rpc_py vhost_delete_controller naa.Nvme0n1p3.1
} }
pre_scsi_hotremove_test_case pre_scsi_hotremove_test_case

View File

@ -263,13 +263,13 @@ if [[ "$ctrl_type" == "spdk_vhost_scsi" ]]; then
notice "Removed device $j" notice "Removed device $j"
done done
notice "Removing vhost SCSI controller naa.0.$i" 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 done
elif [[ "$ctrl_type" == "spdk_vhost_blk" ]]; then elif [[ "$ctrl_type" == "spdk_vhost_blk" ]]; then
for (( i=0; i<$vm_count; i++)); do for (( i=0; i<$vm_count; i++)); do
for (( j=0; j<${#bdevs[@]}; j++)); do for (( j=0; j<${#bdevs[@]}; j++)); do
notice "Removing vhost BLK controller naa.$j.$i" 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" notice "Removed naa.$j.$i"
done done
done done

View File

@ -8,8 +8,8 @@ function migration_tc1_clean_vhost_config()
$rpc bdev_malloc_delete Malloc0 $rpc bdev_malloc_delete Malloc0
# Delete controllers # Delete controllers
$rpc remove_vhost_controller $incoming_vm_ctrlr $rpc vhost_delete_controller $incoming_vm_ctrlr
$rpc remove_vhost_controller $target_vm_ctrlr $rpc vhost_delete_controller $target_vm_ctrlr
unset -v incoming_vm target_vm incoming_vm_ctrlr target_vm_ctrlr rpc unset -v incoming_vm target_vm incoming_vm_ctrlr target_vm_ctrlr rpc
} }

View File

@ -46,10 +46,10 @@ function migration_tc2_cleanup_vhost_config()
notice "Removing vhost devices & controllers via RPC ..." notice "Removing vhost devices & controllers via RPC ..."
# Delete bdev first to remove all LUNs and SCSI targets # Delete bdev first to remove all LUNs and SCSI targets
$rpc_0 delete_nvme_controller Nvme0 $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 delete_nvme_controller Nvme0
$rpc_1 remove_vhost_controller $target_vm_ctrlr $rpc_1 vhost_delete_controller $target_vm_ctrlr
notice "killing vhost app" notice "killing vhost app"
vhost_kill 0 vhost_kill 0

View File

@ -85,7 +85,7 @@ function host1_cleanup_vhost()
notice "Removing bdev & controller from vhost on local server" notice "Removing bdev & controller from vhost on local server"
$rpc_0 delete_nvme_controller Nvme0 $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" notice "Shutting down vhost app"
vhost_kill 0 vhost_kill 0

View File

@ -17,7 +17,7 @@ function host_2_cleanup_vhost()
notice "Removing bdev & controller from vhost 1 on remote server" notice "Removing bdev & controller from vhost 1 on remote server"
$rpc delete_nvme_controller Nvme0 $rpc delete_nvme_controller Nvme0
$rpc remove_vhost_controller $target_vm_ctrl $rpc vhost_delete_controller $target_vm_ctrl
notice "Shutting down vhost app" notice "Shutting down vhost app"
vhost_kill 1 vhost_kill 1

View File

@ -77,7 +77,7 @@ if [[ $RUN_NIGHTLY -eq 1 ]]; then
# General commands # General commands
notice "Trying to remove nonexistent controller" 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" error "Removing nonexistent controller succeeded, but it shouldn't"
fi fi
@ -131,7 +131,7 @@ if [[ $RUN_NIGHTLY -eq 1 ]]; then
fi fi
notice "Trying to remove nonexistent block controller" 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" error "Removing nonexistent block controller succeeded, but it shouldn't"
fi fi

View File

@ -97,7 +97,7 @@ function blk_ro_tc1()
vm_shutdown_all vm_shutdown_all
#Create readonly controller and test readonly feature #Create readonly controller and test readonly feature
notice "Removing controller and creating new one with readonly flag" 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 $rpc_py construct_vhost_blk_controller -r $vhost_blk_name $disk_name
vm_run $vm_no vm_run $vm_no
@ -109,7 +109,7 @@ function blk_ro_tc1()
vm_shutdown_all vm_shutdown_all
#Delete file from disk and delete partition #Delete file from disk and delete partition
echo "INFO: Removing controller and creating new one" 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 $rpc_py construct_vhost_blk_controller $vhost_blk_name $disk_name
vm_run $vm_no vm_run $vm_no

View File

@ -18,7 +18,7 @@ function err_clean
error "Error on $1 $2" error "Error on $1 $2"
vm_kill_all vm_kill_all
$rpc_py remove_vhost_scsi_target naa.vhost_vm.$vm_no 0 $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 $lvb_u
$rpc_py bdev_lvol_delete_lvstore -u $lvs_u $rpc_py bdev_lvol_delete_lvstore -u $lvs_u
vhost_kill 0 vhost_kill 0
@ -116,7 +116,7 @@ vm_shutdown_all
timing_enter clean_vhost timing_enter clean_vhost
$rpc_py remove_vhost_scsi_target naa.vhost_vm.$vm_no 0 $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 $lvb_u
$rpc_py bdev_lvol_delete_lvstore -u $lvs_u $rpc_py bdev_lvol_delete_lvstore -u $lvs_u
vhost_kill 0 vhost_kill 0