-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bare minimum for a plugin, no operation implemented. Signed-off-by: Yann Dirson <[email protected]>
- Loading branch information
Showing
5 changed files
with
102 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
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,37 @@ | ||
#!/usr/bin/env python | ||
|
||
import os | ||
import sys | ||
import xapi.storage.api.v5.plugin | ||
from xapi.storage import log | ||
|
||
class Implementation(xapi.storage.api.v5.plugin.Plugin_skeleton): | ||
|
||
def diagnostics(self, dbg): | ||
return "No diagnostic data to report" | ||
|
||
def query(self, dbg): | ||
return { | ||
"plugin": "zfs-vol", | ||
"name": "ZFS Volume plugin", | ||
"description": ("This plugin manages ZFS volumes"), | ||
"vendor": "None", | ||
"copyright": "(C) 2021-2024 Vates", | ||
"version": "3.0", | ||
"required_api_version": "5.0", | ||
"features": [ | ||
], | ||
"configuration": {}, | ||
"required_cluster_stack": []} | ||
|
||
|
||
if __name__ == "__main__": | ||
log.log_call_argv() | ||
cmd = xapi.storage.api.v5.plugin.Plugin_commandline(Implementation()) | ||
base = os.path.basename(sys.argv[0]) | ||
if base == 'Plugin.diagnostics': | ||
cmd.diagnostics() | ||
elif base == 'Plugin.Query': | ||
cmd.query() | ||
else: | ||
raise xapi.storage.api.v5.plugin.Unimplemented(base) |
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,27 @@ | ||
#!/usr/bin/env python | ||
|
||
import importlib | ||
import os | ||
import os.path | ||
import sys | ||
import urlparse | ||
|
||
from xapi.storage import log | ||
from xapi.storage.libs import util | ||
from xapi.storage.common import call | ||
from xapi.storage.libs.libcow.volume import COWVolume | ||
import xapi.storage.api.v5.volume | ||
|
||
|
||
@util.decorate_all_routines(util.log_exceptions_in_function) | ||
class Implementation(xapi.storage.api.v5.volume.SR_skeleton): | ||
"SR driver to provide volumes from zvol's" | ||
|
||
if __name__ == '__main__': | ||
log.log_call_argv() | ||
cmd = xapi.storage.api.v5.volume.SR_commandline(Implementation()) | ||
|
||
call("zfs-vol.sr", ['modprobe', 'zfs']) | ||
|
||
base = os.path.basename(sys.argv[0]) | ||
raise xapi.storage.api.v5.volume.Unimplemented(base) |
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,32 @@ | ||
#!/usr/bin/env python | ||
|
||
import importlib | ||
import os | ||
import sys | ||
import urlparse | ||
import uuid | ||
import xapi.storage.api.v5.volume | ||
|
||
from xapi.storage import log | ||
from xapi.storage.libs import util | ||
from xapi.storage.libs.libcow.callbacks import VolumeContext | ||
from xapi.storage.libs.libcow.imageformat import ImageFormat | ||
from xapi.storage.libs.libcow.lock import PollLock | ||
from xapi.storage.libs.libcow.volume_implementation import Implementation as \ | ||
DefaultImplementation | ||
|
||
@util.decorate_all_routines(util.log_exceptions_in_function) | ||
class Implementation(DefaultImplementation): | ||
"Volume driver to provide raw volumes from zvol's" | ||
|
||
def call_volume_command(): | ||
"""Parse the arguments and call the required command""" | ||
log.log_call_argv() | ||
fsp = importlib.import_module("zfs-vol") | ||
cmd = xapi.storage.api.v5.volume.Volume_commandline( | ||
Implementation(fsp.Callbacks())) | ||
base = os.path.basename(sys.argv[0]) | ||
raise xapi.storage.api.v5.volume.Unimplemented(base) | ||
|
||
if __name__ == "__main__": | ||
call_volume_command() |
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,5 @@ | ||
import os.path | ||
import xapi.storage.libs.libcow.callbacks | ||
|
||
class Callbacks(xapi.storage.libs.libcow.callbacks.Callbacks): | ||
"ZFS-vol callbacks" |