Skip to content

Commit

Permalink
Add rpc plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
IsaacKhor committed Aug 8, 2024
1 parent 9de5a31 commit 9293eb9
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,6 @@ spdk_fe = lsvd_src + files(

lsvd_tgt = lsvd_src + files(
'lsvd_tgt.cc',
'bdev_lsvd.cc',
'bdev_lsvd_rpc.cc',
)
27 changes: 27 additions & 0 deletions src/rpc_plugin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
from spdk.rpc.client import print_json

def spdk_rpc_plugin_initialize(subparsers):
def bdev_lsvd_create(args):
print_json(args.client.call('bdev_lsvd_create', {
'name': args.name,
'pool_name': args.pool_name,
'cfg_path': args.cfg
}))

p = subparsers.add_parser('bdev_lsvd_create', help='Create a bdev with LSVD backend')
p.add_argument('pool_name', help='Name of the ceph pool')
p.add_argument('name', help='Name of the lsvd disk image')
p.add_argument('-c', '--cfg', help='Path to config file', required=False)
p.set_defaults(func=bdev_lsvd_create)

def bdev_lsvd_delete(args):
print_json(args.client.call('bdev_lsvd_delete', {
'name': args.name
}))

p = subparsers.add_parser('bdev_lsvd_delete', help='Delete a lsvd bdev')
p.add_argument('name', help='Name of the lsvd disk image')
p.set_defaults(func=bdev_lsvd_delete)



0 comments on commit 9293eb9

Please sign in to comment.