diff --git a/packages/system/linstor/README.md b/packages/system/linstor/README.md index 8f6785bb9..f2b452457 100644 --- a/packages/system/linstor/README.md +++ b/packages/system/linstor/README.md @@ -1,4 +1,6 @@ -# Talos satellite graceful shutdown +# linstor + +## Talos satellite graceful shutdown Cozystack's Talos configuration removes the systemd `drbd-shutdown-guard`. The optional satellite preStop hook releases unused Secondary DRBD resources so their backing devices, including ZFS zvols, can be released during normal shutdown. @@ -26,6 +28,25 @@ Related upstream discussion: [Piraeus orderly shutdown on Talos](https://github. Run `make test` in this directory with Helm, helm-unittest and Python 3.11 or later. The tests cover rendering with each feature flag, resource selection and rechecks, bounded errors and timeouts, dry-run behavior, and logging in the shared pod PID namespace. +## Moving a LINSTOR cluster to blockstor + +blockstor adopts the volumes of a LINSTOR cluster in place with `linstor-migrate`, following [blockstor's migration runbook](https://github.com/cozystack/blockstor/blob/main/docs/linstor-migration.md). The runbook freezes CSI and stops LINSTOR first, deploys blockstor, applies the converted manifests, waits for adoption, and repoints CSI last. Setting `storage.backend: blockstor` alone does all of that in one step: piraeus-operator goes to external mode, deletes linstor-controller and repoints linstor-csi before a single volume is adopted, and the blockstor controller starts before its manifests are in. + +`storage.blockstorMigration` on the `cozystack.cozystack-platform` Package, passed to this chart as `blockstorMigration`, splits the switch into the runbook's steps. With `hold` or `adopt` every piraeus object renders exactly as under backend `linstor`. `hold` keeps the blockstor controller at zero replicas, and the release owns that count, so a retried upgrade does not start it. linstor-scheduler and linstor-gui stay on LINSTOR through both steps and move to blockstor-apiserver with linstor-csi, when the value is removed: until then blockstor serves no Resources, or Resources it has not adopted, and the scheduler extender cannot place a pod on those. + +piraeus-operator keeps running throughout, as in the runbook. Given LINSTOR's shape it has nothing to change: it applies its Deployments without a replica count, since the `LinstorCluster` sets none, so `linstor-controller` and `linstor-csi-controller` stay at the zero the freeze gave them, and with linstor-controller down its calls to the LINSTOR API fail and are retried. Its validating webhooks keep serving, so the release passes them at every step. + +Run each step below as its own change, never together with a Cozystack upgrade. A platform upgrade can bring a new piraeus-operator or linstor-csi, and the running operator would roll their pods out in the middle of the migration. + +1. Do the runbook's pre-flight checks and write down the replica count of `deploy/linstor-csi-controller`. Freeze: scale `deploy/linstor-csi-controller` and then `deploy/linstor-controller` to 0. Take the dump and convert it now, with nothing left to write to the LINSTOR database, and apply the converted keyring Secret into `cozy-linstor`. +2. Set `storage: {backend: blockstor, acknowledgeBackendChange: blockstor, blockstorMigration: hold}` and wait for the `linstor` HelmRelease to become Ready. blockstor-apiserver and the satellites run, the controller is 0/0, and `ControllerConfig/default` names the passphrase Secret. Nothing of piraeus's own objects changes, and linstor-scheduler still points at linstor-controller. +3. Confirm the keyring's key ID matches the manifests, then apply the converted manifests. +4. Set `blockstorMigration: adopt`. The controller starts; wait for adoption to converge as the runbook describes. +5. Remove `blockstorMigration`. `LinstorCluster` goes to external mode; the operator deletes linstor-controller, repoints linstor-csi at blockstor-apiserver and rolls its satellite pods. linstor-scheduler and linstor-gui are repointed at blockstor-apiserver in the same change. +6. Scale `linstor-csi-controller` back by hand to the count from step 1: the operator repoints it in step 5 but keeps the 0 it found, and nothing in the release sets it. Then run the runbook's verification. + +Up to step 5 the way back touches the control plane only: set `storage: {backend: linstor, acknowledgeBackendChange: linstor}` without `blockstorMigration` in the same change, wait for the release, then scale `linstor-controller` to 1 and `linstor-csi-controller` back to its count from step 1. The blockstor CRDs and their objects stay behind; nothing reads them under `linstor`. + ## Upgrading the blockstor satellites The `blockstor-satellite` DaemonSet replaces its pods one node at a time and holds the rollout on each node for `blockstorSatellite.minReadySeconds` (180 by default) after the new pod turns Ready. Ready only means the satellite's caches have synced, which takes seconds; its first pass, which re-renders and adjusts every DRBD resource on the node, ended 1.5 to 2.7 minutes after Ready on a test cluster with about 110 resources per node. The default covers that, so first passes on two nodes do not overlap; a node with more resources needs a longer pause. `maxUnavailable` is always 1 and `maxSurge` always 0, and the chart refuses other values: a wider rollout would run several first passes at once, and a second satellite on the node would drive the same DRBD resources.