summaryrefslogtreecommitdiffstats
path: root/src/ceph-volume/plugin/zfs/ceph_volume_zfs/devices
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:45:59 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:45:59 +0000
commit19fcec84d8d7d21e796c7624e521b60d28ee21ed (patch)
tree42d26aa27d1e3f7c0b8bd3fd14e7d7082f5008dc /src/ceph-volume/plugin/zfs/ceph_volume_zfs/devices
parentInitial commit. (diff)
downloadceph-upstream.tar.xz
ceph-upstream.zip
Adding upstream version 16.2.11+ds.upstream/16.2.11+dsupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/ceph-volume/plugin/zfs/ceph_volume_zfs/devices')
-rwxr-xr-xsrc/ceph-volume/plugin/zfs/ceph_volume_zfs/devices/__init__.py2
-rwxr-xr-xsrc/ceph-volume/plugin/zfs/ceph_volume_zfs/devices/zfs/__init__.py4
-rw-r--r--src/ceph-volume/plugin/zfs/ceph_volume_zfs/devices/zfs/inventory.py50
-rw-r--r--src/ceph-volume/plugin/zfs/ceph_volume_zfs/devices/zfs/main.py36
-rw-r--r--src/ceph-volume/plugin/zfs/ceph_volume_zfs/devices/zfs/prepare.py25
-rw-r--r--src/ceph-volume/plugin/zfs/ceph_volume_zfs/devices/zfs/zap.py34
6 files changed, 151 insertions, 0 deletions
diff --git a/src/ceph-volume/plugin/zfs/ceph_volume_zfs/devices/__init__.py b/src/ceph-volume/plugin/zfs/ceph_volume_zfs/devices/__init__.py
new file mode 100755
index 000000000..c1a8fe656
--- /dev/null
+++ b/src/ceph-volume/plugin/zfs/ceph_volume_zfs/devices/__init__.py
@@ -0,0 +1,2 @@
+# -*- coding: utf-8 -*-
+from . import zfs
diff --git a/src/ceph-volume/plugin/zfs/ceph_volume_zfs/devices/zfs/__init__.py b/src/ceph-volume/plugin/zfs/ceph_volume_zfs/devices/zfs/__init__.py
new file mode 100755
index 000000000..457418493
--- /dev/null
+++ b/src/ceph-volume/plugin/zfs/ceph_volume_zfs/devices/zfs/__init__.py
@@ -0,0 +1,4 @@
+# -*- coding: utf-8 -*-
+
+import logging
+logger = logging.getLogger(__name__)
diff --git a/src/ceph-volume/plugin/zfs/ceph_volume_zfs/devices/zfs/inventory.py b/src/ceph-volume/plugin/zfs/ceph_volume_zfs/devices/zfs/inventory.py
new file mode 100644
index 000000000..be65e39ac
--- /dev/null
+++ b/src/ceph-volume/plugin/zfs/ceph_volume_zfs/devices/zfs/inventory.py
@@ -0,0 +1,50 @@
+import argparse
+import json
+from textwrap import dedent
+
+# import ceph_volume.process
+
+from ceph_volume_zfs.util.disk import Disks
+
+class Inventory(object):
+
+ help = 'Generate a list of available devices'
+
+ def __init__(self, argv):
+ self.argv = argv
+
+ def format_report(self, inventory):
+ if self.args.format == 'json':
+ print(json.dumps(inventory.json_report()))
+ elif self.args.format == 'json-pretty':
+ print(json.dumps(inventory.json_report(), indent=4, sort_keys=True))
+ else:
+ print(inventory.pretty_report())
+
+ def main(self):
+ sub_command_help = dedent("""
+ Generate an inventory of available devices
+ """)
+ parser = argparse.ArgumentParser(
+ prog='ceph-volume zfs inventory',
+ description=sub_command_help,
+ )
+ parser.add_argument(
+ 'path',
+ nargs='?',
+ default=None,
+ help=('Report on specific disk'),
+ )
+ parser.add_argument(
+ '--format',
+ choices=['plain', 'json', 'json-pretty'],
+ default='plain',
+ help='Output format',
+ )
+
+ self.args = parser.parse_args(self.argv)
+ if self.args.path:
+ self.format_report(Disks(self.args.path))
+ else:
+ self.format_report(Disks())
+
diff --git a/src/ceph-volume/plugin/zfs/ceph_volume_zfs/devices/zfs/main.py b/src/ceph-volume/plugin/zfs/ceph_volume_zfs/devices/zfs/main.py
new file mode 100644
index 000000000..073be6467
--- /dev/null
+++ b/src/ceph-volume/plugin/zfs/ceph_volume_zfs/devices/zfs/main.py
@@ -0,0 +1,36 @@
+# vim: expandtab smarttab shiftwidth=4 softtabstop=4
+
+import argparse
+from textwrap import dedent
+from ceph_volume import terminal
+
+from . import inventory
+from . import prepare
+from . import zap
+
+class ZFSDEV(object):
+
+ help = 'Use ZFS to deploy OSDs'
+
+ _help = dedent("""
+ Use ZFS to deploy OSDs
+
+ {sub_help}
+ """)
+
+ def __init__(self, argv):
+ self.argv = argv
+
+ def print_help(self, sub_help):
+ return self._help.format(sub_help=sub_help)
+
+ def main(self):
+ terminal.dispatch(self.mapper, self.argv)
+ parser = argparse.ArgumentParser(
+ prog='ceph-volume zfs',
+ formatter_class=argparse.RawDescriptionHelpFormatter,
+ description=self.print_help(terminal.subhelp(self.mapper)),
+ )
+ parser.parse_args(self.argv)
+ if len(self.argv) <= 1:
+ return parser.print_help()
diff --git a/src/ceph-volume/plugin/zfs/ceph_volume_zfs/devices/zfs/prepare.py b/src/ceph-volume/plugin/zfs/ceph_volume_zfs/devices/zfs/prepare.py
new file mode 100644
index 000000000..7c075e86a
--- /dev/null
+++ b/src/ceph-volume/plugin/zfs/ceph_volume_zfs/devices/zfs/prepare.py
@@ -0,0 +1,25 @@
+import argparse
+
+from textwrap import dedent
+# from ceph_volume.util import arg_validators
+
+class Prepare(object):
+
+ help = 'Prepare a device'
+
+ def __init__(self, argv):
+ self.argv = argv
+
+ def main(self):
+ sub_command_help = dedent("""
+ Prepare a device
+ """)
+ parser = argparse.ArgumentParser(
+ prog='ceph-volume zfs prepare',
+ description=sub_command_help,
+ )
+ if len(self.argv) == 0 or len(self.argv) > 0:
+ print("Prepare: Print Help")
+ print(sub_command_help)
+ return
+
diff --git a/src/ceph-volume/plugin/zfs/ceph_volume_zfs/devices/zfs/zap.py b/src/ceph-volume/plugin/zfs/ceph_volume_zfs/devices/zfs/zap.py
new file mode 100644
index 000000000..f5177d5f2
--- /dev/null
+++ b/src/ceph-volume/plugin/zfs/ceph_volume_zfs/devices/zfs/zap.py
@@ -0,0 +1,34 @@
+import argparse
+
+from textwrap import dedent
+# from ceph_volume.util import arg_validators
+
+class Zap(object):
+
+ help = 'Zap a device'
+
+ def __init__(self, argv):
+ self.argv = argv
+
+ def main(self):
+ sub_command_help = dedent("""
+ Zap a device
+ """)
+ parser = argparse.ArgumentParser(
+ prog='ceph-volume zfs inventory',
+ description=sub_command_help,
+ )
+ parser.add_argument(
+ 'devices',
+ metavar='DEVICES',
+ nargs='*',
+ # type=arg_validators.ValidDevice(gpt_ok=True),
+ default=[],
+ help='Path to one or many lv (as vg/lv), partition (as /dev/sda1) or device (as /dev/sda)'
+ )
+
+ if len(self.argv) == 0 or len(self.argv) > 0:
+ print("Zap: Print Help")
+ print(sub_command_help)
+ return
+