From 477666762de2812412303e803ebc76086cc4e2a3 Mon Sep 17 00:00:00 2001 From: Guillaume Date: Mon, 11 Sep 2023 15:02:00 +0200 Subject: [PATCH] Add kalray plugin to configure DPU - Work is in progress... - Just create the skeleton --- SOURCES/etc/xapi.d/plugins/kalray-dpu.py | 43 ++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100755 SOURCES/etc/xapi.d/plugins/kalray-dpu.py diff --git a/SOURCES/etc/xapi.d/plugins/kalray-dpu.py b/SOURCES/etc/xapi.d/plugins/kalray-dpu.py new file mode 100755 index 0000000..aa4a7c3 --- /dev/null +++ b/SOURCES/etc/xapi.d/plugins/kalray-dpu.py @@ -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, + })