feat(time-sync): servers and zone on Proxmox VE and Backup Server
driver / standard (pull_request) Successful in 14s
driver / lint (pull_request) Successful in 14s
driver / types (pull_request) Successful in 56s
driver / test (3.12) (pull_request) Successful in 1m2s
driver / test (3.13) (pull_request) Successful in 59s
driver / lowest (pull_request) Successful in 32s
driver / build (pull_request) Successful in 31s
driver / security (pull_request) Successful in 1m11s
CI / driver (pull_request) Successful in 2m41s
driver / publish (pull_request) Skipped

netOrk keeps one list of NTP servers and a time zone per site and aligns
a device that differs (NetOrk/netork#2360, #2365). Both drivers now
implement napalm-device-types' TimeSyncMixin (4.35.0) and write both
values.

Neither API keeps time servers: /nodes/{node}/time knows only the zone,
and both products run chrony on Debian. The servers are therefore
PosixTimeSyncMixin's, over the driver's existing SSH session
(run_command, root): read from chrony's configuration, written to
/etc/chrony/sources.d/netork.sources with every other source commented
out, then a reload or a restart of chrony.

The zone is read with them from the host (timedatectl: the zone the
clock really runs in), and from GET /nodes/{node}/time only where the
host names none. It is written through PUT /nodes/{node}/time rather
than timedatectl set-timezone: Proxmox's own call validates the name and
keeps /etc/timezone, which its web UI and API show, in step with
/etc/localtime.

One device is one node: in a PVE cluster every node has its own clock,
and only the node this connection resolved is read and written.

get_ntp_servers() read GET /nodes/{node}/ntp, a path Proxmox VE does not
have, so it always reported no servers. It now reports what
get_time_sync() reads, on the backup server too.
This commit is contained in:
Christian Manivong committed 2026-11-11 15:18:08 +01:00
1 parent aeb12eae00
commit 410d34bdee
11 files changed
+457 -46

No files matched your search

+18 -1
View File
@@ -8,6 +8,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Added
- Time sync on both drivers (NetOrk/netork#2365), through napalm-device-types'
`TimeSyncMixin` (4.35.0); both write the servers and the zone. Neither API keeps time
servers -- both products run chrony on Debian -- so `get_time_sync()` reads chrony's
sources, whether it is synchronised and the zone (`timedatectl`) in one round trip over
the driver's SSH session (`PosixTimeSyncMixin`), and the zone from `GET
/nodes/{node}/time` only where the host names none. `configure_time_sync()` writes the
servers to `/etc/chrony/sources.d/netork.sources` with every other source commented out
(Debian's vendor pool, the DHCP `sourcedir`) and reloads or restarts chrony; the zone
goes through `PUT /nodes/{node}/time`, Proxmox's own call, so `/etc/timezone` and the
web UI follow `/etc/localtime`. The token needs `Sys.Modify` for it (PVE on
`/nodes/{node}`, PBS on `/system/time`). Only the node of the connection is read and
written: in a PVE cluster each node keeps its own clock.
- What a restart would abort, on both drivers (NetOrk/netork#2318), through
napalm-device-types' `RunningBackupsMixin` (4.34.0): `get_running_backups()` lists on
Proxmox VE the node's active vzdump tasks with the guests each is taking now -- the task's
@@ -33,7 +45,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
in its own daemons; `get_clusters()` and `get_backup_jobs()` keep them.
### Changed
- Requires napalm-device-types 4.34.0.
- Requires napalm-device-types 4.35.0.
### Fixed
- `get_ntp_servers()` read `GET /nodes/{node}/ntp`, a path Proxmox VE does not have, and so
always reported no servers. It now reports chrony's configured sources, the ones
`get_time_sync()` reads, and the backup server has it too.
## [0.10.0] - 2026-11-03