diff --git a/python/spdk/rpc/vhost.py b/python/spdk/rpc/vhost.py index d36c05b16..43e2a4ce9 100644 --- a/python/spdk/rpc/vhost.py +++ b/python/spdk/rpc/vhost.py @@ -70,8 +70,7 @@ def vhost_scsi_controller_remove_target(client, ctrlr, scsi_target_num): return client.call('vhost_scsi_controller_remove_target', params) -def vhost_create_blk_controller( - client, ctrlr, dev_name, cpumask=None, transport=None, readonly=None, packed_ring=None, packed_ring_recovery=None): +def vhost_create_blk_controller(client, **params): """Create vhost BLK controller. Args: ctrlr: controller name @@ -82,20 +81,9 @@ def vhost_create_blk_controller( packed_ring: support controller packed_ring packed_ring_recovery: enable packed ring live recovery """ - params = { - 'ctrlr': ctrlr, - 'dev_name': dev_name, - } - if cpumask: - params['cpumask'] = cpumask - if transport: - params['transport'] = transport - if readonly: - params['readonly'] = readonly - if packed_ring: - params['packed_ring'] = packed_ring - if packed_ring_recovery: - params['packed_ring_recovery'] = packed_ring_recovery + strip_globals(params) + remove_null(params) + return client.call('vhost_create_blk_controller', params) diff --git a/scripts/rpc.py b/scripts/rpc.py index 13c369d1d..515106b4a 100755 --- a/scripts/rpc.py +++ b/scripts/rpc.py @@ -2453,14 +2453,7 @@ Format: 'user:u1 secret:s1 muser:mu1 msecret:ms1,user:u2 secret:s2 muser:mu2 mse p.set_defaults(func=vhost_scsi_controller_remove_target) 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, - transport=args.transport, - readonly=args.readonly, - packed_ring=args.packed_ring, - packed_ring_recovery=args.packed_ring_recovery) + rpc.vhost.vhost_create_blk_controller(**vars(args)) p = subparsers.add_parser('vhost_create_blk_controller', help='Add a new vhost block controller') p.add_argument('ctrlr', help='controller name')