scripts/rpc.py: pass named args to nbd.py

Change-Id: I4703c813d80b805c7b747fc5ee8bc91ef3e20717
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/405506
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Daniel Verkamp 2018-03-27 16:02:38 -07:00 committed by Jim Harris
parent 94c0ce5503
commit 85f316b183
2 changed files with 15 additions and 11 deletions

View File

@ -490,7 +490,9 @@ if __name__ == "__main__":
# nbd
def start_nbd_disk(args):
rpc.nbd.start_nbd_disk(args.client, args)
rpc.nbd.start_nbd_disk(args.client,
bdev_name=args.bdev_name,
nbd_device=args.nbd_device)
p = subparsers.add_parser('start_nbd_disk', help='Export a bdev as a nbd disk')
p.add_argument('bdev_name', help='Blockdev name to be exported. Example: Malloc0.')
@ -498,14 +500,16 @@ if __name__ == "__main__":
p.set_defaults(func=start_nbd_disk)
def stop_nbd_disk(args):
rpc.nbd.stop_nbd_disk(args.client, args)
rpc.nbd.stop_nbd_disk(args.client,
nbd_device=args.nbd_device)
p = subparsers.add_parser('stop_nbd_disk', help='Stop a nbd disk')
p.add_argument('nbd_device', help='Nbd device name to be stopped. Example: /dev/nbd0.')
p.set_defaults(func=stop_nbd_disk)
def get_nbd_disks(args):
print_dict(rpc.nbd.get_nbd_disks(args.client, args))
print_dict(rpc.nbd.get_nbd_disks(args.client,
nbd_device=args.nbd_device))
p = subparsers.add_parser('get_nbd_disks', help='Display full or specified nbd device list')
p.add_argument('-n', '--nbd_device', help="Path of the nbd device. Example: /dev/nbd0", required=False)

View File

@ -1,18 +1,18 @@
def start_nbd_disk(client, args):
def start_nbd_disk(client, bdev_name, nbd_device):
params = {
'bdev_name': args.bdev_name,
'nbd_device': args.nbd_device
'bdev_name': bdev_name,
'nbd_device': nbd_device
}
return client.call('start_nbd_disk', params)
def stop_nbd_disk(client, args):
params = {'nbd_device': args.nbd_device}
def stop_nbd_disk(client, nbd_device):
params = {'nbd_device': nbd_device}
return client.call('stop_nbd_disk', params)
def get_nbd_disks(client, args):
def get_nbd_disks(client, nbd_device=None):
params = {}
if args.nbd_device:
params['nbd_device'] = args.nbd_device
if nbd_device:
params['nbd_device'] = nbd_device
return client.call('get_nbd_disks', params)