-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Work is in progress... - Just create the skeleton
- Loading branch information
Showing
1 changed file
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/usr/bin/python | ||
|
||
import XenAPIPlugin | ||
|
||
from xcpngutils import error_wrapped | ||
|
||
# Usage example: | ||
# xe host-call-plugin \ | ||
# host-uuid=ffa19733-267f-4311-8b5f-01e62011b646 \ | ||
# plugin=kalray-dpu.py \ | ||
# fn=create_raid \ | ||
# args:data="hello, world" | ||
|
||
@error_wrapped | ||
def create_raid(session, args): | ||
try: | ||
data = args["data"] | ||
return data[::-1] | ||
except KeyError: | ||
raise RuntimeError("No argument found with key 'data'.") | ||
|
||
@error_wrapped | ||
def create_lvs(session, args): | ||
try: | ||
data = args["data"] | ||
return data[::-1] | ||
except KeyError: | ||
raise RuntimeError("No argument found with key 'data'.") | ||
|
||
@error_wrapped | ||
def create_lvol(session, args): | ||
try: | ||
data = args["data"] | ||
return data[::-1] | ||
except KeyError: | ||
raise RuntimeError("No argument found with key 'data'.") | ||
|
||
if __name__ == "__main__": | ||
XenAPIPlugin.dispatch({ | ||
"create_raid": create_raid, | ||
"create_lvs": create_lvs, | ||
"create_lvol": create_lvol, | ||
}) |