rpc: rename get_vhost_controllers to vhost_get_controllers

Change-Id: I597da89241c221e82f11cf843d1e726613b9a768
Signed-off-by: Pawel Kaminski <pawelx.kaminski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/469869
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
Pawel Kaminski 2019-09-30 08:00:12 -04:00 committed by Jim Harris
parent bb9d17a5c3
commit 2976fbd2a3
9 changed files with 30 additions and 27 deletions

View File

@ -4623,7 +4623,7 @@ Example response:
} }
~~~ ~~~
## get_vhost_controllers {#rpc_get_vhost_controllers} ## vhost_get_controllers {#rpc_vhost_get_controllers}
Display information about all or specific vhost controller(s). Display information about all or specific vhost controller(s).
@ -4637,7 +4637,7 @@ Name | Optional | Type | Description
name | Optional | string | Vhost controller name name | Optional | string | Vhost controller name
### Response {#rpc_get_vhost_controllers_response} ### Response {#rpc_vhost_get_controllers_response}
Response is an array of objects describing requested controller(s). Common fields are: Response is an array of objects describing requested controller(s). Common fields are:
@ -4649,7 +4649,7 @@ delay_base_us | number | Base (minimum) coalescing time in micros
iops_threshold | number | Coalescing activation level iops_threshold | number | Coalescing activation level
backend_specific | object | Backend specific informations backend_specific | object | Backend specific informations
### Vhost block {#rpc_get_vhost_controllers_blk} ### Vhost block {#rpc_vhost_get_controllers_blk}
`backend_specific` contains one `block` object of type: `backend_specific` contains one `block` object of type:
@ -4658,7 +4658,7 @@ Name | Type | Description
bdev | string | Backing bdev name or Null if bdev is hot-removed bdev | string | Backing bdev name or Null if bdev is hot-removed
readonly | boolean | True if controllers is readonly, false otherwise readonly | boolean | True if controllers is readonly, false otherwise
### Vhost SCSI {#rpc_get_vhost_controllers_scsi} ### Vhost SCSI {#rpc_vhost_get_controllers_scsi}
`backend_specific` contains `scsi` array of following objects: `backend_specific` contains `scsi` array of following objects:
@ -4667,9 +4667,9 @@ Name | Type | Description
target_name | string | Name of this SCSI target target_name | string | Name of this SCSI target
id | number | Unique SPDK global SCSI target ID id | number | Unique SPDK global SCSI target ID
scsi_dev_num | number | SCSI target ID initiator will see when scanning this controller scsi_dev_num | number | SCSI target ID initiator will see when scanning this controller
luns | array | array of objects describing @ref rpc_get_vhost_controllers_scsi_luns luns | array | array of objects describing @ref rpc_vhost_get_controllers_scsi_luns
### Vhost SCSI LUN {#rpc_get_vhost_controllers_scsi_luns} ### Vhost SCSI LUN {#rpc_vhost_get_controllers_scsi_luns}
Object of type: Object of type:
@ -4678,7 +4678,7 @@ Name | Type | Description
id | number | SCSI LUN ID id | number | SCSI LUN ID
bdev_name | string | Backing bdev name bdev_name | string | Backing bdev name
### Vhost NVMe {#rpc_get_vhost_controllers_nvme} ### Vhost NVMe {#rpc_vhost_get_controllers_nvme}
`backend_specific` contains `namespaces` array of following objects: `backend_specific` contains `namespaces` array of following objects:
@ -4694,7 +4694,7 @@ Example request:
~~~ ~~~
{ {
"jsonrpc": "2.0", "jsonrpc": "2.0",
"method": "get_vhost_controllers", "method": "vhost_get_controllers",
"id": 1 "id": 1
} }
~~~ ~~~

View File

@ -394,7 +394,7 @@ free_rpc_get_vhost_ctrlrs(struct rpc_get_vhost_ctrlrs *req)
} }
static void static void
spdk_rpc_get_vhost_controllers(struct spdk_jsonrpc_request *request, spdk_rpc_vhost_get_controllers(struct spdk_jsonrpc_request *request,
const struct spdk_json_val *params) const struct spdk_json_val *params)
{ {
struct rpc_get_vhost_ctrlrs req = {0}; struct rpc_get_vhost_ctrlrs req = {0};
@ -452,7 +452,8 @@ invalid:
spdk_jsonrpc_send_error_response(request, SPDK_JSONRPC_ERROR_INTERNAL_ERROR, spdk_jsonrpc_send_error_response(request, SPDK_JSONRPC_ERROR_INTERNAL_ERROR,
spdk_strerror(-rc)); spdk_strerror(-rc));
} }
SPDK_RPC_REGISTER("get_vhost_controllers", spdk_rpc_get_vhost_controllers, SPDK_RPC_RUNTIME) SPDK_RPC_REGISTER("vhost_get_controllers", spdk_rpc_vhost_get_controllers, SPDK_RPC_RUNTIME)
SPDK_RPC_REGISTER_ALIAS_DEPRECATED(vhost_get_controllers, get_vhost_controllers)
struct rpc_vhost_ctrlr_coalescing { struct rpc_vhost_ctrlr_coalescing {

View File

@ -1938,12 +1938,13 @@ Format: 'user:u1 secret:s1 muser:mu1 msecret:ms1,user:u2 secret:s2 muser:mu2 mse
p.add_argument('bdev_name', help='block device name for a new Namespace') p.add_argument('bdev_name', help='block device name for a new Namespace')
p.set_defaults(func=vhost_nvme_controller_add_ns) p.set_defaults(func=vhost_nvme_controller_add_ns)
def get_vhost_controllers(args): def vhost_get_controllers(args):
print_dict(rpc.vhost.get_vhost_controllers(args.client, args.name)) print_dict(rpc.vhost.vhost_get_controllers(args.client, args.name))
p = subparsers.add_parser('get_vhost_controllers', help='List all or specific vhost controller(s)') p = subparsers.add_parser('vhost_get_controllers', aliases=['get_vhost_controllers'],
help='List all or specific vhost controller(s)')
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=vhost_get_controllers)
def vhost_delete_controller(args): def vhost_delete_controller(args):
rpc.vhost.vhost_delete_controller(args.client, rpc.vhost.vhost_delete_controller(args.client,

View File

@ -115,7 +115,8 @@ def construct_vhost_blk_controller(client, ctrlr, dev_name, cpumask=None, readon
return client.call('construct_vhost_blk_controller', params) return client.call('construct_vhost_blk_controller', params)
def get_vhost_controllers(client, name=None): @deprecated_alias('get_vhost_controllers')
def vhost_get_controllers(client, name=None):
"""Get information about configured vhost controllers. """Get information about configured vhost controllers.
Args: Args:
@ -127,7 +128,7 @@ def get_vhost_controllers(client, name=None):
params = {} params = {}
if name: if name:
params['name'] = name params['name'] = name
return client.call('get_vhost_controllers', params) return client.call('vhost_get_controllers', params)
@deprecated_alias('remove_vhost_controller') @deprecated_alias('remove_vhost_controller')

View File

@ -678,7 +678,7 @@ class UIVhostBlk(UIVhost):
def refresh(self): def refresh(self):
self._children = set([]) self._children = set([])
for ctrlr in self.get_root().get_vhost_controllers(ctrlr_type=self.name): for ctrlr in self.get_root().vhost_get_controllers(ctrlr_type=self.name):
UIVhostBlkCtrlObj(ctrlr, self) UIVhostBlkCtrlObj(ctrlr, self)
def ui_command_create(self, name, bdev, cpumask=None, readonly=False): def ui_command_create(self, name, bdev, cpumask=None, readonly=False):
@ -706,7 +706,7 @@ class UIVhostScsi(UIVhost):
def refresh(self): def refresh(self):
self._children = set([]) self._children = set([])
for ctrlr in self.get_root().get_vhost_controllers(ctrlr_type=self.name): for ctrlr in self.get_root().vhost_get_controllers(ctrlr_type=self.name):
UIVhostScsiCtrlObj(ctrlr, self) UIVhostScsiCtrlObj(ctrlr, self)
def ui_command_create(self, name, cpumask=None): def ui_command_create(self, name, cpumask=None):
@ -756,7 +756,7 @@ class UIVhostScsiCtrlObj(UIVhostCtrl):
""" """
self.get_root().vhost_scsi_controller_remove_target(ctrlr=self.ctrlr.ctrlr, self.get_root().vhost_scsi_controller_remove_target(ctrlr=self.ctrlr.ctrlr,
scsi_target_num=int(target_num)) scsi_target_num=int(target_num))
for ctrlr in self.get_root().get_vhost_controllers(ctrlr_type="scsi"): for ctrlr in self.get_root().vhost_get_controllers(ctrlr_type="scsi"):
if ctrlr.ctrlr == self.ctrlr.ctrlr: if ctrlr.ctrlr == self.ctrlr.ctrlr:
self.ctrlr = ctrlr self.ctrlr = ctrlr
@ -773,7 +773,7 @@ class UIVhostScsiCtrlObj(UIVhostCtrl):
self.get_root().vhost_scsi_controller_add_target(ctrlr=self.ctrlr.ctrlr, self.get_root().vhost_scsi_controller_add_target(ctrlr=self.ctrlr.ctrlr,
scsi_target_num=int(target_num), scsi_target_num=int(target_num),
bdev_name=bdev_name) bdev_name=bdev_name)
for ctrlr in self.get_root().get_vhost_controllers(ctrlr_type="scsi"): for ctrlr in self.get_root().vhost_get_controllers(ctrlr_type="scsi"):
if ctrlr.ctrlr == self.ctrlr.ctrlr: if ctrlr.ctrlr == self.ctrlr.ctrlr:
self.ctrlr = ctrlr self.ctrlr = ctrlr

View File

@ -267,11 +267,11 @@ class UIRoot(UINode):
def list_vhost_ctrls(self): def list_vhost_ctrls(self):
if self.is_init: if self.is_init:
self.current_vhost_ctrls = rpc.vhost.get_vhost_controllers(self.client) self.current_vhost_ctrls = rpc.vhost.vhost_get_controllers(self.client)
@verbose @verbose
@is_method_available @is_method_available
def get_vhost_controllers(self, ctrlr_type): def vhost_get_controllers(self, ctrlr_type):
if self.is_init: if self.is_init:
self.list_vhost_ctrls() self.list_vhost_ctrls()
for ctrlr in [x for x in self.current_vhost_ctrls if ctrlr_type in list(x["backend_specific"].keys())]: for ctrlr in [x for x in self.current_vhost_ctrls if ctrlr_type in list(x["backend_specific"].keys())]:
@ -516,7 +516,7 @@ class VhostCtrlr(object):
def __init__(self, ctrlr_info): def __init__(self, ctrlr_info):
""" """
All class attributes are set based on what information is received All class attributes are set based on what information is received
from get_vhost_controllers RPC call. from vhost_get_controllers RPC call.
# TODO: Document in docstring parameters which describe bdevs. # TODO: Document in docstring parameters which describe bdevs.
# TODO: Possible improvement: JSON schema might be used here in future # TODO: Possible improvement: JSON schema might be used here in future
""" """

View File

@ -137,7 +137,7 @@ for vm_conf in ${vms[@]}; do
done done
done <<< "${conf[2]}" done <<< "${conf[2]}"
unset IFS; unset IFS;
$rpc_py get_vhost_controllers $rpc_py vhost_get_controllers
fi fi
setup_cmd="vm_setup --force=${conf[0]} --disk-type=$test_type" setup_cmd="vm_setup --force=${conf[0]} --disk-type=$test_type"

View File

@ -216,7 +216,7 @@ for (( i=0; i<$vm_count; i++)); do
used_vms+=" $i" used_vms+=" $i"
done done
$rpc_py get_vhost_controllers $rpc_py vhost_get_controllers
# Run VMs # Run VMs
vm_run $used_vms vm_run $used_vms
@ -279,7 +279,7 @@ clean_lvol_cfg
$rpc_py bdev_lvol_get_lvstores $rpc_py bdev_lvol_get_lvstores
$rpc_py bdev_get_bdevs $rpc_py bdev_get_bdevs
$rpc_py get_vhost_controllers $rpc_py vhost_get_controllers
notice "Shutting down SPDK vhost app..." notice "Shutting down SPDK vhost app..."
vhost_kill 0 vhost_kill 0

View File

@ -116,7 +116,7 @@ elif [[ "$ctrl_type" == "spdk_vhost_blk" ]]; then
$rpc_py construct_vhost_blk_controller naa.2.0 Aio0 $rpc_py construct_vhost_blk_controller naa.2.0 Aio0
setup_cmd+=" --disk-type=spdk_vhost_blk --disks=0:1:2" setup_cmd+=" --disk-type=spdk_vhost_blk --disks=0:1:2"
fi fi
$rpc_py get_vhost_controllers $rpc_py vhost_get_controllers
$setup_cmd $setup_cmd
# Spin up VM # Spin up VM