注意
本文档适用于 Ceph 开发版本。
插件
ceph-volume
最初开始是为了提供对使用lvm
作为
这种模块化,允许其他设备或类似设备的科技能够消费和重用提供的工具和工作流程。
添加插件
作为 Python 工具,插件setuptools
入口点。为了使新插件可用,它应该在其setup.py
文件:
setup(
...
entry_points = dict(
ceph_volume_handlers = [
'my_command = my_package.my_module:MyClass',
],
),
The MyClass
应该是一个接受sys.argv
作为其参数的类,ceph-volume
将在实例化时传递该参数并调用它们main
方法的最后一个参数。
这就是一个插件ZFS
的示例:
class ZFS(object):
help_menu = 'Deploy OSDs with ZFS'
_help = """
Use ZFS as the underlying technology for OSDs
--verbose Increase the verbosity level
"""
def __init__(self, argv):
self.argv = argv
def main(self):
parser = argparse.ArgumentParser()
args = parser.parse_args(self.argv)
...
以及其入口点(通过setuptools
)在setup.py
中看起来像:
entry_points = {
'ceph_volume_handlers': [
'zfs = ceph_volume_zfs.zfs:ZFS',
],
},
安装后,该zfs
子命令将列出,并可用于:
ceph-volume zfs
由 Ceph 基金会带给您
Ceph 文档是一个社区资源,由非盈利的 Ceph 基金会资助和托管Ceph Foundation. 如果您想支持这一点和我们的其他工作,请考虑加入现在加入.