2018-03-27 21:31:52 +00:00
|
|
|
def construct_lvol_store(client, args):
|
2017-06-06 21:22:03 +00:00
|
|
|
params = {'bdev_name': args.bdev_name, 'lvs_name': args.lvs_name}
|
|
|
|
if args.cluster_sz:
|
|
|
|
params['cluster_sz'] = args.cluster_sz
|
2018-03-27 21:31:52 +00:00
|
|
|
return client.call('construct_lvol_store', params)
|
2017-06-06 21:22:03 +00:00
|
|
|
|
|
|
|
|
2018-03-27 21:31:52 +00:00
|
|
|
def rename_lvol_store(client, args):
|
2018-01-10 10:03:39 +00:00
|
|
|
params = {
|
|
|
|
'old_name': args.old_name,
|
|
|
|
'new_name': args.new_name
|
|
|
|
}
|
2018-03-27 21:31:52 +00:00
|
|
|
return client.call('rename_lvol_store', params)
|
2018-01-10 10:03:39 +00:00
|
|
|
|
|
|
|
|
2018-03-27 21:31:52 +00:00
|
|
|
def construct_lvol_bdev(client, args):
|
2017-06-06 21:22:03 +00:00
|
|
|
num_bytes = (args.size * 1024 * 1024)
|
|
|
|
params = {'lvol_name': args.lvol_name, 'size': num_bytes}
|
2018-01-26 13:33:27 +00:00
|
|
|
if args.thin_provision:
|
|
|
|
params['thin_provision'] = args.thin_provision
|
2017-06-06 21:22:03 +00:00
|
|
|
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
|
2018-03-27 21:31:52 +00:00
|
|
|
return client.call('construct_lvol_bdev', params)
|
2017-06-06 21:22:03 +00:00
|
|
|
|
|
|
|
|
2018-03-27 21:31:52 +00:00
|
|
|
def rename_lvol_bdev(client, args):
|
2018-01-10 10:02:27 +00:00
|
|
|
params = {
|
|
|
|
'old_name': args.old_name,
|
|
|
|
'new_name': args.new_name
|
|
|
|
}
|
2018-03-27 21:31:52 +00:00
|
|
|
return client.call('rename_lvol_bdev', params)
|
2018-01-10 10:02:27 +00:00
|
|
|
|
|
|
|
|
2017-06-06 21:22:03 +00:00
|
|
|
# Logical volume resize feature is disabled, as it is currently work in progress
|
|
|
|
#
|
2018-03-27 21:31:52 +00:00
|
|
|
# def resize_lvol_bdev(client, args):
|
2017-06-06 21:22:03 +00:00
|
|
|
# params = {
|
|
|
|
# 'name': args.name,
|
|
|
|
# 'size': args.size,
|
|
|
|
# }
|
2018-03-27 21:31:52 +00:00
|
|
|
# return client.call('resize_lvol_bdev', params)
|
2017-06-06 21:22:03 +00:00
|
|
|
|
|
|
|
|
2018-03-27 21:31:52 +00:00
|
|
|
def destroy_lvol_store(client, args):
|
2017-06-06 21:22:03 +00:00
|
|
|
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
|
2018-03-27 21:31:52 +00:00
|
|
|
return client.call('destroy_lvol_store', params)
|
2017-06-06 21:22:03 +00:00
|
|
|
|
|
|
|
|
2018-03-27 21:31:52 +00:00
|
|
|
def get_lvol_stores(client, args):
|
2018-01-29 07:09:35 +00:00
|
|
|
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
|
2018-03-27 21:31:52 +00:00
|
|
|
return client.call('get_lvol_stores', params)
|