ceph-devstack 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. ceph_devstack-0.1.0/.flake8 +3 -0
  2. ceph_devstack-0.1.0/.github/workflows/ci.yml +89 -0
  3. ceph_devstack-0.1.0/.github/workflows/release.yml +30 -0
  4. ceph_devstack-0.1.0/.github/workflows/tox.yml +37 -0
  5. ceph_devstack-0.1.0/.gitignore +129 -0
  6. ceph_devstack-0.1.0/.pre-commit-config.yaml +26 -0
  7. ceph_devstack-0.1.0/Jenkinsfile +112 -0
  8. ceph_devstack-0.1.0/LICENSE +21 -0
  9. ceph_devstack-0.1.0/PKG-INFO +222 -0
  10. ceph_devstack-0.1.0/README.md +195 -0
  11. ceph_devstack-0.1.0/build_selinux_module.sh +7 -0
  12. ceph_devstack-0.1.0/ceph_devstack/Dockerfile.selinux +20 -0
  13. ceph_devstack-0.1.0/ceph_devstack/__init__.py +187 -0
  14. ceph_devstack-0.1.0/ceph_devstack/ceph_devstack.pp +0 -0
  15. ceph_devstack-0.1.0/ceph_devstack/ceph_devstack.te +127 -0
  16. ceph_devstack-0.1.0/ceph_devstack/cli.py +64 -0
  17. ceph_devstack-0.1.0/ceph_devstack/config.toml +24 -0
  18. ceph_devstack-0.1.0/ceph_devstack/exec.py +93 -0
  19. ceph_devstack-0.1.0/ceph_devstack/host.py +154 -0
  20. ceph_devstack-0.1.0/ceph_devstack/logging.conf +30 -0
  21. ceph_devstack-0.1.0/ceph_devstack/py.typed +0 -0
  22. ceph_devstack-0.1.0/ceph_devstack/requirements.py +277 -0
  23. ceph_devstack-0.1.0/ceph_devstack/resources/__init__.py +115 -0
  24. ceph_devstack-0.1.0/ceph_devstack/resources/ceph/__init__.py +266 -0
  25. ceph_devstack-0.1.0/ceph_devstack/resources/ceph/containers.py +419 -0
  26. ceph_devstack-0.1.0/ceph_devstack/resources/ceph/exceptions.py +3 -0
  27. ceph_devstack-0.1.0/ceph_devstack/resources/ceph/requirements.py +90 -0
  28. ceph_devstack-0.1.0/ceph_devstack/resources/ceph/utils.py +45 -0
  29. ceph_devstack-0.1.0/ceph_devstack/resources/container.py +171 -0
  30. ceph_devstack-0.1.0/ceph_devstack/resources/misc.py +15 -0
  31. ceph_devstack-0.1.0/ceph_devstack.egg-info/PKG-INFO +222 -0
  32. ceph_devstack-0.1.0/ceph_devstack.egg-info/SOURCES.txt +60 -0
  33. ceph_devstack-0.1.0/ceph_devstack.egg-info/dependency_links.txt +1 -0
  34. ceph_devstack-0.1.0/ceph_devstack.egg-info/entry_points.txt +2 -0
  35. ceph_devstack-0.1.0/ceph_devstack.egg-info/requires.txt +10 -0
  36. ceph_devstack-0.1.0/ceph_devstack.egg-info/top_level.txt +2 -0
  37. ceph_devstack-0.1.0/docs/cgroup_v2.md +25 -0
  38. ceph_devstack-0.1.0/pyproject.toml +47 -0
  39. ceph_devstack-0.1.0/pytest.ini +3 -0
  40. ceph_devstack-0.1.0/ruff.toml +2 -0
  41. ceph_devstack-0.1.0/setup.cfg +4 -0
  42. ceph_devstack-0.1.0/tests/__init__.py +0 -0
  43. ceph_devstack-0.1.0/tests/conftest.py +9 -0
  44. ceph_devstack-0.1.0/tests/resources/__init__.py +0 -0
  45. ceph_devstack-0.1.0/tests/resources/ceph/__init__.py +0 -0
  46. ceph_devstack-0.1.0/tests/resources/ceph/fixtures/__init__.py +0 -0
  47. ceph_devstack-0.1.0/tests/resources/ceph/fixtures/testnode-config.toml +2 -0
  48. ceph_devstack-0.1.0/tests/resources/ceph/test_cephdevstack_core.py +459 -0
  49. ceph_devstack-0.1.0/tests/resources/ceph/test_devstack.py +182 -0
  50. ceph_devstack-0.1.0/tests/resources/ceph/test_env_vars.py +110 -0
  51. ceph_devstack-0.1.0/tests/resources/ceph/test_requirements_ceph.py +262 -0
  52. ceph_devstack-0.1.0/tests/resources/ceph/test_ssh_keypair.py +109 -0
  53. ceph_devstack-0.1.0/tests/resources/ceph/test_testnode.py +36 -0
  54. ceph_devstack-0.1.0/tests/resources/test_container.py +247 -0
  55. ceph_devstack-0.1.0/tests/resources/test_misc.py +46 -0
  56. ceph_devstack-0.1.0/tests/resources/test_podmanresource.py +59 -0
  57. ceph_devstack-0.1.0/tests/test_config.py +120 -0
  58. ceph_devstack-0.1.0/tests/test_deep_merge.py +71 -0
  59. ceph_devstack-0.1.0/tests/test_parse_args.py +228 -0
  60. ceph_devstack-0.1.0/tests/test_requirements_core.py +495 -0
  61. ceph_devstack-0.1.0/tox.ini +9 -0
  62. ceph_devstack-0.1.0/uv.lock +473 -0
@@ -0,0 +1,3 @@
1
+ [flake8]
2
+ # W503 conflicts with black's formatting
3
+ extend-ignore = E501, W503
@@ -0,0 +1,89 @@
1
+ name: CI
2
+ on:
3
+ pull_request:
4
+ branches:
5
+ - main
6
+ workflow_dispatch:
7
+
8
+ jobs:
9
+ lint:
10
+ name: Check code style
11
+ runs-on: ubuntu-24.04
12
+ steps:
13
+ - uses: actions/checkout@v2
14
+ - name: Install precommit
15
+ run: pip install pre-commit
16
+ - name: Check lint
17
+ run: pre-commit run ruff-check --all-files
18
+ - name: Check format
19
+ run: pre-commit run ruff-format --all-files
20
+ test:
21
+ name: CI on python${{ matrix.python }} via ${{ matrix.os }}
22
+ runs-on: ${{ matrix.os }}
23
+ needs: lint
24
+ strategy:
25
+ matrix:
26
+ include:
27
+ - os: ubuntu-24.04
28
+ python: "3.12"
29
+ steps:
30
+ - uses: actions/checkout@v2
31
+ - name: Install packages
32
+ run: sudo apt-get update && sudo apt-get install podman golang-github-containernetworking-plugin-dnsname sqlite3 jq
33
+ - name: Create virtualenv
34
+ run: python3 -m venv venv
35
+ - name: Install
36
+ run: ./venv/bin/pip3 install -e .
37
+ - name: Set owner for /dev/loop-control
38
+ run: sudo chown $(whoami) /dev/loop-control
39
+ - name: Configure
40
+ run: ./venv/bin/ceph-devstack config set containers.postgres.count 0
41
+ - name: Doctor
42
+ run: ./venv/bin/ceph-devstack -v doctor --fix
43
+ - name: Build
44
+ run: ./venv/bin/ceph-devstack -v build
45
+ - name: Create
46
+ run: ./venv/bin/ceph-devstack -v create
47
+ - name: Start
48
+ run: ./venv/bin/ceph-devstack -v start
49
+ - name: Check Status
50
+ run: podman ps -a
51
+ - name: Check ssh access to testnode container
52
+ run: sleep 10 && podman exec teuthology ssh -oBatchMode=yes -v "cm@$(podman inspect --format '{{ slice .ID 0 12 }}' testnode_0)" whoami
53
+ - name: Dump testnode journal
54
+ if: failure()
55
+ run: podman exec testnode_0 journalctl
56
+ - name: Wait
57
+ run: ./venv/bin/ceph-devstack wait teuthology
58
+ - name: Dump logs
59
+ if: success() || failure()
60
+ run: podman logs -f teuthology
61
+ - name: Create archive
62
+ if: success() || failure()
63
+ run: |
64
+ mkdir -p /tmp/artifacts
65
+ - name: Dump job data
66
+ if: success() || failure()
67
+ run: |
68
+ podman cp paddles:/paddles/dev.db /tmp/
69
+ sqlite3 /tmp/dev.db ".output stdout" ".mode json" "select * from jobs" | jq | tee /tmp/artifacts/jobs.json
70
+ - name: Upload jobs.json
71
+ if: success() || failure()
72
+ uses: actions/upload-artifact@v4
73
+ with:
74
+ name: jobs
75
+ path: /tmp/artifacts/jobs.json
76
+ - name: Create tarball of log archive
77
+ if: success() || failure()
78
+ run: |
79
+ tar -czf /tmp/artifacts/archive.tar ~/.local/share/ceph-devstack/archive/
80
+ - name: Upload log archive
81
+ if: success() || failure()
82
+ uses: actions/upload-artifact@v4
83
+ with:
84
+ name: archive
85
+ path: /tmp/artifacts/archive.tar
86
+ - name: Stop
87
+ run: ./venv/bin/ceph-devstack -v stop
88
+ - name: Remove
89
+ run: ./venv/bin/ceph-devstack -v remove
@@ -0,0 +1,30 @@
1
+ name: "Publish release to PyPI"
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - v*
7
+
8
+ jobs:
9
+ run:
10
+ runs-on: ubuntu-latest
11
+ environment:
12
+ name: pypi
13
+ permissions:
14
+ id-token: write
15
+ contents: read
16
+ steps:
17
+ - name: Checkout
18
+ uses: actions/checkout@v6
19
+ - name: Install uv
20
+ uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
21
+ - name: Install Python 3.13
22
+ run: uv python install 3.13
23
+ - name: Build
24
+ run: rm -rf dist && uv build
25
+ - name: Run tests (wheel)
26
+ run: uv run --isolated --no-project --with "$(ls dist/*.whl)[test]" pytest tests
27
+ - name: Run tests (source distribution)
28
+ run: uv run --isolated --no-project --with "$(ls dist/*.tar.gz)[test]" pytest tests
29
+ - name: Publish
30
+ run: uv publish
@@ -0,0 +1,37 @@
1
+ name: tox
2
+
3
+ on:
4
+ pull_request:
5
+ branches:
6
+ - main
7
+ workflow_dispatch:
8
+
9
+ jobs:
10
+ test:
11
+ name: tox on python${{ matrix.python }} via ${{ matrix.os }}
12
+ runs-on: ${{ matrix.os }}
13
+ strategy:
14
+ matrix:
15
+ include:
16
+ - os: ubuntu-22.04
17
+ python: "3.10"
18
+ - os: ubuntu-22.04
19
+ python: "3.11"
20
+ - os: ubuntu-24.04
21
+ python: "3.12"
22
+ - os: ubuntu-24.04
23
+ python: "3.13"
24
+ steps:
25
+ - uses: actions/checkout@v4
26
+ - name: Setup Python
27
+ uses: actions/setup-python@v5
28
+ with:
29
+ python-version: ${{ matrix.python }}
30
+ - name: Install pipx
31
+ run: pip install pipx
32
+ - name: Install uv
33
+ run: pipx install uv
34
+ - name: Run pipx ensurepath
35
+ run: pipx ensurepath
36
+ - name: Run unit tests
37
+ run: uv run --extra test tox
@@ -0,0 +1,129 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ pip-wheel-metadata/
24
+ share/python-wheels/
25
+ *.egg-info/
26
+ .installed.cfg
27
+ *.egg
28
+ MANIFEST
29
+
30
+ # PyInstaller
31
+ # Usually these files are written by a python script from a template
32
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
33
+ *.manifest
34
+ *.spec
35
+
36
+ # Installer logs
37
+ pip-log.txt
38
+ pip-delete-this-directory.txt
39
+
40
+ # Unit test / coverage reports
41
+ htmlcov/
42
+ .tox/
43
+ .nox/
44
+ .coverage
45
+ .coverage.*
46
+ .cache
47
+ nosetests.xml
48
+ coverage.xml
49
+ *.cover
50
+ *.py,cover
51
+ .hypothesis/
52
+ .pytest_cache/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ target/
76
+
77
+ # Jupyter Notebook
78
+ .ipynb_checkpoints
79
+
80
+ # IPython
81
+ profile_default/
82
+ ipython_config.py
83
+
84
+ # pyenv
85
+ .python-version
86
+
87
+ # pipenv
88
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
89
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
90
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
91
+ # install all needed dependencies.
92
+ #Pipfile.lock
93
+
94
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow
95
+ __pypackages__/
96
+
97
+ # Celery stuff
98
+ celerybeat-schedule
99
+ celerybeat.pid
100
+
101
+ # SageMath parsed files
102
+ *.sage.py
103
+
104
+ # Environments
105
+ .env
106
+ .venv
107
+ env/
108
+ venv/
109
+ ENV/
110
+ env.bak/
111
+ venv.bak/
112
+
113
+ # Spyder project settings
114
+ .spyderproject
115
+ .spyproject
116
+
117
+ # Rope project settings
118
+ .ropeproject
119
+
120
+ # mkdocs documentation
121
+ /site
122
+
123
+ # mypy
124
+ .mypy_cache/
125
+ .dmypy.json
126
+ dmypy.json
127
+
128
+ # Pyre type checker
129
+ .pyre/
@@ -0,0 +1,26 @@
1
+ exclude: 'ceph_devstack/ceph_devstack\.(te|pp)'
2
+
3
+ repos:
4
+ - repo: https://github.com/pre-commit/pre-commit-hooks
5
+ rev: v4.6.0
6
+ hooks:
7
+ - id: check-yaml
8
+ - id: end-of-file-fixer
9
+ - id: trailing-whitespace
10
+ - repo: https://github.com/astral-sh/ruff-pre-commit
11
+ rev: v0.12.11
12
+ hooks:
13
+ - id: ruff-check
14
+ - id: ruff-format
15
+ - repo: https://github.com/pre-commit/mirrors-mypy
16
+ rev: v1.20.1
17
+ hooks:
18
+ - id: mypy
19
+ exclude: ^docs/conf.py
20
+ additional_dependencies:
21
+ - types-dataclasses >= 0.1.3
22
+ - types-PyYAML
23
+ - tomli >= 0.2.6, < 2.0.0
24
+ - types-typed-ast >= 1.4.1
25
+ - click >= 8.1.0
26
+ - platformdirs >= 2.1.0
@@ -0,0 +1,112 @@
1
+ pipeline {
2
+ agent { node {
3
+ label "centos9 && x86_64"
4
+ }}
5
+ environment {
6
+ CDS_CONF = "${env.WORKSPACE}/ceph-devstack.toml"
7
+ PATH = "${env.PATH}:${env.HOME}/.local/bin"
8
+ }
9
+ stages {
10
+ stage("Setup system") {
11
+ steps {
12
+ script {
13
+ env.OLD_AIO_MAX_NR = """${sh(returnStdout: true, script: "sysctl -b fs.aio-max-nr")}"""
14
+ }
15
+ sh """
16
+ sudo dnf install -y podman podman-plugins policycoreutils-devel selinux-policy-devel pipx
17
+ pipx install uv
18
+ sudo dnf update -y container\\* podman\\* selinux\\*
19
+ sudo sysctl fs.aio-max-nr=1048576
20
+ sudo usermod -a -G disk ${env.USER}
21
+ mkdir -p ~/.local/share/containers
22
+ # The below command is not idempotent, hence the '|| true'.
23
+ # See https://patchwork.kernel.org/project/selinux/patch/20240214122706.522873-1-vmojzis@redhat.com/
24
+ sudo semanage fcontext -a -e /var/lib/containers ~/.local/share/containers || true
25
+ sudo restorecon -R ~/.local/share/containers
26
+ sudo setsebool -P container_manage_cgroup=true
27
+ sudo setsebool -P container_use_devices=true
28
+ cd ${env.WORKSPACE}/ceph_devstack
29
+ make -f /usr/share/selinux/devel/Makefile ceph_devstack.pp
30
+ sudo semodule -i ceph_devstack.pp
31
+ """
32
+ }
33
+ }
34
+ stage("Clone teuthology") {
35
+ steps {
36
+ sh """
37
+ git clone -b ${env.TEUTHOLOGY_BRANCH} https://github.com/ceph/teuthology ${env.WORKSPACE}/teuthology
38
+ """
39
+ }
40
+ }
41
+ stage("Setup ceph-devstack") {
42
+ steps {
43
+ sh """
44
+ python3 -V
45
+ uv venv
46
+ uv run python -V
47
+ uv pip install -e .
48
+ uv sync --frozen --all-extras
49
+ touch ${env.CDS_CONF}
50
+ uv run ceph-devstack --config-file ${env.CDS_CONF} config set data_dir '${env.WORKSPACE}/data'
51
+ if [ -n ${env.TEUTHOLOGY_BRANCH} ]; then
52
+ uv run ceph-devstack --config-file ${env.CDS_CONF} config set containers.teuthology.repo '${env.WORKSPACE}/teuthology'
53
+ fi
54
+ uv run ceph-devstack --config-file ${env.CDS_CONF} config dump
55
+ uv run ceph-devstack --config-file ${env.CDS_CONF} doctor --fix
56
+ """
57
+ }
58
+ }
59
+ stage("Build container images") {
60
+ steps {
61
+ sh """
62
+ uv run ceph-devstack -v --config-file ${env.CDS_CONF} build
63
+ """
64
+ }
65
+ }
66
+ stage("Pull container images") {
67
+ steps {
68
+ sh """
69
+ uv run ceph-devstack -v --config-file ${env.CDS_CONF} pull
70
+ """
71
+ }
72
+ }
73
+ stage("Create containers") {
74
+ steps {
75
+ sh """
76
+ uv run ceph-devstack --config-file ${env.CDS_CONF} -v create
77
+ """
78
+ }
79
+ }
80
+ stage("Start containers") {
81
+ steps {
82
+ sh """
83
+ uv run ceph-devstack --config-file ${env.CDS_CONF} -v start
84
+ """
85
+ }
86
+ }
87
+ stage("Wait for teuthology container") {
88
+ steps {
89
+ sh """
90
+ podman wait teuthology
91
+ exit \$(podman inspect -f "{{.State.ExitCode}}" teuthology)
92
+ """
93
+ }
94
+ }
95
+ }
96
+ post {
97
+ always {
98
+ sh """
99
+ podman logs teuthology
100
+ """
101
+ sh """
102
+ mkdir -p data/containers
103
+ podman logs teuthology 2>&1 > data/containers/teuthology.log
104
+ uv run ceph-devstack --config-file ${env.CDS_CONF} -v remove
105
+ podman volume prune -f
106
+ podman ps -a
107
+ sudo sysctl fs.aio-max-nr=${env.OLD_AIO_MAX_NR}
108
+ """
109
+ archiveArtifacts artifacts: 'ceph-devstack.yml,data/archive/**', fingerprint: true
110
+ }
111
+ }
112
+ }
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 Zack Cerza
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,222 @@
1
+ Metadata-Version: 2.4
2
+ Name: ceph-devstack
3
+ Version: 0.1.0
4
+ Summary: Run a full teuthology lab on your laptop!
5
+ Author-email: Zack Cerza <zack@cerza.org>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/ceph/ceph-devstack
8
+ Keywords: podman,ceph
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: Natural Language :: English
11
+ Classifier: Operating System :: POSIX :: Linux
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3 :: Only
14
+ Requires-Python: >=3.10
15
+ Description-Content-Type: text/markdown
16
+ License-File: LICENSE
17
+ Requires-Dist: packaging
18
+ Requires-Dist: pre-commit
19
+ Requires-Dist: PyYAML
20
+ Requires-Dist: tomlkit
21
+ Provides-Extra: test
22
+ Requires-Dist: pytest; extra == "test"
23
+ Requires-Dist: pytest-asyncio; extra == "test"
24
+ Requires-Dist: tox; extra == "test"
25
+ Requires-Dist: tox-uv; extra == "test"
26
+ Dynamic: license-file
27
+
28
+ # ceph-devstack
29
+ A tool for testing [Ceph](https://github.com/ceph/ceph) locally using [nested rootless podman containers](https://www.redhat.com/sysadmin/podman-inside-container)
30
+
31
+ ## Overview
32
+ ceph-devstack is a tool that can deploy and manage containerized versions of [teuthology](https://github.com/ceph/teuthology) and its associated services, to test Ceph (or just teuthology) on your local machine. It lets you avoid:
33
+
34
+ - Accessing Ceph's [Sepia lab](https://wiki.sepia.ceph.com/)
35
+ - Needing dedicated storage devices to test Ceph OSDs
36
+
37
+ Basically, the goal is that you can test your Ceph branch locally using containers
38
+ as storage test nodes.
39
+
40
+ It is currently under active development and has not yet had a formal release.
41
+
42
+ ## Supported Operating Systems
43
+
44
+ ☑︎ CentOS 9.Stream should work out of the box
45
+
46
+ ☑︎ CentOS 8.Stream mostly works - but has not yet passed a Ceph test
47
+
48
+ ☐ A recent Fedora should work but has not been tested
49
+
50
+ ☒ Ubuntu does not currently ship a new enough podman
51
+
52
+ ☒ MacOS will require special effort to support since podman operations are done inside a VM
53
+
54
+ ## Requirements
55
+
56
+ * A supported operating system
57
+ * podman 4.0+ using the `crun` runtime.
58
+ * On CentOS 8, modify `/etc/containers/containers.conf` to set the runtime
59
+ * Linux kernel 5.12+, or 4.15+ _and_ `fuse-overlayfs`
60
+ * cgroup v2
61
+ * On CentOS 8, see [./docs/cgroup_v2.md](./docs/cgroup_v2.md)
62
+ * With podman <5.0, podman's DNS plugin, from the `podman-plugins` package
63
+ * A user account that has `sudo` access and also is a member of the `disk` group
64
+ * The following sysctl settings:
65
+ * `fs.aio-max-nr=1048576`
66
+ * `kernel.pid_max=4194304`
67
+ * If using SELinux in enforcing mode:
68
+ * `setsebool -P container_manage_cgroup=true`
69
+ * `setsebool -P container_use_devices=true`
70
+
71
+ `ceph-devstack doctor` will check the above and report any issues along with suggested remedies; its `--fix` flag will apply them for you.
72
+
73
+ ## Setup
74
+
75
+ ```bash
76
+ sudo usermod -a -G disk $(whoami) # and re-login afterward
77
+ git clone https://github.com/ceph/teuthology/
78
+ cd teuthology && ./bootstrap
79
+ python3 -m venv venv
80
+ source ./venv/bin/activate
81
+ python3 -m pip install git+https://github.com/zmc/ceph-devstack.git
82
+ ```
83
+
84
+ ## Configuration
85
+ `ceph-devstack` 's default configuration is [here](./ceph_devstack/config.toml). It can be extended by placing a file at `~/.config/ceph-devstack/config.toml` or by using the `--config-file` flag.
86
+
87
+ `ceph-devstack config dump` will output the current configuration.
88
+
89
+ As an example, the following configuration will use a local image for paddles with the tag `TEST`; it will also create ten testnode containers; and will build its teuthology container from the git repo at `~/src/teuthology`:
90
+ ```
91
+ containers:
92
+ paddles:
93
+ image: localhost/paddles:TEST
94
+ testnode:
95
+ count: 10
96
+ teuthology:
97
+ repo: ~/src/teuthology
98
+ ```
99
+ ## Usage
100
+ By default, pre-built container images are pulled from [quay.io/ceph-infra](https://quay.io/organization/ceph-infra). The images can be overridden via the config file. It's also possible to _build_ images from on-disk git repositories.
101
+
102
+ First, you'll want to pull all the images:
103
+
104
+ ```bash
105
+ ceph-devstack pull
106
+ ```
107
+
108
+ Optional: If building any images from repos:
109
+ ```bash
110
+ ceph-devstack build
111
+ ```
112
+
113
+ Next, you can start the containers with:
114
+
115
+ ```bash
116
+ ceph-devstack start
117
+ ```
118
+
119
+ Once everything is started, a message similar to this will be logged:
120
+
121
+ `View test results at http://smithi065.front.sepia.ceph.com:8081/`
122
+
123
+ This link points to the running Pulpito instance. Test archives are also stored in the `--data-dir` (default: `~/.local/share/ceph-devstack`).
124
+
125
+ To watch teuthology's output, you can:
126
+
127
+ ```bash
128
+ podman logs -f teuthology
129
+ ```
130
+
131
+ If you want testnode containers to be replaced as they are stopped and destroyed, you can:
132
+
133
+ ```bash
134
+ ceph-devstack watch
135
+ ```
136
+
137
+ When finished, this command removes all the resources that were created:
138
+
139
+ ```bash
140
+ ceph-devstack remove
141
+ ```
142
+
143
+ ### Specifying a Test Suite
144
+ By default, we run the `teuthology:no-ceph` suite to self-test teuthology. If we wanted to test Ceph itself, we could use the `orch:cephadm:smoke-small` suite:
145
+
146
+ ```bash
147
+ export TEUTHOLOGY_SUITE=orch:cephadm:smoke-small
148
+ ```
149
+
150
+ It's possible to skip the automatic suite-scheduling behavior:
151
+
152
+ ```bash
153
+ export TEUTHOLOGY_SUITE=none
154
+ ```
155
+
156
+ ### Using testnodes from an existing lab
157
+ If you need to use "real" testnodes and have access to a lab, there are a few additonal steps to take. We will use the Sepia lab as an example below:
158
+
159
+ To give the teuthology container access to your SSH private key (via `podman secret`):
160
+
161
+ ```bash
162
+ export SSH_PRIVKEY_PATH=$HOME/.ssh/id_rsa
163
+ ```
164
+
165
+ To lock machines from the lab:
166
+
167
+ ```bash
168
+ ssh teuthology.front.sepia.ceph.com
169
+ ~/teuthology/virtualenv/bin/teuthology-lock \
170
+ --lock-many 1 \
171
+ --machine-type smithi \
172
+ --desc "teuthology dev testing"
173
+ ```
174
+
175
+ Once you have your machines locked, you need to provide a list of their hostnames and their machine type:
176
+
177
+ ```bash
178
+ export TEUTHOLOGY_TESTNODES="smithiXXX.front.sepia.ceph.com,smithiYYY.front.sepia.ceph.com"
179
+ export TEUTHOLOGY_MACHINE_TYPE="smithi"
180
+ ```
181
+
182
+ ### Setup for development
183
+
184
+ 1. First fork the repo if you have not done so.
185
+ 2. Clone your forked repo
186
+ ```bash
187
+ git clone https://github.com/<user-name>/ceph-devstack
188
+ ```
189
+
190
+ 3. Setup the remote repo as upstream (this will prevent creating additional branches)
191
+ ```bash
192
+ git remote add upstream https://github.com/zmc/ceph-devstack
193
+ ```
194
+
195
+ 4. Create virtual env in the root directory of ceph-devstack & install python dependencies
196
+ ```bash
197
+ python3 -m venv venv
198
+ ./venv/bin/pip3 install -e .
199
+ ```
200
+
201
+ 5. Activate venv
202
+ ```bash
203
+ source venv/bin/activate
204
+ ```
205
+
206
+ 6. Run doctor command to check & fix the dependencies that you need for ceph-devstack
207
+ ```bash
208
+ ceph-devstack -v doctor --fix
209
+ ```
210
+
211
+ 7. Build, Create and Start the all containers in ceph-devstack
212
+ ```bash
213
+ ceph-devstack -v build
214
+ ceph-devstack -v create
215
+ ceph-devstack -v start
216
+ ```
217
+
218
+ 8. Test the containers by waiting for teuthology to finish and print the logs
219
+ ```bash
220
+ ceph-devstack wait teuthology
221
+ podman logs -f teuthology
222
+ ```