rpc: Rename construct_vhost_blk_controller to vhost_create_blk_controller

Change-Id: I49e5a24f89566ecf95e2df15e43d589f7ef3badb
Signed-off-by: Pawel Kaminski <pawelx.kaminski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/469861
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
Pawel Kaminski 2019-09-30 06:51:55 -04:00 committed by Jim Harris
parent 8fbf2b687f
commit d7c00c1725
26 changed files with 73 additions and 69 deletions

View File

@ -4580,9 +4580,9 @@ Example response:
}
~~~
## construct_vhost_blk_controller {#rpc_construct_vhost_blk_controller}
## vhost_create_blk_controller {#rpc_vhost_create_blk_controller}
Construct vhost block controller
Create vhost block controller
If `readonly` is `true` then vhost block target will be created as read only and fail any write requests.
The `VIRTIO_BLK_F_RO` feature flag will be offered to the initiator.
@ -4608,7 +4608,7 @@ Example request:
"ctrlr": "VhostBlk0"
},
"jsonrpc": "2.0",
"method": "construct_vhost_blk_controller",
"method": "vhost_create_blk_controller",
"id": 1
}
~~~

View File

@ -161,14 +161,14 @@ always CPU 0. For NUMA systems, the cpumask should specify cores on the same CPU
socket as its associated VM.
~~~{.sh}
scripts/rpc.py construct_vhost_blk_controller --cpumask 0x1 vhost.1 Malloc0
scripts/rpc.py vhost_create_blk_controller --cpumask 0x1 vhost.1 Malloc0
~~~
It is also possible to construct a read-only vhost-blk device by specifying an
It is also possible to create a read-only vhost-blk device by specifying an
extra `-r` or `--readonly` parameter.
~~~{.sh}
scripts/rpc.py construct_vhost_blk_controller --cpumask 0x1 -r vhost.1 Malloc0
scripts/rpc.py vhost_create_blk_controller --cpumask 0x1 -r vhost.1 Malloc0
~~~
### Vhost-NVMe (experimental)
@ -295,7 +295,7 @@ Malloc1
~~~
~~~{.sh}
host:~# ./scripts/rpc.py construct_vhost_blk_controller --cpumask 0x2 vhost.1 Malloc1
host:~# ./scripts/rpc.py vhost_create_blk_controller --cpumask 0x2 vhost.1 Malloc1
vhost_blk.c: 719:spdk_vhost_blk_construct: *NOTICE*: Controller vhost.1: using bdev 'Malloc1'
~~~

View File

@ -807,7 +807,7 @@ vhost_blk_write_config_json(struct spdk_vhost_dev *vdev, struct spdk_json_write_
}
spdk_json_write_object_begin(w);
spdk_json_write_named_string(w, "method", "construct_vhost_blk_controller");
spdk_json_write_named_string(w, "method", "vhost_create_blk_controller");
spdk_json_write_named_object_begin(w, "params");
spdk_json_write_named_string(w, "ctrlr", vdev->name);

View File

@ -260,8 +260,8 @@ free_rpc_vhost_blk_ctrlr(struct rpc_vhost_blk_ctrlr *req)
}
static void
spdk_rpc_construct_vhost_blk_controller(struct spdk_jsonrpc_request *request,
const struct spdk_json_val *params)
spdk_rpc_vhost_create_blk_controller(struct spdk_jsonrpc_request *request,
const struct spdk_json_val *params)
{
struct rpc_vhost_blk_ctrlr req = {0};
struct spdk_json_write_ctx *w;
@ -293,8 +293,9 @@ invalid:
spdk_strerror(-rc));
}
SPDK_RPC_REGISTER("construct_vhost_blk_controller", spdk_rpc_construct_vhost_blk_controller,
SPDK_RPC_REGISTER("vhost_create_blk_controller", spdk_rpc_vhost_create_blk_controller,
SPDK_RPC_RUNTIME)
SPDK_RPC_REGISTER_ALIAS_DEPRECATED(vhost_create_blk_controller, construct_vhost_blk_controller)
struct rpc_delete_vhost_ctrlr {
char *ctrlr;

View File

@ -19,7 +19,7 @@ bdev_dict["bdev_virtio_attach_controller"] = []
vhost_dict = OrderedDict()
vhost_dict["vhost_create_scsi_controller"] = []
vhost_dict["construct_vhost_blk_controller"] = []
vhost_dict["vhost_create_blk_controller"] = []
vhost_dict["vhost_create_nvme_controller"] = []
iscsi_dict = OrderedDict()
@ -434,7 +434,7 @@ def get_vhost_blk_json(config, section):
]
for option in config.options(section):
set_param(params, option, config.get(section, option))
return [{"method": "construct_vhost_blk_controller",
return [{"method": "vhost_create_blk_controller",
"params": to_json_params(params)}]

View File

@ -1900,19 +1900,21 @@ Format: 'user:u1 secret:s1 muser:mu1 msecret:ms1,user:u2 secret:s2 muser:mu2 mse
p.add_argument('scsi_target_num', help='scsi_target_num', type=int)
p.set_defaults(func=vhost_scsi_controller_remove_target)
def construct_vhost_blk_controller(args):
rpc.vhost.construct_vhost_blk_controller(args.client,
ctrlr=args.ctrlr,
dev_name=args.dev_name,
cpumask=args.cpumask,
readonly=args.readonly)
def vhost_create_blk_controller(args):
rpc.vhost.vhost_create_blk_controller(args.client,
ctrlr=args.ctrlr,
dev_name=args.dev_name,
cpumask=args.cpumask,
readonly=args.readonly)
p = subparsers.add_parser('construct_vhost_blk_controller', help='Add a new vhost block controller')
p = subparsers.add_parser('vhost_create_blk_controller',
aliases=['construct_vhost_blk_controller'],
help='Add a new vhost block controller')
p.add_argument('ctrlr', help='controller name')
p.add_argument('dev_name', help='device name')
p.add_argument('--cpumask', help='cpu mask for this controller')
p.add_argument("-r", "--readonly", action='store_true', help='Set controller as read-only')
p.set_defaults(func=construct_vhost_blk_controller)
p.set_defaults(func=vhost_create_blk_controller)
def vhost_create_nvme_controller(args):
rpc.vhost.vhost_create_nvme_controller(args.client,

View File

@ -96,8 +96,9 @@ def vhost_nvme_controller_add_ns(client, ctrlr, bdev_name):
return client.call('vhost_nvme_controller_add_ns', params)
def construct_vhost_blk_controller(client, ctrlr, dev_name, cpumask=None, readonly=None):
"""Construct vhost BLK controller.
@deprecated_alias('construct_vhost_blk_controller')
def vhost_create_blk_controller(client, ctrlr, dev_name, cpumask=None, readonly=None):
"""Create vhost BLK controller.
Args:
ctrlr: controller name
dev_name: device name to add to controller
@ -112,7 +113,7 @@ def construct_vhost_blk_controller(client, ctrlr, dev_name, cpumask=None, readon
params['cpumask'] = cpumask
if readonly:
params['readonly'] = readonly
return client.call('construct_vhost_blk_controller', params)
return client.call('vhost_create_blk_controller', params)
@deprecated_alias('get_vhost_controllers')

View File

@ -683,7 +683,7 @@ class UIVhostBlk(UIVhost):
def ui_command_create(self, name, bdev, cpumask=None, readonly=False):
"""
Construct a Vhost BLK controller.
Create a Vhost BLK controller.
Arguments:
name - Controller name.
@ -693,7 +693,7 @@ class UIVhostBlk(UIVhost):
readonly - Whether controller should be read only or not.
Default: False.
"""
self.get_root().create_vhost_blk_controller(ctrlr=name,
self.get_root().vhost_create_blk_controller(ctrlr=name,
dev_name=bdev,
cpumask=cpumask,
readonly=bool(readonly))

View File

@ -286,8 +286,8 @@ class UIRoot(UINode):
rpc.vhost.vhost_create_scsi_controller(self.client, **kwargs)
@verbose
def create_vhost_blk_controller(self, **kwargs):
rpc.vhost.construct_vhost_blk_controller(self.client, **kwargs)
def vhost_create_blk_controller(self, **kwargs):
rpc.vhost.vhost_create_blk_controller(self.client, **kwargs)
@verbose
def vhost_scsi_controller_remove_target(self, **kwargs):

View File

@ -366,7 +366,7 @@
"ctrlr": "vhost.1",
"cpumask": "1"
},
"method": "construct_vhost_blk_controller"
"method": "vhost_create_blk_controller"
},
{
"params": {
@ -375,7 +375,7 @@
"ctrlr": "naa.vhost.2",
"cpumask": "1"
},
"method": "construct_vhost_blk_controller"
"method": "vhost_create_blk_controller"
},
{
"params": {

View File

@ -43,7 +43,7 @@ trap 'killprocess $vhostpid; killprocess $fuzzpid; exit 1' SIGINT SIGTERM exit
if [ "$TEST_TRANSPORT" == "bdev" ] || [ "$TEST_TRANSPORT" == "all" ]; then
$vhost_rpc_py bdev_malloc_create -b Malloc0 64 512
$vhost_rpc_py construct_vhost_blk_controller Vhost.1 Malloc0
$vhost_rpc_py vhost_create_blk_controller Vhost.1 Malloc0
# test the vhost blk controller with valid data buffers.
$fuzz_specific_rpc_py fuzz_vhost_create_dev -s $(pwd)/Vhost.1 -b -v

View File

@ -148,7 +148,7 @@ def clear_vhost_subsystem(args, vhost_config):
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',
elif method in ['vhost_create_scsi_controller', 'vhost_create_blk_controller',
'vhost_create_nvme_controller']:
args.client.call("vhost_delete_controller", {'ctrlr': vhost['params']['ctrlr']})

View File

@ -286,7 +286,7 @@ function create_vhost_subsystem_config() {
tgt_rpc vhost_scsi_controller_add_target VhostScsiCtrlr0 -1 MallocForVhost0p4
tgt_rpc vhost_controller_set_coalescing VhostScsiCtrlr0 1 100
tgt_rpc construct_vhost_blk_controller VhostBlkCtrlr0 MallocForVhost0p5
tgt_rpc vhost_create_blk_controller VhostBlkCtrlr0 MallocForVhost0p5
# FIXME: enable after vhost-nvme is properly implemented against the latest rte_vhost (DPDK 19.05+)
# tgt_rpc vhost_create_nvme_controller VhostNvmeCtrlr0 16

View File

@ -24,9 +24,9 @@ vhost_rpc vhost0 construct_malloc_bdev $MALLOC_BDEV_SIZE $MALLOC_BLOCK_SIZE -b M
vhost_rpc vhost0 vhost_create_scsi_controller naa.VhostScsi0.0
vhost_rpc vhost0 vhost_scsi_controller_add_target naa.VhostScsi0.0 0 "Malloc0"
# Construct vhost blk controller
# Create vhost blk controller
vhost_rpc vhost0 construct_malloc_bdev $MALLOC_BDEV_SIZE $MALLOC_BLOCK_SIZE -b Malloc1
vhost_rpc vhost0 construct_vhost_blk_controller naa.Malloc1.1 Malloc1
vhost_rpc vhost0 vhost_create_blk_controller naa.Malloc1.1 Malloc1
# Start qemu based VMs
vm_setup --os="$VM_IMAGE" --disk-type=spdk_vhost_scsi --disks="VhostScsi0" --vhost-name=vhost0 --force=0

View File

@ -148,7 +148,7 @@
"ctrlr": "vhost.1",
"cpumask": "0x1"
},
"method": "construct_vhost_blk_controller"
"method": "vhost_create_blk_controller"
}
]
}

View File

@ -126,7 +126,7 @@ for vm_conf in ${vms[@]}; do
if [[ "$test_type" == "spdk_vhost_blk" ]]; then
disk=${disk%%_*}
notice "Creating vhost block controller naa.$disk.${conf[0]} with device $disk"
$rpc_py construct_vhost_blk_controller naa.$disk.${conf[0]} $based_disk
$rpc_py vhost_create_blk_controller naa.$disk.${conf[0]} $based_disk
else
notice "Creating controller naa.$disk.${conf[0]}"
$rpc_py vhost_create_scsi_controller naa.$disk.${conf[0]}

View File

@ -28,7 +28,7 @@ waitforlisten $fuzzpid $FUZZ_RPC_SOCK
trap 'killprocess $vhostpid; killprocess $fuzzpid; exit 1' SIGINT SIGTERM exit
$vhost_rpc_py bdev_malloc_create -b Malloc0 64 512
$vhost_rpc_py construct_vhost_blk_controller Vhost.1 Malloc0
$vhost_rpc_py vhost_create_blk_controller Vhost.1 Malloc0
$vhost_rpc_py bdev_malloc_create -b Malloc1 64 512
$vhost_rpc_py vhost_create_scsi_controller naa.VhostScsi0.1

View File

@ -57,10 +57,10 @@ function blk_hotremove_tc1() {
function blk_hotremove_tc2() {
echo "Blk hotremove test case 2"
# 1. Use rpc command to create blk controllers.
$rpc_py construct_vhost_blk_controller naa.Nvme0n1p0.0 HotInNvme0n1p0
$rpc_py construct_vhost_blk_controller naa.Nvme0n1p1.0 Mallocp0
$rpc_py construct_vhost_blk_controller naa.Nvme0n1p2.1 Mallocp1
$rpc_py construct_vhost_blk_controller naa.Nvme0n1p3.1 Mallocp2
$rpc_py vhost_create_blk_controller naa.Nvme0n1p0.0 HotInNvme0n1p0
$rpc_py vhost_create_blk_controller naa.Nvme0n1p1.0 Mallocp0
$rpc_py vhost_create_blk_controller naa.Nvme0n1p2.1 Mallocp1
$rpc_py vhost_create_blk_controller naa.Nvme0n1p3.1 Mallocp2
# 2. Run two VMs and attach every VM to two blk controllers.
vm_run_with_arg "0 1"
vms_prepare "0"
@ -99,10 +99,10 @@ function blk_hotremove_tc2() {
function blk_hotremove_tc3() {
echo "Blk hotremove test case 3"
# 1. Use rpc command to create blk controllers.
$rpc_py construct_vhost_blk_controller naa.Nvme0n1p0.0 HotInNvme1n1p0
$rpc_py construct_vhost_blk_controller naa.Nvme0n1p1.0 Mallocp0
$rpc_py construct_vhost_blk_controller naa.Nvme0n1p2.1 HotInNvme1n1p1
$rpc_py construct_vhost_blk_controller naa.Nvme0n1p3.1 Mallocp1
$rpc_py vhost_create_blk_controller naa.Nvme0n1p0.0 HotInNvme1n1p0
$rpc_py vhost_create_blk_controller naa.Nvme0n1p1.0 Mallocp0
$rpc_py vhost_create_blk_controller naa.Nvme0n1p2.1 HotInNvme1n1p1
$rpc_py vhost_create_blk_controller naa.Nvme0n1p3.1 Mallocp1
# 2. Run two VMs and attach every VM to two blk controllers.
vm_run_with_arg "0 1"
vms_prepare "0 1"
@ -141,10 +141,10 @@ function blk_hotremove_tc3() {
function blk_hotremove_tc4() {
echo "Blk hotremove test case 4"
# 1. Use rpc command to create blk controllers.
$rpc_py construct_vhost_blk_controller naa.Nvme0n1p0.0 HotInNvme2n1p0
$rpc_py construct_vhost_blk_controller naa.Nvme0n1p1.0 Mallocp0
$rpc_py construct_vhost_blk_controller naa.Nvme0n1p2.1 HotInNvme2n1p1
$rpc_py construct_vhost_blk_controller naa.Nvme0n1p3.1 Mallocp1
$rpc_py vhost_create_blk_controller naa.Nvme0n1p0.0 HotInNvme2n1p0
$rpc_py vhost_create_blk_controller naa.Nvme0n1p1.0 Mallocp0
$rpc_py vhost_create_blk_controller naa.Nvme0n1p2.1 HotInNvme2n1p1
$rpc_py vhost_create_blk_controller naa.Nvme0n1p3.1 Mallocp1
# 2. Run two VM, attached to blk controllers.
vm_run_with_arg "0 1"
vms_prepare "0 1"
@ -192,10 +192,10 @@ function blk_hotremove_tc4() {
function blk_hotremove_tc5() {
echo "Blk hotremove test case 5"
# 1. Use rpc command to create blk controllers.
$rpc_py construct_vhost_blk_controller naa.Nvme0n1p0.0 HotInNvme3n1p0
$rpc_py construct_vhost_blk_controller naa.Nvme0n1p1.0 Mallocp0
$rpc_py construct_vhost_blk_controller naa.Nvme0n1p2.1 Mallocp1
$rpc_py construct_vhost_blk_controller naa.Nvme0n1p3.1 Mallocp2
$rpc_py vhost_create_blk_controller naa.Nvme0n1p0.0 HotInNvme3n1p0
$rpc_py vhost_create_blk_controller naa.Nvme0n1p1.0 Mallocp0
$rpc_py vhost_create_blk_controller naa.Nvme0n1p2.1 Mallocp1
$rpc_py vhost_create_blk_controller naa.Nvme0n1p3.1 Mallocp2
# 2. Run two VM, attached to blk controllers.
vm_run_with_arg "0 1"
vms_prepare "0 1"

View File

@ -71,8 +71,8 @@ function create_bdev_config()
$RPC_PY vhost_scsi_controller_add_target naa.Nvme0n1_scsi0.0 2 Nvme0n1p2
$RPC_PY vhost_scsi_controller_add_target naa.Nvme0n1_scsi0.0 3 Nvme0n1p3
$RPC_PY construct_vhost_blk_controller naa.Nvme0n1_blk0.0 Nvme0n1p4
$RPC_PY construct_vhost_blk_controller naa.Nvme0n1_blk1.0 Nvme0n1p5
$RPC_PY vhost_create_blk_controller naa.Nvme0n1_blk0.0 Nvme0n1p4
$RPC_PY vhost_create_blk_controller naa.Nvme0n1_blk1.0 Nvme0n1p5
$RPC_PY bdev_malloc_create 128 512 --name Malloc0
$RPC_PY vhost_create_scsi_controller naa.Malloc0.0

View File

@ -65,7 +65,7 @@ notice "..."
# Set up lvols and vhost controllers
trap 'clean_lvol_cfg; error_exit "${FUNCNAME}" "${LINENO}"' SIGTERM SIGABRT ERR
notice "Constructing lvol store and lvol bdev on top of Nvme0n1"
notice "Creating lvol store and lvol bdev on top of Nvme0n1"
lvs_uuid=$($rpc_py bdev_lvol_create_lvstore Nvme0n1 lvol_store)
$rpc_py bdev_lvol_create lvol_bdev 10000 -l lvol_store
@ -73,7 +73,7 @@ if [[ "$ctrl_type" == "spdk_vhost_scsi" ]]; then
$rpc_py vhost_create_scsi_controller naa.Nvme0n1.0
$rpc_py vhost_scsi_controller_add_target naa.Nvme0n1.0 0 lvol_store/lvol_bdev
elif [[ "$ctrl_type" == "spdk_vhost_blk" ]]; then
$rpc_py construct_vhost_blk_controller naa.Nvme0n1.0 lvol_store/lvol_bdev
$rpc_py vhost_create_blk_controller naa.Nvme0n1.0 lvol_store/lvol_bdev
fi
# Set up and run VM

View File

@ -205,7 +205,7 @@ for (( i=0; i<$vm_count; i++)); do
elif [[ "$ctrl_type" == "spdk_vhost_blk" ]]; then
disk=""
for (( j=0; j<${#bdevs[@]}; j++)); do
$rpc_py construct_vhost_blk_controller naa.$j.$i ${bdevs[$j]} $mask_arg
$rpc_py vhost_create_blk_controller naa.$j.$i ${bdevs[$j]} $mask_arg
disk+="${j}:"
done
disk="${disk::-1}"

View File

@ -126,7 +126,7 @@ if [[ $RUN_NIGHTLY -eq 1 ]]; then
# BLK
notice "Trying to create block controller with incorrect cpumask"
if $rpc_py construct_vhost_blk_controller vhost.invalid.cpumask Malloc0 --cpumask 0x2; then
if $rpc_py vhost_create_blk_controller vhost.invalid.cpumask Malloc0 --cpumask 0x2; then
error "Creating block controller with incorrect cpumask succeeded, but it shouldn't"
fi
@ -136,7 +136,7 @@ if [[ $RUN_NIGHTLY -eq 1 ]]; then
fi
notice "Trying to create block controller with incorrect name"
if $rpc_py construct_vhost_blk_controller . Malloc0; then
if $rpc_py vhost_create_blk_controller . Malloc0; then
error "Creating block controller with incorrect name succeeded, but it shouldn't"
fi

View File

@ -287,7 +287,7 @@ for (( i=0; i<$vm_count; i++)); do
$rpc_py vhost_scsi_controller_add_target naa.0.$i 0 ${bdevs[$i]}
setup_cmd+=" --disks=0"
elif [[ "$ctrl_type" == "spdk_vhost_blk" ]]; then
$rpc_py construct_vhost_blk_controller naa.$i.$i ${bdevs[$i]}
$rpc_py vhost_create_blk_controller naa.$i.$i ${bdevs[$i]}
setup_cmd+=" --disks=$i"
elif [[ "$ctrl_type" == "kernel_vhost" ]]; then
x=$(printf %03d $i)

View File

@ -84,7 +84,7 @@ function blk_ro_tc1()
#Create controller and create file on disk for later test
notice "Creating vhost_blk controller"
vhost_blk_name="naa.$disk_name.$vm_no"
$rpc_py construct_vhost_blk_controller $vhost_blk_name $disk_name
$rpc_py vhost_create_blk_controller $vhost_blk_name $disk_name
vm_setup --disk-type=spdk_vhost_blk --force=$vm_no --os=$vm_img --disks=$disk --read-only=true
vm_run $vm_no
@ -97,7 +97,7 @@ function blk_ro_tc1()
#Create readonly controller and test readonly feature
notice "Removing controller and creating new one with readonly flag"
$rpc_py vhost_delete_controller $vhost_blk_name
$rpc_py construct_vhost_blk_controller -r $vhost_blk_name $disk_name
$rpc_py vhost_create_blk_controller -r $vhost_blk_name $disk_name
vm_run $vm_no
vm_wait_for_boot 300 $vm_no
@ -109,7 +109,7 @@ function blk_ro_tc1()
#Delete file from disk and delete partition
echo "INFO: Removing controller and creating new one"
$rpc_py vhost_delete_controller $vhost_blk_name
$rpc_py construct_vhost_blk_controller $vhost_blk_name $disk_name
$rpc_py vhost_create_blk_controller $vhost_blk_name $disk_name
vm_run $vm_no
vm_wait_for_boot 300 $vm_no

View File

@ -20,7 +20,7 @@ trap 'error_exit "${FUNCNAME}" "${LINENO}"' ERR SIGTERM SIGABRT
vhost_run 0
$rpc_py bdev_malloc_create -b Malloc 124 4096
$rpc_py construct_vhost_blk_controller Malloc.0 Malloc
$rpc_py vhost_create_blk_controller Malloc.0 Malloc
run_spdk_fio --size=50% --offset=0 --filename=VirtioBlk0 &
run_fio_pid=$!

View File

@ -111,9 +111,9 @@ if [[ "$ctrl_type" == "spdk_vhost_scsi" ]]; then
$rpc_py vhost_scsi_controller_add_target naa.0.0 2 Aio0
setup_cmd+=" --disk-type=spdk_vhost_scsi --disks=0"
elif [[ "$ctrl_type" == "spdk_vhost_blk" ]]; then
$rpc_py construct_vhost_blk_controller naa.0.0 Nvme0n1
$rpc_py construct_vhost_blk_controller naa.1.0 Malloc0
$rpc_py construct_vhost_blk_controller naa.2.0 Aio0
$rpc_py vhost_create_blk_controller naa.0.0 Nvme0n1
$rpc_py vhost_create_blk_controller naa.1.0 Malloc0
$rpc_py vhost_create_blk_controller naa.2.0 Aio0
setup_cmd+=" --disk-type=spdk_vhost_blk --disks=0:1:2"
fi
$rpc_py vhost_get_controllers