olvm-aiops 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 (133) hide show
  1. olvm_aiops-0.1.0/.claude-plugin/plugin.json +24 -0
  2. olvm_aiops-0.1.0/.github/workflows/mcp-publish.yml +55 -0
  3. olvm_aiops-0.1.0/.github/workflows/publish.yml +26 -0
  4. olvm_aiops-0.1.0/.gitignore +23 -0
  5. olvm_aiops-0.1.0/.mcp.json +13 -0
  6. olvm_aiops-0.1.0/CHANGELOG.md +41 -0
  7. olvm_aiops-0.1.0/Dockerfile +9 -0
  8. olvm_aiops-0.1.0/LICENSE +21 -0
  9. olvm_aiops-0.1.0/PKG-INFO +241 -0
  10. olvm_aiops-0.1.0/README.md +225 -0
  11. olvm_aiops-0.1.0/SECURITY.md +85 -0
  12. olvm_aiops-0.1.0/docs/VERIFICATION.md +124 -0
  13. olvm_aiops-0.1.0/glama.json +6 -0
  14. olvm_aiops-0.1.0/mcp_server/__init__.py +1 -0
  15. olvm_aiops-0.1.0/mcp_server/_shared.py +140 -0
  16. olvm_aiops-0.1.0/mcp_server/server.py +33 -0
  17. olvm_aiops-0.1.0/mcp_server/tools/__init__.py +1 -0
  18. olvm_aiops-0.1.0/mcp_server/tools/reads.py +153 -0
  19. olvm_aiops-0.1.0/mcp_server/tools/storage_vms.py +126 -0
  20. olvm_aiops-0.1.0/mcp_server/tools/undo.py +204 -0
  21. olvm_aiops-0.1.0/olvm_aiops/__init__.py +14 -0
  22. olvm_aiops-0.1.0/olvm_aiops/cli/__init__.py +9 -0
  23. olvm_aiops-0.1.0/olvm_aiops/cli/_common.py +122 -0
  24. olvm_aiops-0.1.0/olvm_aiops/cli/_root.py +63 -0
  25. olvm_aiops-0.1.0/olvm_aiops/cli/activity.py +67 -0
  26. olvm_aiops-0.1.0/olvm_aiops/cli/doctor.py +21 -0
  27. olvm_aiops-0.1.0/olvm_aiops/cli/init.py +120 -0
  28. olvm_aiops-0.1.0/olvm_aiops/cli/inventory.py +169 -0
  29. olvm_aiops-0.1.0/olvm_aiops/cli/secret.py +106 -0
  30. olvm_aiops-0.1.0/olvm_aiops/cli/storage_vms.py +144 -0
  31. olvm_aiops-0.1.0/olvm_aiops/cli/undo.py +66 -0
  32. olvm_aiops-0.1.0/olvm_aiops/config.py +177 -0
  33. olvm_aiops-0.1.0/olvm_aiops/connection.py +486 -0
  34. olvm_aiops-0.1.0/olvm_aiops/doctor.py +106 -0
  35. olvm_aiops-0.1.0/olvm_aiops/governance/__init__.py +50 -0
  36. olvm_aiops-0.1.0/olvm_aiops/governance/audit.py +377 -0
  37. olvm_aiops-0.1.0/olvm_aiops/governance/budget.py +222 -0
  38. olvm_aiops-0.1.0/olvm_aiops/governance/decorators.py +510 -0
  39. olvm_aiops-0.1.0/olvm_aiops/governance/outcome.py +104 -0
  40. olvm_aiops-0.1.0/olvm_aiops/governance/paths.py +23 -0
  41. olvm_aiops-0.1.0/olvm_aiops/governance/patterns.py +378 -0
  42. olvm_aiops-0.1.0/olvm_aiops/governance/policy.py +67 -0
  43. olvm_aiops-0.1.0/olvm_aiops/governance/sanitize.py +79 -0
  44. olvm_aiops-0.1.0/olvm_aiops/governance/undo.py +257 -0
  45. olvm_aiops-0.1.0/olvm_aiops/ops/__init__.py +1 -0
  46. olvm_aiops-0.1.0/olvm_aiops/ops/_util.py +134 -0
  47. olvm_aiops-0.1.0/olvm_aiops/ops/activity.py +186 -0
  48. olvm_aiops-0.1.0/olvm_aiops/ops/diagnose.py +595 -0
  49. olvm_aiops-0.1.0/olvm_aiops/ops/engine_health.py +149 -0
  50. olvm_aiops-0.1.0/olvm_aiops/ops/inventory.py +113 -0
  51. olvm_aiops-0.1.0/olvm_aiops/ops/storage.py +107 -0
  52. olvm_aiops-0.1.0/olvm_aiops/ops/vms.py +91 -0
  53. olvm_aiops-0.1.0/olvm_aiops/secretstore.py +306 -0
  54. olvm_aiops-0.1.0/openclaw.plugin.json +24 -0
  55. olvm_aiops-0.1.0/package.json +20 -0
  56. olvm_aiops-0.1.0/pyproject.toml +60 -0
  57. olvm_aiops-0.1.0/server.json +21 -0
  58. olvm_aiops-0.1.0/skills/olvm-aiops/SKILL.md +215 -0
  59. olvm_aiops-0.1.0/skills/olvm-aiops/references/agent-guardrails.md +66 -0
  60. olvm_aiops-0.1.0/skills/olvm-aiops/references/capabilities.md +67 -0
  61. olvm_aiops-0.1.0/skills/olvm-aiops/references/cli-reference.md +88 -0
  62. olvm_aiops-0.1.0/skills/olvm-aiops/references/setup-guide.md +97 -0
  63. olvm_aiops-0.1.0/tests/conftest.py +37 -0
  64. olvm_aiops-0.1.0/tests/fixtures/olvm-4.5.5-host-rebooting/README.md +15 -0
  65. olvm_aiops-0.1.0/tests/fixtures/olvm-4.5.5-host-rebooting/datacenters.json +71 -0
  66. olvm_aiops-0.1.0/tests/fixtures/olvm-4.5.5-host-rebooting/events_warning_plus.json +21 -0
  67. olvm_aiops-0.1.0/tests/fixtures/olvm-4.5.5-host-rebooting/hosts.json +215 -0
  68. olvm_aiops-0.1.0/tests/fixtures/olvm-4.5.5-host-rebooting/jobs.json +68 -0
  69. olvm_aiops-0.1.0/tests/fixtures/olvm-4.5.5-installing/README.md +17 -0
  70. olvm_aiops-0.1.0/tests/fixtures/olvm-4.5.5-installing/api_root.json +50 -0
  71. olvm_aiops-0.1.0/tests/fixtures/olvm-4.5.5-installing/clusters.json +140 -0
  72. olvm_aiops-0.1.0/tests/fixtures/olvm-4.5.5-installing/datacenters.json +71 -0
  73. olvm_aiops-0.1.0/tests/fixtures/olvm-4.5.5-installing/events.json +459 -0
  74. olvm_aiops-0.1.0/tests/fixtures/olvm-4.5.5-installing/hosts.json +215 -0
  75. olvm_aiops-0.1.0/tests/fixtures/olvm-4.5.5-installing/jobs.json +36 -0
  76. olvm_aiops-0.1.0/tests/fixtures/olvm-4.5.5-installing/storagedomains.json +66 -0
  77. olvm_aiops-0.1.0/tests/fixtures/olvm-4.5.5-installing/vms.json +1 -0
  78. olvm_aiops-0.1.0/tests/fixtures/olvm-4.5.5-running/README.md +33 -0
  79. olvm_aiops-0.1.0/tests/fixtures/olvm-4.5.5-running/api_root.json +50 -0
  80. olvm_aiops-0.1.0/tests/fixtures/olvm-4.5.5-running/clusters.json +153 -0
  81. olvm_aiops-0.1.0/tests/fixtures/olvm-4.5.5-running/datacenter_storagedomain_get.json +58 -0
  82. olvm_aiops-0.1.0/tests/fixtures/olvm-4.5.5-running/datacenter_storagedomains.json +62 -0
  83. olvm_aiops-0.1.0/tests/fixtures/olvm-4.5.5-running/datacenters.json +72 -0
  84. olvm_aiops-0.1.0/tests/fixtures/olvm-4.5.5-running/disks.json +86 -0
  85. olvm_aiops-0.1.0/tests/fixtures/olvm-4.5.5-running/events.json +184 -0
  86. olvm_aiops-0.1.0/tests/fixtures/olvm-4.5.5-running/fault_404.json +6 -0
  87. olvm_aiops-0.1.0/tests/fixtures/olvm-4.5.5-running/follow.json +3 -0
  88. olvm_aiops-0.1.0/tests/fixtures/olvm-4.5.5-running/host_statistics.json +324 -0
  89. olvm_aiops-0.1.0/tests/fixtures/olvm-4.5.5-running/hosts.json +258 -0
  90. olvm_aiops-0.1.0/tests/fixtures/olvm-4.5.5-running/hosts_all_content.json +259 -0
  91. olvm_aiops-0.1.0/tests/fixtures/olvm-4.5.5-running/jobs.json +169 -0
  92. olvm_aiops-0.1.0/tests/fixtures/olvm-4.5.5-running/networks.json +38 -0
  93. olvm_aiops-0.1.0/tests/fixtures/olvm-4.5.5-running/search_page2.json +118 -0
  94. olvm_aiops-0.1.0/tests/fixtures/olvm-4.5.5-running/storagedomain_disks.json +79 -0
  95. olvm_aiops-0.1.0/tests/fixtures/olvm-4.5.5-running/storagedomain_get.json +85 -0
  96. olvm_aiops-0.1.0/tests/fixtures/olvm-4.5.5-running/storagedomains.json +151 -0
  97. olvm_aiops-0.1.0/tests/fixtures/olvm-4.5.5-running/storagedomains_global.json +151 -0
  98. olvm_aiops-0.1.0/tests/fixtures/olvm-4.5.5-running/templates.json +150 -0
  99. olvm_aiops-0.1.0/tests/fixtures/olvm-4.5.5-running/vm_after.json +308 -0
  100. olvm_aiops-0.1.0/tests/fixtures/olvm-4.5.5-running/vm_start_200_accepted.json +196 -0
  101. olvm_aiops-0.1.0/tests/fixtures/olvm-4.5.5-running/vm_start_409_disk_locked.json +10 -0
  102. olvm_aiops-0.1.0/tests/fixtures/olvm-4.5.5-running/vm_start_status_trace.json +17 -0
  103. olvm_aiops-0.1.0/tests/fixtures/olvm-4.5.5-running/vm_statistics.json +321 -0
  104. olvm_aiops-0.1.0/tests/fixtures/olvm-4.5.5-running/vms.json +299 -0
  105. olvm_aiops-0.1.0/tests/test_cli_audited.py +156 -0
  106. olvm_aiops-0.1.0/tests/test_cli_governed_exit.py +170 -0
  107. olvm_aiops-0.1.0/tests/test_cli_reads.py +83 -0
  108. olvm_aiops-0.1.0/tests/test_cli_secret.py +148 -0
  109. olvm_aiops-0.1.0/tests/test_cli_storage_vms.py +74 -0
  110. olvm_aiops-0.1.0/tests/test_connection_config.py +580 -0
  111. olvm_aiops-0.1.0/tests/test_doctor.py +209 -0
  112. olvm_aiops-0.1.0/tests/test_gov_audit.py +292 -0
  113. olvm_aiops-0.1.0/tests/test_gov_decorators.py +435 -0
  114. olvm_aiops-0.1.0/tests/test_gov_patterns.py +417 -0
  115. olvm_aiops-0.1.0/tests/test_gov_policy.py +56 -0
  116. olvm_aiops-0.1.0/tests/test_governance_persistence.py +331 -0
  117. olvm_aiops-0.1.0/tests/test_init.py +140 -0
  118. olvm_aiops-0.1.0/tests/test_lazy_imports.py +61 -0
  119. olvm_aiops-0.1.0/tests/test_mcp_and_server.py +258 -0
  120. olvm_aiops-0.1.0/tests/test_mcp_reads.py +95 -0
  121. olvm_aiops-0.1.0/tests/test_mcp_storage_vms.py +81 -0
  122. olvm_aiops-0.1.0/tests/test_ops_activity.py +229 -0
  123. olvm_aiops-0.1.0/tests/test_ops_diagnose.py +142 -0
  124. olvm_aiops-0.1.0/tests/test_ops_diagnose_events.py +304 -0
  125. olvm_aiops-0.1.0/tests/test_ops_diagnose_storage.py +110 -0
  126. olvm_aiops-0.1.0/tests/test_ops_diagnose_vms.py +122 -0
  127. olvm_aiops-0.1.0/tests/test_ops_inventory.py +74 -0
  128. olvm_aiops-0.1.0/tests/test_ops_storage.py +92 -0
  129. olvm_aiops-0.1.0/tests/test_ops_vms.py +68 -0
  130. olvm_aiops-0.1.0/tests/test_secretstore.py +99 -0
  131. olvm_aiops-0.1.0/tests/test_secretstore_extra.py +140 -0
  132. olvm_aiops-0.1.0/tests/test_smoke.py +173 -0
  133. olvm_aiops-0.1.0/tests/test_util.py +78 -0
@@ -0,0 +1,24 @@
1
+ {
2
+ "$schema": "https://anthropic.com/claude-code/plugin.schema.json",
3
+ "name": "olvm-aiops",
4
+ "displayName": "OLVM AIops",
5
+ "version": "0.1.0",
6
+ "description": "Governed OLVM / oVirt 4.5 ops — 17 MCP tools: inventory, health, capacity, diagnosis; audited.",
7
+ "author": {
8
+ "name": "Wei Zhou",
9
+ "email": "zhouwei008@gmail.com",
10
+ "url": "https://github.com/AIops-tools"
11
+ },
12
+ "homepage": "https://github.com/AIops-tools/OLVM-AIops",
13
+ "repository": "https://github.com/AIops-tools/OLVM-AIops",
14
+ "license": "MIT",
15
+ "keywords": [
16
+ "olvm",
17
+ "ovirt",
18
+ "oracle-linux",
19
+ "kvm",
20
+ "virtualization",
21
+ "mcp",
22
+ "aiops"
23
+ ]
24
+ }
@@ -0,0 +1,55 @@
1
+ name: mcp-publish
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ release:
6
+ types: [published]
7
+
8
+ permissions:
9
+ id-token: write
10
+ contents: read
11
+
12
+ jobs:
13
+ publish-mcp:
14
+ runs-on: ubuntu-latest
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+ - name: Wait for PyPI
18
+ # The release event also triggers the PyPI publish workflow; the MCP
19
+ # registry validates that the package version exists on PyPI, so poll
20
+ # until it has propagated (every 15s, up to 10 minutes).
21
+ run: |
22
+ python3 - <<'EOF'
23
+ import json
24
+ import sys
25
+ import time
26
+ import urllib.error
27
+ import urllib.request
28
+
29
+ with open("server.json", encoding="utf-8") as f:
30
+ package = json.load(f)["packages"][0]
31
+ name, version = package["identifier"], package["version"]
32
+ url = f"https://pypi.org/pypi/{name}/{version}/json"
33
+ deadline = time.monotonic() + 600
34
+ while True:
35
+ try:
36
+ with urllib.request.urlopen(url, timeout=10):
37
+ print(f"{name}=={version} is available on PyPI.")
38
+ sys.exit(0)
39
+ except (urllib.error.URLError, OSError) as exc:
40
+ print(f"{name}=={version} not on PyPI yet ({exc}); "
41
+ "retrying in 15s...")
42
+ if time.monotonic() >= deadline:
43
+ sys.exit(f"Timed out after 10 minutes waiting for "
44
+ f"{name}=={version} to appear on PyPI. "
45
+ "Check the PyPI publish workflow, then re-run "
46
+ "this workflow via workflow_dispatch.")
47
+ time.sleep(15)
48
+ EOF
49
+ - name: Install mcp-publisher
50
+ run: |
51
+ curl -sL "https://github.com/modelcontextprotocol/registry/releases/latest/download/mcp-publisher_$(uname -s | tr '[:upper:]' '[:lower:]')_$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/').tar.gz" | tar xz mcp-publisher
52
+ - name: Login to MCP Registry (GitHub OIDC)
53
+ run: ./mcp-publisher login github-oidc
54
+ - name: Publish server.json
55
+ run: ./mcp-publisher publish
@@ -0,0 +1,26 @@
1
+ name: Publish to PyPI
2
+
3
+ # Trusted Publishing (OIDC) — publishes from GitHub's runners with no API token,
4
+ # sidestepping the local-IP / account new-project rate limit. Configure a matching
5
+ # "trusted publisher" for this package on PyPI (see the repo release notes).
6
+ on:
7
+ release:
8
+ types: [published]
9
+ workflow_dispatch:
10
+
11
+ permissions:
12
+ contents: read
13
+
14
+ jobs:
15
+ publish:
16
+ runs-on: ubuntu-latest
17
+ permissions:
18
+ id-token: write # required for PyPI Trusted Publishing (OIDC)
19
+ steps:
20
+ - uses: actions/checkout@v4
21
+ - name: Set up uv
22
+ uses: astral-sh/setup-uv@v5
23
+ - name: Build sdist + wheel
24
+ run: uv build
25
+ - name: Publish to PyPI (Trusted Publishing)
26
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,23 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *.egg-info/
5
+ .pytest_cache/
6
+ .ruff_cache/
7
+
8
+ # Virtual envs / build
9
+ .venv/
10
+ dist/
11
+ build/
12
+
13
+ # uv
14
+ uv.lock
15
+
16
+ # Local config / secrets (never commit)
17
+ *.env
18
+ .env
19
+ config.yaml
20
+
21
+ # OS
22
+ .DS_Store
23
+ .coverage
@@ -0,0 +1,13 @@
1
+ {
2
+ "mcpServers": {
3
+ "olvm-aiops": {
4
+ "type": "stdio",
5
+ "command": "uvx",
6
+ "args": [
7
+ "--from",
8
+ "olvm-aiops==0.1.0",
9
+ "olvm-aiops-mcp"
10
+ ]
11
+ }
12
+ }
13
+ }
@@ -0,0 +1,41 @@
1
+ # Changelog
2
+
3
+ ## Unreleased — v0.1.0
4
+
5
+ First release of olvm-aiops: governed operations for Oracle Linux Virtualization
6
+ Manager (OLVM) and upstream oVirt 4.5 engines, built from the AIops-tools line
7
+ template (vendored governance harness, encrypted secret store, CLI + MCP server).
8
+
9
+ ### Added
10
+ - Engine connection over the REST API without the official SDK (which needs
11
+ `pycurl` built from source): SSO password-grant login with the mandatory
12
+ `ovirt-app-api` scope, `Version: 4` requests, the engine's own fault reason and
13
+ detail in every error, one re-login and retry on 401 (the engine issues no
14
+ refresh token), renewal serialised across threads, and timeouts reported as
15
+ timeouts rather than connectivity faults.
16
+ - Targets carry the username with its profile (`admin@internal`, or
17
+ `admin@ovirt@internalsso` on engines where setup enabled Keycloak — the default
18
+ since 4.5.1), optional `ca_file` for the engine CA, and a per-target `timeout`.
19
+ - `olvm-aiops init` wizard and `olvm-aiops doctor` (login + engine product
20
+ version); passwords stored encrypted.
21
+ - A 2xx response that is not JSON (a proxy error or SSO login page) is an error,
22
+ not an empty collection, and so is an empty GET body; after a refused login —
23
+ first or renewal — the target fails fast for 60 s so a changed password cannot
24
+ lock the account; concurrent first calls share one engine session.
25
+ - Only `https://` engine URLs are accepted (login sends the password in the
26
+ body); a connect timeout is reported as an unreachable engine, not a slow one;
27
+ a wrong master password reaches MCP clients and the CLI as its own message.
28
+ - Every CLI read calls the MCP tool of the same name, so it is audited, budgeted
29
+ and exits non-zero on failure; the CLI revokes its SSO token when it exits.
30
+ - Reads: data centers, clusters, hosts, storage domains (status joined from each
31
+ data center), VMs and statistics, events (severity threshold, `page`,
32
+ `after_index` cursor returning the events after it oldest first,
33
+ `since_minutes`) and jobs (newest first), each listing with measured truncation.
34
+ - Diagnoses `engine_health_rca`, `host_health_rca`, `storage_capacity_rca` and
35
+ `vm_health_rca`: findings ranked worst first with signal, cause and action.
36
+ Every warning-or-worse event in the last `events_window_hours` (default 24)
37
+ belongs to exactly one of them, one finding per subject and code; certificate,
38
+ engine-backup, HA-reservation, storage-deactivation and time-drift events carry
39
+ their own cause; a host set to Up, a VM started or reported back up, and a data
40
+ center that is up again supersede their earlier events; `eventsTruncated` means
41
+ the window itself was cut; over-commit alone is low.
@@ -0,0 +1,9 @@
1
+ # syntax=docker/dockerfile:1
2
+ # Minimal image for Glama introspection: starts the MCP server over stdio.
3
+ # The tools/list introspection handshake needs no live engine credentials.
4
+ FROM python:3.12-slim
5
+
6
+ RUN pip install --no-cache-dir olvm-aiops
7
+
8
+ # MCP server speaks JSON-RPC over stdio.
9
+ ENTRYPOINT ["olvm-aiops-mcp"]
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 wei <zhouwei008@gmail.com>
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,241 @@
1
+ Metadata-Version: 2.5
2
+ Name: olvm-aiops
3
+ Version: 0.1.0
4
+ Summary: Governed OLVM / oVirt 4.5 operations — inventory, health, capacity and diagnosis, every call audited.
5
+ Author-email: Wei Zhou <zhouwei008@gmail.com>
6
+ License-Expression: MIT
7
+ License-File: LICENSE
8
+ Requires-Python: >=3.11
9
+ Requires-Dist: cryptography>=42.0
10
+ Requires-Dist: httpx<1.0,>=0.27
11
+ Requires-Dist: mcp[cli]<3.0,>=2.0
12
+ Requires-Dist: pyyaml<7.0,>=6.0
13
+ Requires-Dist: rich<16.0,>=13.0
14
+ Requires-Dist: typer<1.0,>=0.12
15
+ Description-Content-Type: text/markdown
16
+
17
+ <!-- mcp-name: io.github.AIops-tools/olvm-aiops -->
18
+
19
+ # OLVM AIops
20
+
21
+ > **Disclaimer**: Community-maintained open-source project. **Not affiliated with, endorsed by, or sponsored by Oracle or the oVirt project.** "Oracle", "Oracle Linux" and "oVirt" are trademarks of their owners. MIT licensed.
22
+
23
+ AI-powered operations for **Oracle Linux Virtualization Manager (OLVM)** and
24
+ **oVirt 4.5**, over the engine REST API, with a **built-in governance harness** —
25
+ an audit log that MCP and CLI calls both write to, a token/runaway budget guard,
26
+ and descriptive risk tiers. Built for teams that run OLVM (often next to another
27
+ hypervisor platform) and want an agent to answer "what needs attention?" with
28
+ evidence from the engine, not guesses. Built on `httpx` and the MCP SDK, not on the
29
+ pycurl-based engine SDK.
30
+
31
+ > **Read-only in this release**: inventory, health, capacity and diagnosis.
32
+ > Engine actions are asynchronous — the engine answers `complete` long before a
33
+ > VM or host reaches its target state — so write tools are held back until each
34
+ > can confirm its own outcome. Do NOT use for XCP-ng — use xcpng-aiops. Do NOT
35
+ > use for Proxmox VE — use proxmox-aiops.
36
+
37
+ ## What this tool does, and does not, decide
38
+
39
+ It reads an OLVM / oVirt engine accurately and records every call. It does
40
+ **not** decide what an agent may change — that belongs to the engine account you
41
+ connect it with. Give that account a read-only role (such as `ReadOnlyAdmin`) and
42
+ the engine itself enforces it.
43
+
44
+ The one thing the tool guarantees is that nothing is silent: **every call, over
45
+ MCP and over the CLI alike, lands an audit row** in `~/.olvm-aiops/audit.db`.
46
+
47
+ Running a smaller / local model? See
48
+ [agent-guardrails.md](skills/olvm-aiops/references/agent-guardrails.md) for what
49
+ the tool already guarantees and a ready-made system prompt for the rest.
50
+
51
+ ## What it answers
52
+
53
+ | Question | Tool | CLI |
54
+ |---|---|---|
55
+ | Is the engine itself healthy — certificates, backups, clock? | `engine_health_rca` | `olvm-aiops engine health` |
56
+ | What is wrong with my hosts? | `host_health_rca` | `olvm-aiops host health` |
57
+ | Is storage about to stop the engine creating disks? | `storage_capacity_rca` | `olvm-aiops storage capacity` |
58
+ | Why is this VM paused / not responding? | `vm_health_rca` | `olvm-aiops vm health` |
59
+ | What happened recently? What is new since I last looked? | `event_list` | `olvm-aiops event list` |
60
+ | What long-running operations failed? | `job_list` | `olvm-aiops job list --status failed` |
61
+ | Inventory | `datacenter_list`, `cluster_list`, `host_list`/`host_get`, `storage_domain_list`/`storage_domain_get`, `vm_list`/`vm_get`, `vm_stats` | `datacenter`, `cluster`, `host`, `storage`, `vm` |
62
+
63
+ **17 MCP tools**: 15 reads and diagnoses, plus the harness's `undo_list` /
64
+ `undo_apply` (which have nothing to undo in a read-only release).
65
+
66
+ Each diagnosis ranks findings worst first; every finding carries the measured
67
+ `signal`, a `cause`, an `action` and an explicit `rank`. Transient states are not
68
+ reported as failures: a host the engine is installing or rebooting is "in
69
+ progress", alert 9000 on a host without fencing hardware is informational, and an
70
+ event the host, VM or data center has since recovered from is marked superseded.
71
+ Events older than 24 hours (`events_window_hours`) are history, not findings, and
72
+ every warning-or-worse event inside the window lands in exactly one diagnosis —
73
+ engine-wide alerts such as certificate expiry and missing backups included.
74
+
75
+ ## Built from a live engine, not from the docs
76
+
77
+ Every read was written against, and every fixture captured from, a live
78
+ **Oracle Linux Virtualization Manager 4.5.5-1.73.el9** engine with Keycloak
79
+ enabled. Things that engine does, which this tool accounts for:
80
+
81
+ - counts, sizes and flags arrive as JSON strings, timestamps as epoch-ms numbers;
82
+ - an attached storage domain has **no status** in `/storagedomains` — status is read
83
+ from each data center's storage-domain collection;
84
+ - `/jobs` refuses any `search` and returns jobs oldest first, so jobs are sorted here;
85
+ - the `time` search on events is unusable (formats return all or nothing), while
86
+ `from=<index>` is an exact cursor — hence `after_index` and a client-side `since_minutes`;
87
+ - the cursor sorted newest first returns the newest events above it and skips the rest, so
88
+ `after_index` reads oldest first;
89
+ - `/ovirt-engine/services/health` answers without a login, and a data center's old status
90
+ alerts stay in the log after it recovers;
91
+ - login events print the SSO session id, which is redacted before events are returned.
92
+
93
+ ## Quick start
94
+
95
+ ### As a Claude Code plugin
96
+
97
+ One install gives an agent both the skill and the MCP server:
98
+
99
+ ```
100
+ /plugin marketplace add AIops-tools/marketplace
101
+ /plugin install olvm-aiops@aiops-tools
102
+ ```
103
+
104
+ The MCP server is fetched with [uv](https://docs.astral.sh/uv/) and pinned to the
105
+ package version this plugin declares, so an audit row can be traced back to the
106
+ code that wrote it. Credentials are still configured with `olvm-aiops init` — see below.
107
+
108
+ ### As an OpenClaw plugin
109
+
110
+ The same bundle is published on [ClawHub](https://clawhub.ai/plugins), where one
111
+ install delivers the skill and its MCP server together:
112
+
113
+ ```bash
114
+ openclaw plugins install clawhub:@zw008/olvm-aiops
115
+ openclaw skills info olvm-aiops # expect: Visible to model: yes
116
+ ```
117
+
118
+ Restart the OpenClaw gateway afterwards so it loads the plugin. The MCP server is
119
+ fetched with [uv](https://docs.astral.sh/uv/), pinned to this exact release, so
120
+ `uvx` has to be on `PATH` — without it the skill still installs but reports
121
+ `Visible to model: no`. Credentials are configured exactly as below.
122
+
123
+ ### As a CLI or standalone MCP server
124
+
125
+ ```bash
126
+ uv tool install olvm-aiops
127
+ olvm-aiops init # wizard: engine URL, username with profile, CA file, encrypted password
128
+ olvm-aiops doctor # verify config, encrypted store, login and engine version
129
+ olvm-aiops host health # first diagnosis
130
+ ```
131
+
132
+ `init` writes `~/.olvm-aiops/config.yaml` (non-secret connection details) and
133
+ stores the password **encrypted** in `~/.olvm-aiops/secrets.enc`. Example:
134
+
135
+ ```yaml
136
+ targets:
137
+ - name: engine1
138
+ url: https://olvm-engine.example.com # the Administration Portal origin (FQDN)
139
+ username: admin@ovirt@internalsso # admin@internal on engines without Keycloak
140
+ ca_file: /etc/pki/olvm-engine-ca.pem # engine CA; keeps verify_ssl on
141
+ timeout: 30 # seconds per request; raise for busy engines
142
+ ```
143
+
144
+ The username includes its profile. Engine-setup enables Keycloak by default since
145
+ 4.5.1, which makes the admin `admin@ovirt@internalsso`; engines without Keycloak use
146
+ `admin@internal`. Download the engine CA from
147
+ `https://<engine>/ovirt-engine/services/pki-resource?resource=ca-certificate&format=X509-PEM-CA`
148
+ and connect by FQDN — the engine certificate does not cover its IP address.
149
+
150
+ For non-interactive use (MCP server, CI, cron) export the master password so the
151
+ store can be unlocked without a prompt:
152
+
153
+ ```bash
154
+ export OLVM_AIOPS_MASTER_PASSWORD='your-master-password'
155
+ ```
156
+
157
+ > **Where that password then lives**: an exported variable is readable by
158
+ > every process this shell starts and is recorded by shell history. On a
159
+ > shared or long-lived host, prefer the interactive prompt, or inject it from
160
+ > a secret manager for the life of the one command that needs it.
161
+
162
+ ### MCP client config
163
+
164
+ ```json
165
+ {
166
+ "mcpServers": {
167
+ "olvm-aiops": {
168
+ "command": "uvx",
169
+ "args": ["--from", "olvm-aiops", "olvm-aiops-mcp"],
170
+ "env": { "OLVM_AIOPS_MASTER_PASSWORD": "your-master-password" }
171
+ }
172
+ }
173
+ }
174
+ ```
175
+
176
+ > **Env-block caveat**: MCP clients launch the server with a minimal
177
+ > environment — your shell profile's exports are **not** inherited. Put
178
+ > `OLVM_AIOPS_MASTER_PASSWORD` (and, if you use them, `OLVM_AIOPS_HOME` /
179
+ > `OLVM_AIOPS_CONFIG` / `OLVM_AUDIT_APPROVED_BY`) in the `env` block above,
180
+ > or the encrypted store cannot be unlocked and every tool returns a teaching
181
+ > error.
182
+
183
+ ### Managing secrets
184
+
185
+ ```bash
186
+ olvm-aiops secret set engine1 # prompts hidden for the account password
187
+ olvm-aiops secret list # names only, values never shown
188
+ olvm-aiops secret rm engine1
189
+ olvm-aiops secret rotate-password # re-encrypt under a new master password
190
+ olvm-aiops secret migrate # import a legacy plaintext .env, then retires it
191
+ ```
192
+
193
+ A legacy plaintext env var `OLVM_<TARGET_NAME_UPPER>_PASSWORD` is still honoured
194
+ as a fallback with a deprecation warning (migrate with `olvm-aiops secret migrate`).
195
+
196
+ ## Governance
197
+
198
+ Every MCP tool passes through `@governed_tool`, and every CLI command calls the MCP tool of the
199
+ same name. It records; it does not authorize.
200
+
201
+ - **Audit** — every call (tool, params with secrets redacted, result, status, duration, risk tier, and any operator-supplied approver/rationale) lands in `~/.olvm-aiops/audit.db` (relocate with `OLVM_AIOPS_HOME`).
202
+ - **Budget / runaway guard** — a safety backstop, not an authorization gate: cumulative call and wall-time caps plus a tight-loop circuit breaker (`OLVM_MAX_TOOL_CALLS`, `OLVM_MAX_TOOL_SECONDS`, `OLVM_RUNAWAY_MAX`).
203
+ - **Risk tier** — a descriptive label on the audit row derived from `risk_level`; it gates nothing.
204
+ - **Output hygiene** — all engine-returned text is sanitized and bounded before it reaches the agent; SSO session ids in login events are redacted.
205
+
206
+ ## 支持范围 / Supported scope
207
+
208
+ | Area | Read | Write |
209
+ |------|------|-------|
210
+ | Engine | health diagnosis (health check, clock, certificates, backups) | — |
211
+ | Hosts | list / get / health diagnosis | — |
212
+ | Storage domains | list / get (data-center-scoped status, capacity) / capacity diagnosis | — |
213
+ | VMs | list / get / statistics / health diagnosis | — |
214
+ | Data centers, clusters | list | — |
215
+ | Events, jobs | list (severity, paging, `after_index`, `since_minutes`; job status) | — |
216
+
217
+ **缺功能?(Missing something?)** Coverage is intentionally focused. Open an issue or PR at
218
+ [github.com/AIops-tools/OLVM-AIops](https://github.com/AIops-tools/OLVM-AIops/issues)
219
+ — feature requests, contributions, and comments are all welcome.
220
+
221
+ ## Scope & caveats
222
+
223
+ - **Verification status**: every read and all four diagnoses were run end to end
224
+ against a live OLVM 4.5.5 engine with one KVM host, an NFS data domain and one VM.
225
+ Not yet verified: production-scale engines, iSCSI / FC / Gluster domains, multi-host
226
+ clusters, self-hosted engine deployments, or engines without Keycloak. See
227
+ [`docs/VERIFICATION.md`](docs/VERIFICATION.md).
228
+ - **Engine only**: no direct host (vdsm) access. Hosts, storage and VMs are seen the
229
+ way the engine sees them.
230
+ - **No writes** in this release. Start/stop/migrate, maintenance and snapshots are
231
+ planned once each write can confirm its own outcome rather than the engine's
232
+ immediate `complete`.
233
+
234
+ ## Not for
235
+
236
+ XCP-ng (use xcpng-aiops), Proxmox VE (use proxmox-aiops), other hypervisors,
237
+ NAS/storage appliances, backup suites, container clusters, or network devices.
238
+
239
+ ## License
240
+
241
+ MIT — [github.com/AIops-tools/OLVM-AIops](https://github.com/AIops-tools/OLVM-AIops)