rpc: Rename remove_vhost_scsi_target to vhost_scsi_controller_remove_target
Change-Id: If0abef6746f9dad9f146d4f6127dad65ac070620 Signed-off-by: Pawel Kaminski <pawelx.kaminski@intel.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/469760 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Maciej Wawryk <maciejx.wawryk@intel.com>
This commit is contained in:
parent
d4245df913
commit
36e04eb4ca
@ -4462,7 +4462,7 @@ response:
|
||||
}
|
||||
~~~
|
||||
|
||||
## remove_vhost_scsi_target {#rpc_remove_vhost_scsi_target}
|
||||
## vhost_scsi_controller_remove_target {#rpc_vhost_scsi_controller_remove_target}
|
||||
|
||||
Remove SCSI target ID `scsi_target_num` from vhost target `scsi_target_num`.
|
||||
|
||||
@ -4487,7 +4487,7 @@ request:
|
||||
"ctrlr": "VhostScsi0"
|
||||
},
|
||||
"jsonrpc": "2.0",
|
||||
"method": "remove_vhost_scsi_target",
|
||||
"method": "vhost_scsi_controller_remove_target",
|
||||
"id": 1
|
||||
}
|
||||
~~~
|
||||
@ -4777,7 +4777,7 @@ Example response:
|
||||
Remove vhost target.
|
||||
|
||||
This call will fail if there is an initiator connected or there is at least one SCSI target configured in case of
|
||||
vhost SCSI target. In the later case please remove all SCSI targets first using @ref rpc_remove_vhost_scsi_target.
|
||||
vhost SCSI target. In the later case please remove all SCSI targets first using @ref rpc_vhost_scsi_controller_remove_target.
|
||||
|
||||
### Parameters
|
||||
|
||||
|
@ -149,7 +149,7 @@ scripts/rpc.py vhost_scsi_controller_add_target vhost.0 0 Malloc0
|
||||
To remove a bdev from a vhost-scsi controller use the following RPC:
|
||||
|
||||
~~~{.sh}
|
||||
scripts/rpc.py remove_vhost_scsi_target vhost.0 0
|
||||
scripts/rpc.py vhost_scsi_controller_remove_target vhost.0 0
|
||||
~~~
|
||||
|
||||
### Vhost-BLK
|
||||
@ -387,7 +387,7 @@ Just like hot-attach, the hot-detach is done by simply removing bdev from a cont
|
||||
when QEMU VM is already started.
|
||||
|
||||
~~~{.sh}
|
||||
scripts/rpc.py remove_vhost_scsi_target vhost.0 0
|
||||
scripts/rpc.py vhost_scsi_controller_remove_target vhost.0 0
|
||||
~~~
|
||||
|
||||
Removing an entire bdev will hot-detach it from a controller as well.
|
||||
|
@ -181,7 +181,7 @@ static const struct spdk_json_object_decoder rpc_vhost_remove_target[] = {
|
||||
};
|
||||
|
||||
static int
|
||||
spdk_rpc_remove_vhost_scsi_target_finish_cb(struct spdk_vhost_dev *vdev, void *arg)
|
||||
spdk_rpc_vhost_scsi_controller_remove_target_finish_cb(struct spdk_vhost_dev *vdev, void *arg)
|
||||
{
|
||||
struct spdk_jsonrpc_request *request = arg;
|
||||
struct spdk_json_write_ctx *w;
|
||||
@ -193,7 +193,7 @@ spdk_rpc_remove_vhost_scsi_target_finish_cb(struct spdk_vhost_dev *vdev, void *a
|
||||
}
|
||||
|
||||
static void
|
||||
spdk_rpc_remove_vhost_scsi_target(struct spdk_jsonrpc_request *request,
|
||||
spdk_rpc_vhost_scsi_controller_remove_target(struct spdk_jsonrpc_request *request,
|
||||
const struct spdk_json_val *params)
|
||||
{
|
||||
struct rpc_remove_vhost_scsi_ctrlr_target req = {0};
|
||||
@ -217,7 +217,7 @@ spdk_rpc_remove_vhost_scsi_target(struct spdk_jsonrpc_request *request,
|
||||
}
|
||||
|
||||
rc = spdk_vhost_scsi_dev_remove_tgt(vdev, req.scsi_target_num,
|
||||
spdk_rpc_remove_vhost_scsi_target_finish_cb,
|
||||
spdk_rpc_vhost_scsi_controller_remove_target_finish_cb,
|
||||
request);
|
||||
spdk_vhost_unlock();
|
||||
if (rc < 0) {
|
||||
@ -233,7 +233,9 @@ invalid:
|
||||
spdk_strerror(-rc));
|
||||
}
|
||||
|
||||
SPDK_RPC_REGISTER("remove_vhost_scsi_target", spdk_rpc_remove_vhost_scsi_target, SPDK_RPC_RUNTIME)
|
||||
SPDK_RPC_REGISTER("vhost_scsi_controller_remove_target",
|
||||
spdk_rpc_vhost_scsi_controller_remove_target, SPDK_RPC_RUNTIME)
|
||||
SPDK_RPC_REGISTER_ALIAS_DEPRECATED(vhost_scsi_controller_remove_target, remove_vhost_scsi_target)
|
||||
|
||||
struct rpc_vhost_blk_ctrlr {
|
||||
char *ctrlr;
|
||||
|
@ -1888,15 +1888,17 @@ Format: 'user:u1 secret:s1 muser:mu1 msecret:ms1,user:u2 secret:s2 muser:mu2 mse
|
||||
p.add_argument('bdev_name', help='bdev name')
|
||||
p.set_defaults(func=vhost_scsi_controller_add_target)
|
||||
|
||||
def remove_vhost_scsi_target(args):
|
||||
rpc.vhost.remove_vhost_scsi_target(args.client,
|
||||
def vhost_scsi_controller_remove_target(args):
|
||||
rpc.vhost.vhost_scsi_controller_remove_target(args.client,
|
||||
ctrlr=args.ctrlr,
|
||||
scsi_target_num=args.scsi_target_num)
|
||||
|
||||
p = subparsers.add_parser('remove_vhost_scsi_target', help='Remove target from vhost controller')
|
||||
p = subparsers.add_parser('vhost_scsi_controller_remove_target',
|
||||
aliases=['remove_vhost_scsi_target'],
|
||||
help='Remove target from vhost controller')
|
||||
p.add_argument('ctrlr', help='controller name to remove target from')
|
||||
p.add_argument('scsi_target_num', help='scsi_target_num', type=int)
|
||||
p.set_defaults(func=remove_vhost_scsi_target)
|
||||
p.set_defaults(func=vhost_scsi_controller_remove_target)
|
||||
|
||||
def construct_vhost_blk_controller(args):
|
||||
rpc.vhost.construct_vhost_blk_controller(args.client,
|
||||
|
@ -48,7 +48,8 @@ def vhost_scsi_controller_add_target(client, ctrlr, scsi_target_num, bdev_name):
|
||||
return client.call('vhost_scsi_controller_add_target', params)
|
||||
|
||||
|
||||
def remove_vhost_scsi_target(client, ctrlr, scsi_target_num):
|
||||
@deprecated_alias('remove_vhost_scsi_target')
|
||||
def vhost_scsi_controller_remove_target(client, ctrlr, scsi_target_num):
|
||||
"""Remove target from vhost scsi controller.
|
||||
Args:
|
||||
ctrlr: controller name to remove target from
|
||||
@ -58,7 +59,7 @@ def remove_vhost_scsi_target(client, ctrlr, scsi_target_num):
|
||||
'ctrlr': ctrlr,
|
||||
'scsi_target_num': scsi_target_num
|
||||
}
|
||||
return client.call('remove_vhost_scsi_target', params)
|
||||
return client.call('vhost_scsi_controller_remove_target', params)
|
||||
|
||||
|
||||
def construct_vhost_nvme_controller(client, ctrlr, io_queues, cpumask=None):
|
||||
|
@ -754,7 +754,7 @@ class UIVhostScsiCtrlObj(UIVhostCtrl):
|
||||
Arguments:
|
||||
target_num - Integer identifier of target node to delete.
|
||||
"""
|
||||
self.get_root().remove_vhost_scsi_target(ctrlr=self.ctrlr.ctrlr,
|
||||
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"):
|
||||
if ctrlr.ctrlr == self.ctrlr.ctrlr:
|
||||
|
@ -290,8 +290,8 @@ class UIRoot(UINode):
|
||||
rpc.vhost.construct_vhost_blk_controller(self.client, **kwargs)
|
||||
|
||||
@verbose
|
||||
def remove_vhost_scsi_target(self, **kwargs):
|
||||
rpc.vhost.remove_vhost_scsi_target(self.client, **kwargs)
|
||||
def vhost_scsi_controller_remove_target(self, **kwargs):
|
||||
rpc.vhost.vhost_scsi_controller_remove_target(self.client, **kwargs)
|
||||
|
||||
@verbose
|
||||
def vhost_scsi_controller_add_target(self, **kwargs):
|
||||
|
@ -145,7 +145,7 @@ def clear_vhost_subsystem(args, vhost_config):
|
||||
if 'method' in vhost:
|
||||
method = vhost['method']
|
||||
if method in ['vhost_scsi_controller_add_target']:
|
||||
args.client.call("remove_vhost_scsi_target",
|
||||
args.client.call("vhost_scsi_controller_remove_target",
|
||||
{"ctrlr": vhost['params']['ctrlr'],
|
||||
"scsi_target_num": vhost['params']['scsi_target_num']})
|
||||
elif method in ['vhost_create_scsi_controller', 'construct_vhost_blk_controller',
|
||||
|
@ -163,7 +163,7 @@ if [[ $test_type == "spdk_vhost_scsi" ]]; then
|
||||
based_disk="$disk"
|
||||
fi
|
||||
notice "Hotdetach test. Trying to remove existing device from a controller naa.$disk.${conf[0]}"
|
||||
$rpc_py remove_vhost_scsi_target naa.$disk.${conf[0]} 0
|
||||
$rpc_py vhost_scsi_controller_remove_target naa.$disk.${conf[0]} 0
|
||||
|
||||
sleep 0.1
|
||||
|
||||
@ -239,7 +239,7 @@ if ! $no_shutdown; then
|
||||
disk=${disk%%_*}
|
||||
notice "Removing all vhost devices from controller naa.$disk.${conf[0]}"
|
||||
if [[ "$test_type" == "spdk_vhost_scsi" ]]; then
|
||||
$rpc_py remove_vhost_scsi_target naa.$disk.${conf[0]} 0
|
||||
$rpc_py vhost_scsi_controller_remove_target naa.$disk.${conf[0]} 0
|
||||
fi
|
||||
|
||||
$rpc_py vhost_delete_controller naa.$disk.${conf[0]}
|
||||
|
@ -91,10 +91,10 @@ function hotattach_tc4() {
|
||||
}
|
||||
|
||||
function cleanup_after_tests() {
|
||||
$rpc_py remove_vhost_scsi_target naa.Nvme0n1p0.0 0
|
||||
$rpc_py remove_vhost_scsi_target naa.Nvme0n1p0.0 1
|
||||
$rpc_py remove_vhost_scsi_target naa.Nvme0n1p1.0 0
|
||||
$rpc_py remove_vhost_scsi_target naa.Nvme0n1p2.1 0
|
||||
$rpc_py vhost_scsi_controller_remove_target naa.Nvme0n1p0.0 0
|
||||
$rpc_py vhost_scsi_controller_remove_target naa.Nvme0n1p0.0 1
|
||||
$rpc_py vhost_scsi_controller_remove_target naa.Nvme0n1p1.0 0
|
||||
$rpc_py vhost_scsi_controller_remove_target naa.Nvme0n1p2.1 0
|
||||
}
|
||||
|
||||
hotattach_tc1
|
||||
|
@ -143,7 +143,7 @@ function hotdetach_tc1() {
|
||||
$run_fio &
|
||||
last_pid=$!
|
||||
sleep 3
|
||||
$rpc_py remove_vhost_scsi_target naa.Nvme0n1p4.2 0
|
||||
$rpc_py vhost_scsi_controller_remove_target naa.Nvme0n1p4.2 0
|
||||
set +xe
|
||||
wait $last_pid
|
||||
check_fio_retcode "Hotdetach test case 1: Iteration 1." 1 $?
|
||||
@ -165,7 +165,7 @@ function hotdetach_tc2() {
|
||||
$run_fio &
|
||||
last_pid=$!
|
||||
sleep 3
|
||||
$rpc_py remove_vhost_scsi_target naa.Nvme0n1p4.2 0
|
||||
$rpc_py vhost_scsi_controller_remove_target naa.Nvme0n1p4.2 0
|
||||
set +xe
|
||||
wait $last_pid
|
||||
check_fio_retcode "Hotdetach test case 2: Iteration 1." 1 $?
|
||||
@ -187,7 +187,7 @@ function hotdetach_tc3() {
|
||||
$run_fio &
|
||||
last_pid=$!
|
||||
sleep 3
|
||||
$rpc_py remove_vhost_scsi_target naa.Nvme0n1p4.2 0
|
||||
$rpc_py vhost_scsi_controller_remove_target naa.Nvme0n1p4.2 0
|
||||
wait $last_pid
|
||||
check_fio_retcode "Hotdetach test case 3: Iteration 1." 0 $?
|
||||
second_disk=""
|
||||
@ -212,7 +212,7 @@ function hotdetach_tc4() {
|
||||
$run_fio &
|
||||
second_fio_pid=$!
|
||||
sleep 3
|
||||
$rpc_py remove_vhost_scsi_target naa.Nvme0n1p4.2 0
|
||||
$rpc_py vhost_scsi_controller_remove_target naa.Nvme0n1p4.2 0
|
||||
set +xe
|
||||
wait $first_fio_pid
|
||||
check_fio_retcode "Hotdetach test case 4: Iteration 1." 1 $?
|
||||
|
@ -35,14 +35,14 @@ function pre_hot_attach_detach_test_case() {
|
||||
}
|
||||
|
||||
function clear_vhost_config() {
|
||||
$rpc_py remove_vhost_scsi_target naa.Nvme0n1p4.2 0
|
||||
$rpc_py remove_vhost_scsi_target naa.Nvme0n1p4.2 1
|
||||
$rpc_py remove_vhost_scsi_target naa.Nvme0n1p5.2 0
|
||||
$rpc_py remove_vhost_scsi_target naa.Nvme0n1p5.2 1
|
||||
$rpc_py remove_vhost_scsi_target naa.Nvme0n1p6.3 0
|
||||
$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 vhost_scsi_controller_remove_target naa.Nvme0n1p4.2 0
|
||||
$rpc_py vhost_scsi_controller_remove_target naa.Nvme0n1p4.2 1
|
||||
$rpc_py vhost_scsi_controller_remove_target naa.Nvme0n1p5.2 0
|
||||
$rpc_py vhost_scsi_controller_remove_target naa.Nvme0n1p5.2 1
|
||||
$rpc_py vhost_scsi_controller_remove_target naa.Nvme0n1p6.3 0
|
||||
$rpc_py vhost_scsi_controller_remove_target naa.Nvme0n1p6.3 1
|
||||
$rpc_py vhost_scsi_controller_remove_target naa.Nvme0n1p7.3 0
|
||||
$rpc_py vhost_scsi_controller_remove_target naa.Nvme0n1p7.3 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
|
||||
|
@ -206,8 +206,8 @@ function scsi_hotremove_tc4() {
|
||||
vm_shutdown_all
|
||||
add_nvme "HotInNvme3" "$traddr"
|
||||
sleep 1
|
||||
$rpc_py remove_vhost_scsi_target naa.Nvme0n1p1.0 0
|
||||
$rpc_py remove_vhost_scsi_target naa.Nvme0n1p3.1 0
|
||||
$rpc_py vhost_scsi_controller_remove_target naa.Nvme0n1p1.0 0
|
||||
$rpc_py vhost_scsi_controller_remove_target naa.Nvme0n1p3.1 0
|
||||
}
|
||||
|
||||
function pre_scsi_hotremove_test_case() {
|
||||
|
@ -259,7 +259,7 @@ if [[ "$ctrl_type" == "spdk_vhost_scsi" ]]; then
|
||||
for (( i=0; i<$vm_count; i++)); do
|
||||
notice "Removing devices from vhost SCSI controller naa.0.$i"
|
||||
for (( j=0; j<${#bdevs[@]}; j++)); do
|
||||
$rpc_py remove_vhost_scsi_target naa.0.$i $j
|
||||
$rpc_py vhost_scsi_controller_remove_target naa.0.$i $j
|
||||
notice "Removed device $j"
|
||||
done
|
||||
notice "Removing vhost SCSI controller naa.0.$i"
|
||||
|
@ -88,7 +88,7 @@ if [[ $RUN_NIGHTLY -eq 1 ]]; then
|
||||
fi
|
||||
|
||||
notice "Trying to remove device from nonexistent scsi controller"
|
||||
if $rpc_py remove_vhost_scsi_target vhost.nonexistent.name 0; then
|
||||
if $rpc_py vhost_scsi_controller_remove_target vhost.nonexistent.name 0; then
|
||||
error "Removing device from nonexistent scsi controller succeeded, but it shouldn't"
|
||||
fi
|
||||
|
||||
@ -109,15 +109,15 @@ if [[ $RUN_NIGHTLY -eq 1 ]]; then
|
||||
$rpc_py vhost_scsi_controller_add_target naa.0 0 Malloc0
|
||||
|
||||
notice "Trying to remove nonexistent device on existing controller"
|
||||
if $rpc_py remove_vhost_scsi_target naa.0 1 > /dev/null; then
|
||||
if $rpc_py vhost_scsi_controller_remove_target naa.0 1 > /dev/null; then
|
||||
error "Removing nonexistent device (1) from controller naa.0 succeeded, but it shouldn't"
|
||||
fi
|
||||
|
||||
notice "Trying to remove existing device from a controller"
|
||||
$rpc_py remove_vhost_scsi_target naa.0 0
|
||||
$rpc_py vhost_scsi_controller_remove_target naa.0 0
|
||||
|
||||
notice "Trying to remove a just-deleted device from a controller again"
|
||||
if $rpc_py remove_vhost_scsi_target naa.0 0 > /dev/null; then
|
||||
if $rpc_py vhost_scsi_controller_remove_target naa.0 0 > /dev/null; then
|
||||
error "Removing device 0 from controller naa.0 succeeded, but it shouldn't"
|
||||
fi
|
||||
|
||||
|
@ -17,7 +17,7 @@ function err_clean
|
||||
set +e
|
||||
error "Error on $1 $2"
|
||||
vm_kill_all
|
||||
$rpc_py remove_vhost_scsi_target naa.vhost_vm.$vm_no 0
|
||||
$rpc_py vhost_scsi_controller_remove_target naa.vhost_vm.$vm_no 0
|
||||
$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
|
||||
@ -115,7 +115,7 @@ timing_exit run_vm_cmd
|
||||
vm_shutdown_all
|
||||
|
||||
timing_enter clean_vhost
|
||||
$rpc_py remove_vhost_scsi_target naa.vhost_vm.$vm_no 0
|
||||
$rpc_py vhost_scsi_controller_remove_target naa.vhost_vm.$vm_no 0
|
||||
$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
|
||||
|
Loading…
Reference in New Issue
Block a user