driver / standard (pull_request) Successful in 17s
driver / lint (pull_request) Successful in 17s
driver / types (pull_request) Successful in 1m15s
driver / test (3.12) (pull_request) Successful in 1m11s
driver / test (3.13) (pull_request) Successful in 1m0s
driver / lowest (pull_request) Successful in 30s
driver / build (pull_request) Successful in 34s
driver / security (pull_request) Successful in 1m12s
CI / driver (pull_request) Successful in 2m58s
driver / publish (pull_request) Skipped
napalm-linux now brings napalm-device-types' PosixTimeSyncMixin (4.35.0). Its write -- a chrony drop-in with every other source commented out, timedatectl set-timezone -- is the wrong way in on OpenMediaVault: OMV generates chrony.conf and the zone from conf.system.time through Salt and would take the change back on its next deploy, the web UI would keep showing its own servers, and netOrk's automatic alignment would rewrite on every poll (NetOrk/netork#2370). OmvTimeSyncMixin reads the servers and the zone from System.getTimeSettings (no servers while NTP is off) and keeps the host's reading for whether the clock is synchronised and by which client. Both values are written through System.setTimeSettings, NTP switched on for servers, and only the modules that change made dirty are applied, plus chrony and timezone if already dirty, as set_hostname does. A value OMV already has is not written again, so a second write changes nothing. The floor rises to napalm-device-types 4.35.0.
91 lines
4.7 KiB
Markdown
91 lines
4.7 KiB
Markdown
# napalm-openmediavault
|
|
|
|
NAPALM driver for [OpenMediaVault](https://www.openmediavault.org/) NAS systems, built on
|
|
[napalm-device-types](https://git.netork.io/NAPALM/napalm-device-types) (`StorageDriver`) and
|
|
[napalm-linux](https://git.netork.io/NAPALM/napalm-linux) (`LinuxDriver`).
|
|
|
|
OpenMediaVault is Debian underneath, so the driver inherits everything napalm-linux does for a
|
|
Linux host (packages, updates, services, users, processes, scheduled jobs, Docker) and adds the NAS side:
|
|
disks, md RAID arrays, filesystems, shares and the NAS services.
|
|
|
|
## Tested against
|
|
|
|
| Model | Firmware |
|
|
|---|---|
|
|
| OpenMediaVault | 6.x (Debian Bullseye), 7.x (Debian Bookworm) |
|
|
|
|
## Connection
|
|
|
|
SSH, port 22 by default, through napalm-linux (Netmiko). The account needs a shell; `smartctl`
|
|
and `mdadm` run through `sudo` (passwordless, or with `sudo_password`). Every `optional_args`
|
|
key of napalm-linux is accepted (`port`, `pkg_manager`, `sudo_password`, …).
|
|
|
|
```python
|
|
from napalm import get_network_driver
|
|
|
|
driver = get_network_driver("openmediavault")
|
|
with driver("192.0.2.10", "admin", "secret", optional_args={"sudo_password": "secret"}) as nas:
|
|
print(nas.get_facts())
|
|
print(nas.get_disks())
|
|
print(nas.get_shares())
|
|
```
|
|
|
|
## Supported
|
|
|
|
| Getter / action | |
|
|
|---|---|
|
|
| `get_facts` | napalm-linux's facts, `os_version` is `OMV <version>` of the `openmediavault` package |
|
|
| `get_disks` | `lsblk` for the disks, `smartctl -iHA` for health (`healthy`, `warning`, `failed`, `unknown`), temperature and RPM |
|
|
| `get_disk_pools` | md arrays from `/proc/mdstat`, size and state from `mdadm --detail` |
|
|
| `get_volumes` | mounted block-device filesystems from `df`, read-only flag from `/proc/mounts` |
|
|
| `get_shares` | SMB, NFS and FTP shares from OMV's configuration database (`omv-confdbadm`) |
|
|
| `get_storage_services` | whether `smbd`, `nfs-server`, `proftpd`, `ssh` and `rsync` are enabled and running |
|
|
| `get_scheduled_jobs` | napalm-linux's reading of the host, but the web UI's "Scheduled Jobs" and the power-management schedule come from `Cron.getList` (`omv:<uuid>`, disabled ones too) instead of the lines OMV generates for them; the cron files OMV generates (`/etc/cron.d/openmediavault-*`, `openmediavault-flushmailq`, `-apticron`, `-samba-recycle`) are `platform` and only run |
|
|
| `manage_scheduled_job` | an OMV job: `Cron.set` with only `enable` changed, or `Cron.execute` followed through `Exec.getOutput` (stopped after 300 s); a power-management job is not run; anything else as napalm-linux, never a generated file |
|
|
| `put_scheduled_job` | an OMV job through `Cron.set`, in the web UI like any other, its comment `napalm-scheduled-job: <name> <description>`; a multi-line command is fine |
|
|
| `delete_scheduled_job` | an application's OMV job through `Cron.delete`; an application's Linux job as napalm-linux |
|
|
| `get_time_sync` | the servers and the zone of OMV's web UI (`System.getTimeSettings`; no servers while NTP is off); synchronised and the client from napalm-linux's reading of the host |
|
|
| `configure_time_sync` | servers (NTP switched on) and zone through `System.setTimeSettings`, then `Config.applyChanges` for the modules that made dirty (`chrony`, `timezone`); a value OMV already has is not written again |
|
|
| everything of napalm-linux | packages, updates, services, users, processes, Docker, … |
|
|
|
|
Every scheduled-job write through RPC deploys the `cron` module alone (`Config.applyChanges`):
|
|
changes left pending in the web UI for other modules stay pending.
|
|
|
|
Time sync never writes the host's files the way napalm-linux does (a chrony drop-in,
|
|
`timedatectl set-timezone`): OpenMediaVault generates `chrony.conf` and the zone from
|
|
`conf.system.time` and would write over them.
|
|
|
|
"Upgrade everything" is a full upgrade (`FULL_UPGRADE = True`): a plain `apt-get upgrade` holds
|
|
back OpenMediaVault's own packages and the kernel.
|
|
|
|
The SSH hardening of napalm-linux (`harden_ssh_server`) writes only the drop-in under
|
|
`/etc/ssh/sshd_config.d` (`SSHD_CONFIG_GENERATED = True`). OpenMediaVault generates
|
|
`sshd_config` from its own database and would write over a change to it, but its template
|
|
includes that directory, and salt leaves the drop-in alone. An algorithm set in the SSH
|
|
settings' "Extra options" comes before the include and wins; the hardening sees that, puts
|
|
its change back and says so.
|
|
|
|
## Not supported
|
|
|
|
- `get_volume_snapshots`, `get_replication_jobs`, `get_quotas` raise `NotImplementedError`.
|
|
- Configuration changes to shares, disks or arrays.
|
|
|
|
## Installation
|
|
|
|
```bash
|
|
pip install napalm-openmediavault
|
|
```
|
|
|
|
## Development
|
|
|
|
The rules are in [STANDARDS.md](https://git.netork.io/NAPALM/driver-standard/src/branch/main/STANDARDS.md).
|
|
|
|
```bash
|
|
python -m venv .venv && .venv/bin/pip install -e ".[dev]"
|
|
.venv/bin/pytest --cov
|
|
```
|
|
|
|
## License
|
|
|
|
Apache-2.0
|