df897ed490
The modules in scripts/rpc/*.py should be a generic, reusable library; the printing should be done by the command-line frontend (rpc.py) instead of the library code. Change-Id: Ibeb022a3591f0a140fc43104d8dcf17d7041e48b Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com> Reviewed-on: https://review.gerrithub.io/404426 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>
70 lines
2.1 KiB
Python
Executable File
70 lines
2.1 KiB
Python
Executable File
def construct_lvol_store(args):
|
|
params = {'bdev_name': args.bdev_name, 'lvs_name': args.lvs_name}
|
|
if args.cluster_sz:
|
|
params['cluster_sz'] = args.cluster_sz
|
|
return args.client.call('construct_lvol_store', params)
|
|
|
|
|
|
def rename_lvol_store(args):
|
|
params = {
|
|
'old_name': args.old_name,
|
|
'new_name': args.new_name
|
|
}
|
|
return args.client.call('rename_lvol_store', params)
|
|
|
|
|
|
def construct_lvol_bdev(args):
|
|
num_bytes = (args.size * 1024 * 1024)
|
|
params = {'lvol_name': args.lvol_name, 'size': num_bytes}
|
|
if args.thin_provision:
|
|
params['thin_provision'] = args.thin_provision
|
|
if (args.uuid and args.lvs_name) or (not args.uuid and not args.lvs_name):
|
|
print("You need to specify either uuid or name of lvolstore")
|
|
else:
|
|
if args.uuid:
|
|
params['uuid'] = args.uuid
|
|
if args.lvs_name:
|
|
params['lvs_name'] = args.lvs_name
|
|
return args.client.call('construct_lvol_bdev', params)
|
|
|
|
|
|
def rename_lvol_bdev(args):
|
|
params = {
|
|
'old_name': args.old_name,
|
|
'new_name': args.new_name
|
|
}
|
|
return args.client.call('rename_lvol_bdev', params)
|
|
|
|
|
|
# Logical volume resize feature is disabled, as it is currently work in progress
|
|
#
|
|
# def resize_lvol_bdev(args):
|
|
# params = {
|
|
# 'name': args.name,
|
|
# 'size': args.size,
|
|
# }
|
|
# return args.client.call('resize_lvol_bdev', params)
|
|
|
|
|
|
def destroy_lvol_store(args):
|
|
params = {}
|
|
if (args.uuid and args.lvs_name) or (not args.uuid and not args.lvs_name):
|
|
print("You need to specify either uuid or name of lvolstore")
|
|
else:
|
|
if args.uuid:
|
|
params['uuid'] = args.uuid
|
|
if args.lvs_name:
|
|
params['lvs_name'] = args.lvs_name
|
|
return args.client.call('destroy_lvol_store', params)
|
|
|
|
|
|
def get_lvol_stores(args):
|
|
params = {}
|
|
if (args.uuid and args.lvs_name):
|
|
print("You can only specify either uuid or name of lvolstore")
|
|
if args.uuid:
|
|
params['uuid'] = args.uuid
|
|
if args.lvs_name:
|
|
params['lvs_name'] = args.lvs_name
|
|
return args.client.call('get_lvol_stores', params)
|