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.
@ -4795,7 +4795,7 @@ Example request:
"ctrlr": "VhostNvme0"
},
"jsonrpc": "2.0",
"method": "remove_vhost_controller",
"method": "vhost_delete_controller",
"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.
~~~{.sh}
$rpc_py remove_vhost_controller vhost.2
$rpc_py vhost_delete_controller vhost.2
~~~
## 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_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;

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.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,

View File

@ -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')

View File

@ -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):

View File

@ -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):

View File

@ -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):

View File

@ -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

View File

@ -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
}

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.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

View File

@ -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

View File

@ -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

View File

@ -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
}

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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