rpc: Rename add_vhost_nvme_ns to vhost_nvme_controller_add_ns
Signed-off-by: Pawel Kaminski <pawelx.kaminski@intel.com> Change-Id: I769271d0f8043ce4bdaf9a1c4799537e99e3876b Signed-off-by: Pawel Kaminski <pawelx.kaminski@intel.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/470399 Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
ca731a6a55
commit
5f6f7eddcc
@ -4542,7 +4542,7 @@ Example response:
|
||||
}
|
||||
~~~
|
||||
|
||||
## add_vhost_nvme_ns {#rpc_add_vhost_nvme_ns}
|
||||
## vhost_nvme_controller_add_ns {#rpc_vhost_nvme_controller_add_ns}
|
||||
|
||||
Add namespace backed by `bdev_name`
|
||||
|
||||
@ -4565,7 +4565,7 @@ Example request:
|
||||
"ctrlr": "VhostNvme0"
|
||||
},
|
||||
"jsonrpc": "2.0",
|
||||
"method": "add_vhost_nvme_ns",
|
||||
"method": "vhost_nvme_controller_add_ns",
|
||||
"id": 1
|
||||
}
|
||||
~~~
|
||||
|
@ -181,7 +181,7 @@ controller, at least 1 Namespace is required for each controller.
|
||||
|
||||
~~~{.sh}
|
||||
$rpc_py vhost_create_nvme_controller --cpumask 0x1 vhost.2 16
|
||||
$rpc_py add_vhost_nvme_ns vhost.2 Malloc0
|
||||
$rpc_py vhost_nvme_controller_add_ns vhost.2 Malloc0
|
||||
~~~
|
||||
|
||||
Users can use the following command to remove the controller, all the block
|
||||
|
@ -1269,7 +1269,7 @@ spdk_vhost_nvme_write_config_json(struct spdk_vhost_dev *vdev, struct spdk_json_
|
||||
}
|
||||
|
||||
spdk_json_write_object_begin(w);
|
||||
spdk_json_write_named_string(w, "method", "add_vhost_nvme_ns");
|
||||
spdk_json_write_named_string(w, "method", "vhost_nvme_controller_add_ns");
|
||||
|
||||
spdk_json_write_named_object_begin(w, "params");
|
||||
spdk_json_write_named_string(w, "ctrlr", nvme->vdev.name);
|
||||
|
@ -578,28 +578,28 @@ SPDK_RPC_REGISTER("vhost_create_nvme_controller", spdk_rpc_vhost_create_nvme_con
|
||||
SPDK_RPC_RUNTIME)
|
||||
SPDK_RPC_REGISTER_ALIAS_DEPRECATED(vhost_create_nvme_controller, construct_vhost_nvme_controller)
|
||||
|
||||
struct rpc_add_vhost_nvme_ctrlr_ns {
|
||||
struct rpc_vhost_nvme_ctrlr_add_ns {
|
||||
char *ctrlr;
|
||||
char *bdev_name;
|
||||
};
|
||||
|
||||
static void
|
||||
free_rpc_add_vhost_nvme_ctrlr_ns(struct rpc_add_vhost_nvme_ctrlr_ns *req)
|
||||
free_rpc_vhost_nvme_ctrlr_add_ns(struct rpc_vhost_nvme_ctrlr_add_ns *req)
|
||||
{
|
||||
free(req->ctrlr);
|
||||
free(req->bdev_name);
|
||||
}
|
||||
|
||||
static const struct spdk_json_object_decoder rpc_vhost_nvme_add_ns[] = {
|
||||
{"ctrlr", offsetof(struct rpc_add_vhost_nvme_ctrlr_ns, ctrlr), spdk_json_decode_string },
|
||||
{"bdev_name", offsetof(struct rpc_add_vhost_nvme_ctrlr_ns, bdev_name), spdk_json_decode_string },
|
||||
{"ctrlr", offsetof(struct rpc_vhost_nvme_ctrlr_add_ns, ctrlr), spdk_json_decode_string },
|
||||
{"bdev_name", offsetof(struct rpc_vhost_nvme_ctrlr_add_ns, bdev_name), spdk_json_decode_string },
|
||||
};
|
||||
|
||||
static void
|
||||
spdk_rpc_add_vhost_nvme_ns(struct spdk_jsonrpc_request *request,
|
||||
const struct spdk_json_val *params)
|
||||
spdk_rpc_vhost_nvme_controller_add_ns(struct spdk_jsonrpc_request *request,
|
||||
const struct spdk_json_val *params)
|
||||
{
|
||||
struct rpc_add_vhost_nvme_ctrlr_ns req = {0};
|
||||
struct rpc_vhost_nvme_ctrlr_add_ns req = {0};
|
||||
struct spdk_json_write_ctx *w;
|
||||
struct spdk_vhost_dev *vdev;
|
||||
int rc;
|
||||
@ -625,7 +625,7 @@ spdk_rpc_add_vhost_nvme_ns(struct spdk_jsonrpc_request *request,
|
||||
if (rc < 0) {
|
||||
goto invalid;
|
||||
}
|
||||
free_rpc_add_vhost_nvme_ctrlr_ns(&req);
|
||||
free_rpc_vhost_nvme_ctrlr_add_ns(&req);
|
||||
|
||||
w = spdk_jsonrpc_begin_result(request);
|
||||
spdk_json_write_bool(w, true);
|
||||
@ -633,11 +633,13 @@ spdk_rpc_add_vhost_nvme_ns(struct spdk_jsonrpc_request *request,
|
||||
return;
|
||||
|
||||
invalid:
|
||||
free_rpc_add_vhost_nvme_ctrlr_ns(&req);
|
||||
free_rpc_vhost_nvme_ctrlradd__ns(&req);
|
||||
spdk_jsonrpc_send_error_response(request, SPDK_JSONRPC_ERROR_INVALID_PARAMS,
|
||||
spdk_strerror(-rc));
|
||||
}
|
||||
SPDK_RPC_REGISTER("add_vhost_nvme_ns", spdk_rpc_add_vhost_nvme_ns, SPDK_RPC_RUNTIME)
|
||||
SPDK_RPC_REGISTER("vhost_nvme_controller_add_ns", spdk_rpc_vhost_nvme_controller_add_ns,
|
||||
SPDK_RPC_RUNTIME)
|
||||
SPDK_RPC_REGISTER_ALIAS_DEPRECATED(vhost_nvme_controller_add_ns, add_vhost_nvme_ns)
|
||||
|
||||
#endif /* SPDK_CONFIG_VHOST_INTERNAL_LIB */
|
||||
|
||||
|
@ -460,7 +460,7 @@ def get_vhost_nvme_json(config, section):
|
||||
"ctrlr": params[0][3],
|
||||
"bdev_name": namespace,
|
||||
},
|
||||
"method": "add_vhost_nvme_ns"
|
||||
"method": "vhost_nvme_controller_add_ns"
|
||||
})
|
||||
|
||||
return vhost_nvme_json
|
||||
|
@ -1927,15 +1927,16 @@ Format: 'user:u1 secret:s1 muser:mu1 msecret:ms1,user:u2 secret:s2 muser:mu2 mse
|
||||
p.add_argument('--cpumask', help='cpu mask for this controller')
|
||||
p.set_defaults(func=vhost_create_nvme_controller)
|
||||
|
||||
def add_vhost_nvme_ns(args):
|
||||
rpc.vhost.add_vhost_nvme_ns(args.client,
|
||||
ctrlr=args.ctrlr,
|
||||
bdev_name=args.bdev_name)
|
||||
def vhost_nvme_controller_add_ns(args):
|
||||
rpc.vhost.vhost_nvme_controller_add_ns(args.client,
|
||||
ctrlr=args.ctrlr,
|
||||
bdev_name=args.bdev_name)
|
||||
|
||||
p = subparsers.add_parser('add_vhost_nvme_ns', help='Add a Namespace to vhost controller')
|
||||
p = subparsers.add_parser('vhost_nvme_controller_add_ns', aliases=['add_vhost_nvme_ns'],
|
||||
help='Add a Namespace to vhost controller')
|
||||
p.add_argument('ctrlr', help='conntroller name where add a Namespace')
|
||||
p.add_argument('bdev_name', help='block device name for a new Namespace')
|
||||
p.set_defaults(func=add_vhost_nvme_ns)
|
||||
p.set_defaults(func=vhost_nvme_controller_add_ns)
|
||||
|
||||
def get_vhost_controllers(args):
|
||||
print_dict(rpc.vhost.get_vhost_controllers(args.client, args.name))
|
||||
|
@ -81,7 +81,8 @@ def vhost_create_nvme_controller(client, ctrlr, io_queues, cpumask=None):
|
||||
return client.call('vhost_create_nvme_controller', params)
|
||||
|
||||
|
||||
def add_vhost_nvme_ns(client, ctrlr, bdev_name):
|
||||
@deprecated_alias('add_vhost_nvme_ns')
|
||||
def vhost_nvme_controller_add_ns(client, ctrlr, bdev_name):
|
||||
"""Add namespace to vhost nvme controller.
|
||||
Args:
|
||||
ctrlr: controller name where to add a namespace
|
||||
@ -92,7 +93,7 @@ def add_vhost_nvme_ns(client, ctrlr, bdev_name):
|
||||
'bdev_name': bdev_name,
|
||||
}
|
||||
|
||||
return client.call('add_vhost_nvme_ns', params)
|
||||
return client.call('vhost_nvme_controller_add_ns', params)
|
||||
|
||||
|
||||
def construct_vhost_blk_controller(client, ctrlr, dev_name, cpumask=None, readonly=None):
|
||||
|
@ -390,14 +390,14 @@
|
||||
"bdev_name": "Nvme0n1p0",
|
||||
"ctrlr": "naa.vhost.3"
|
||||
},
|
||||
"method": "add_vhost_nvme_ns"
|
||||
"method": "vhost_nvme_controller_add_ns"
|
||||
},
|
||||
{
|
||||
"params": {
|
||||
"bdev_name": "Nvme0n1p1",
|
||||
"ctrlr": "naa.vhost.3"
|
||||
},
|
||||
"method": "add_vhost_nvme_ns"
|
||||
"method": "vhost_nvme_controller_add_ns"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -290,7 +290,7 @@ function create_vhost_subsystem_config() {
|
||||
|
||||
# FIXME: enable after vhost-nvme is properly implemented against the latest rte_vhost (DPDK 19.05+)
|
||||
# tgt_rpc vhost_create_nvme_controller VhostNvmeCtrlr0 16
|
||||
# tgt_rpc add_vhost_nvme_ns VhostNvmeCtrlr0 MallocForVhost0p6
|
||||
# tgt_rpc vhost_nvme_controller_add_ns VhostNvmeCtrlr0 MallocForVhost0p6
|
||||
|
||||
timing_exit $FUNCNAME
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user