numam-spdk/scripts/rpc/nbd.py
Xiaodong Liu efdd6edba2 nbd: optional nbd_device in start_nbd_disk
Enhance RPC method start_nbd_disk to take nbd_device as
one optional parameter. If it is not assigned, automaticly
choose an available nbd device path from /dev/nbd0 to
/dev/nbdN.
For github issue #324:
https://github.com/spdk/spdk/issues/324

Change-Id: I72c064d8bd476df342f5aa0af4d6120eb021c7ed
Signed-off-by: Xiaodong Liu <xiaodong.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/440453
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
2019-04-04 08:35:50 +00:00

20 lines
513 B
Python

def start_nbd_disk(client, bdev_name, nbd_device):
params = {
'bdev_name': bdev_name
}
if nbd_device:
params['nbd_device'] = nbd_device
return client.call('start_nbd_disk', params)
def stop_nbd_disk(client, nbd_device):
params = {'nbd_device': nbd_device}
return client.call('stop_nbd_disk', params)
def get_nbd_disks(client, nbd_device=None):
params = {}
if nbd_device:
params['nbd_device'] = nbd_device
return client.call('get_nbd_disks', params)