diff --git a/packages/system/linstor/definitions/blockstor.org_nodes.yaml b/packages/system/linstor/definitions/blockstor.org_nodes.yaml index 839c05931..fd3b6357c 100644 --- a/packages/system/linstor/definitions/blockstor.org_nodes.yaml +++ b/packages/system/linstor/definitions/blockstor.org_nodes.yaml @@ -255,6 +255,14 @@ spec: satellite recently?" signal. format: date-time type: string + satelliteIncarnation: + description: |- + satelliteIncarnation identifies the satellite process now running + on this node; every satellite start picks a new one. A Resource + whose status.satelliteIncarnation differs was last reported by an + earlier process, so its state predates the restart and is not + shown. Written by the satellite heartbeat; do not hand-set. + type: string type: object required: - spec diff --git a/packages/system/linstor/definitions/blockstor.org_resourcedefinitions.yaml b/packages/system/linstor/definitions/blockstor.org_resourcedefinitions.yaml index b301767f7..f932e1ad5 100644 --- a/packages/system/linstor/definitions/blockstor.org_resourcedefinitions.yaml +++ b/packages/system/linstor/definitions/blockstor.org_resourcedefinitions.yaml @@ -251,10 +251,21 @@ spec: properties: passphraseSecretRef: description: |- - passphraseSecretRef references the Secret carrying the LUKS - passphrase under the key `passphrase`. The satellite reads it - via the apiserver during reconcile; the passphrase never lands - on Spec in plaintext. + passphraseSecretRef names a Secret carrying a LUKS passphrase + under the key `passphrase`. + + NOT IMPLEMENTED: setting this does NOT encrypt the volume with + the referenced Secret. A resource definition that sets it gets + per-replica passwords wrapped under the CLUSTER master key, like + every other one, and the referenced Secret opens nothing. + + The field is kept, rather than removed, because it is reserved + as the selector of a non-default key (docs/encryption-keys.md, + stage 2) and removing it would prune the reference out of stored + objects. + While it does nothing, a LUKS-layered resource definition that + sets it gets an `EncryptionKeyIgnored` Condition on each of its + Resources saying so. properties: name: default: "" @@ -350,6 +361,30 @@ spec: items: type: string type: array + peerSlots: + description: |- + peerSlots is the DRBD peer-slot count new replicas of this + definition get, LINSTOR's DrbdRscDfnData.peerSlots. A replica + keeps one bitmap per slot and a peer with a disk takes one, so a + definition holds one replica with a disk more than its slots. + + Resolved once when the definition is created, as LINSTOR resolves + it when the definition's DRBD layer is created: the count the + request names, else the group's peerSlots, else the + PeerSlotsNewResource property of the definition, its group or the + controller, else 7. `rd modify --peer-slots` changes it for + replicas created afterwards. + + Unset means a definition created before blockstor recorded a + count: by blockstor, whose replicas have 15, or by LINSTOR before + an older linstor-migrate adopted it, whose replicas have + LINSTOR's count. The controller records the least count the + superblocks of its replicas with a disk hold once all of them + have told it; until then it is read as 15. + format: int32 + maximum: 31 + minimum: 1 + type: integer props: additionalProperties: type: string @@ -381,6 +416,16 @@ spec: description: ResourceDefinitionVolume is one volume slot inside an RD. properties: + deleteID: + description: |- + deleteID tells this delete of the volume apart from an earlier one of + a volume with the same number. It is written together with the + DELETE flag, and a replica's confirmation in Status.DeletedVolumes + counts only when it carries the same value: a confirmation left over + from the earlier volume must not stand for this one, whose storage + would then never be deleted. + maxLength: 64 + type: string drbdMinor: description: |- drbdMinor is the /dev/drbd device minor for THIS volume, @@ -414,8 +459,13 @@ spec: format: int32 type: integer flags: + description: |- + flags carries LINSTOR's volume definition flags; DELETE is the one + blockstor acts on, see VolumeDefinitionFlagDelete. items: + maxLength: 64 type: string + maxItems: 16 type: array props: additionalProperties: @@ -469,6 +519,11 @@ spec: - sizeKib - volumeNumber type: object + x-kubernetes-validations: + - message: 'the DELETE flag of a volume definition is never cleared: + a replica may already have deleted its volume' + rule: '!has(oldSelf.flags) || !(''DELETE'' in oldSelf.flags) || + (has(self.flags) && ''DELETE'' in self.flags)' type: array x-kubernetes-list-map-keys: - volumeNumber diff --git a/packages/system/linstor/definitions/blockstor.org_resources.yaml b/packages/system/linstor/definitions/blockstor.org_resources.yaml index 8cb1a6737..b72065ef3 100644 --- a/packages/system/linstor/definitions/blockstor.org_resources.yaml +++ b/packages/system/linstor/definitions/blockstor.org_resources.yaml @@ -85,7 +85,7 @@ spec: drbdNodeID is the DRBD-9 node-id assigned to this replica. Per-replica, allocated once and stable for the replica's life — re-numbering a live replica re-maps its DRBD bitmaps and - corrupts peer-to-peer resync. Range 0..15 (drbd-9 max-peers). + corrupts peer-to-peer resync. Range 0..31 (DRBD 9 node ids). clusterIP-style allocation: nil means "controller, allocate"; non-nil is authoritative and NEVER overwritten (restore-safe). @@ -314,6 +314,29 @@ spec: nodeName: description: nodeName is the satellite hosting this replica. type: string + peerSlots: + description: |- + peerSlots is the DRBD peer-slot count this replica's metadata is + created with (`create-md --max-peers`) and its lower disk is sized + for. The controller copies it from the definition when it + allocates the replica's identities, as LINSTOR copies the + definition's count to each replica it creates, so changing the + definition's count later leaves the replicas already there alone. + + Unset means a replica created before blockstor recorded a count: + by blockstor with 15, or by LINSTOR, whose count only the + superblock tells (status.metadataPeerSlots). The controller + records it from there. Settable once: the metadata on disk does + not change with it. + format: int32 + maximum: 31 + minimum: 1 + type: integer + x-kubernetes-validations: + - message: 'peerSlots is settable-once: the replica''s metadata was + created with it' + optionalOldSelf: true + rule: '!oldSelf.hasValue() || self == oldSelf.value()' props: additionalProperties: type: string @@ -479,6 +502,45 @@ spec: status: description: status defines the observed state of Resource properties: + applyFailure: + description: |- + applyFailure is the error of the satellite's last apply pass on + this replica, with the volume sizes that pass was applying. The + satellite sets it when a pass fails and removes it when one + succeeds. A resize that waits for this replica to grow ends with + this error instead of waiting for a pass that keeps failing, as + LINSTOR returns its satellite's error. + properties: + message: + description: message is the error the pass failed with. + type: string + volumes: + description: |- + volumes lists the definition size of each volume the failed pass + was applying. + items: + description: ResourceApplyFailureVolume is the size one volume + had in a failed pass. + properties: + sizeKib: + description: sizeKib is the volume definition size the pass + was applying. + format: int64 + type: integer + volumeNumber: + description: volumeNumber is the volume's number in the + definition. + format: int32 + type: integer + required: + - sizeKib + - volumeNumber + type: object + type: array + required: + - message + type: object + x-kubernetes-map-type: atomic conditions: description: conditions represent the current state of the Resource. items: @@ -609,6 +671,16 @@ spec: parse this token out of `drbdsetup status --verbose`; the field gives them a kubectl-native substitute. properties: + done: + description: |- + done is the progress of the resync running with this peer, as + the `done:` token of the peer-device frame carries it + ("50.31"). DRBD measures it against that resync's own total, + not the volume size, and prints it only while a resync with + this peer runs; empty otherwise. It is what LINSTOR reports as + the peer's `done_percentage` and renders in `SyncTarget(NN%)`. + A string because a CRD has no portable float type. + type: string peerDiskState: description: |- peerDiskState is the peer's DRBD-9 disk_state for this volume @@ -618,6 +690,17 @@ spec: `peer-disk:` token in `drbdsetup events2 --statistics` peer-device frames. type: string + replicationState: + description: |- + replicationState is this volume's DRBD-9 replication state with + this peer, the `replication:` token of the volume's own + peer-device frame. DRBD keeps it per peer and per volume, and + so does LINSTOR (DrbdVolume.volReplState); the connection-level + `replicationState` is whichever volume's frame came last. It is + what `done` belongs to: a two-volume resource can have one + volume in SyncTarget and the other Established or PausedSyncT + on the same connection. + type: string volumeNumber: description: |- volumeNumber is the DRBD-9 volume number this peer-view entry @@ -648,6 +731,39 @@ spec: x-kubernetes-list-map-keys: - peerNodeName x-kubernetes-list-type: map + deletedVolumes: + description: |- + deletedVolumes is this replica's confirmation of volume definition + deletes: the satellite lists a volume here once it has removed the + volume from DRBD and deleted its storage, because its volume + definition is flagged DELETE. The controller removes the volume + definition once every replica of the definition lists it with the + same deleteID. The satellite drops an entry once its volume + definition is gone. Empty on a satellite that predates volume + definition deletes, which therefore holds the definition until it is + upgraded rather than having its volume skipped. + items: + description: |- + DeletedVolumeStatus is one replica's confirmation that it deleted the + volume of a volume definition flagged DELETE. + properties: + deleteID: + description: |- + deleteID is the deleteID of the volume definition the satellite + acted on. + maxLength: 64 + type: string + volumeNumber: + description: volumeNumber is the deleted volume's number. + format: int32 + type: integer + required: + - volumeNumber + type: object + type: array + x-kubernetes-list-map-keys: + - volumeNumber + x-kubernetes-list-type: map drbdMinor: description: |- drbdMinor is a read-only mirror of the volume-0 minor now @@ -687,6 +803,35 @@ spec: description: inUse is whether DRBD reports the resource as primary anywhere. type: boolean + mayPromote: + description: |- + mayPromote is the kernel-reported DRBD-9 `may_promote:` flag + from the same frames, published upstream as + `layer_object.drbd.may_promote`. Unset until observed. + type: boolean + metadataPeerSlots: + description: |- + metadataPeerSlots is the peer-slot count the replica's DRBD + metadata holds, read once from its superblock by the satellite. + A grow sizes the metadata for it, so the device stays at the + definition. A replica created before blockstor recorded counts, + by blockstor with 15 or by LINSTOR with its definition's count, + 7 by default, when it was adopted, gets it as spec.peerSlots + from the controller, never a guess. + format: int32 + maximum: 31 + minimum: 1 + type: integer + promotionScore: + description: |- + promotionScore is the kernel-reported DRBD-9 promotion score of + this replica, parsed from the `promotion_score:` token in + `drbdsetup events2` resource frames. Upstream LINSTOR publishes + it as `layer_object.drbd.promotion_score`, and linstor-csi + reports a volume abnormal on every node whose score is 0 or + missing. Unset until the satellite has observed the resource. + format: int32 + type: integer role: description: |- role is the kernel-reported DRBD-9 role on this node, parsed @@ -699,6 +844,12 @@ spec: ~15 e2e tests `grep role:` from `drbdsetup status`; surfacing it on Status lets them switch to a k8s-native read. type: string + satelliteIncarnation: + description: |- + satelliteIncarnation is the node's status.satelliteIncarnation of + the satellite process that wrote the runtime state above. Written + by the satellite observer with that state; do not hand-set. + type: string suspended: description: |- suspended is the kernel-reported reason for I/O suspension on @@ -741,6 +892,23 @@ spec: allocatedKib: format: int64 type: integer + appliedSizeKib: + description: |- + appliedSizeKib is the volume definition size this replica has + finished applying: the satellite writes it after a pass in which + every layer, the backing volume, LUKS and `drbdadm resize`, + succeeded at that size and the device the consumer sees reads at + least that size. A grow is complete once every diskful replica + reports the new size here. The last replica to grow its + backing runs its `drbdadm resize` after all the others have + grown theirs, and DRBD commits a resize on every connected peer + before the command returns, so at that point the device has the + new size wherever it is attached. The REST API answers a resize + only then, as LINSTOR does, and the satellite reruns + `drbdadm resize` while this lags the definition. Unset until + the first such pass. + format: int64 + type: integer currentGI: description: |- currentGi is the DRBD-9 current generation identifier reported @@ -753,6 +921,18 @@ spec: type: string devicePath: type: string + deviceSizeKib: + description: |- + deviceSizeKib is the size of this replica's DRBD device in KiB, + the `size:` token of `drbdsetup events2 --statistics --full` + device frames. A diskless replica reports the size its peers + agreed on. The controller hands the largest size any replica + reports to a replica that is getting a new lower disk, which + must hold at least that much: the kernel refuses to attach a + disk smaller than the device, and a volume adopted from LINSTOR + can be a few KiB larger than its definition. + format: int64 + type: integer diskState: type: string historyGI: @@ -766,16 +946,16 @@ spec: type: array outOfSyncKib: description: |- - outOfSyncKib is the worst-case "how many KiB this volume is - behind any peer" reported by `drbdsetup events2 --statistics` - peer-device frames. Combined with RD.Spec.VolumeDefinitions - SizeKib, callers compute a sync-progress percentage: - progress = (1 - outOfSyncKib / sizeKib) * 100 + outOfSyncKib is the largest out-of-sync count over this + volume's peers, as `drbdsetup events2 --statistics` peer-device + frames report it. 0 means in sync with every peer. It is not a + resync progress once the replica has more than one peer: the + progress is connections[].peerVolumes[].done. - 0 means fully in sync; sizeKib (or close to it) means fresh - resync hasn't started yet. Surfaced via the REST view layer - so `linstor r l` / piraeus dashboards can render a CDI-style - progress bar without polling drbdsetup themselves. + While the volume is UpToDate and no peer resyncs with this + replica, a change that keeps the count non-zero can reach the + status up to 5 minutes late. A change to or from 0, and any + change during a resync, is written at once. format: int64 type: integer quorum: diff --git a/packages/system/linstor/definitions/blockstor.org_snapshots.yaml b/packages/system/linstor/definitions/blockstor.org_snapshots.yaml index f7f1f0cbd..c34d4383c 100644 --- a/packages/system/linstor/definitions/blockstor.org_snapshots.yaml +++ b/packages/system/linstor/definitions/blockstor.org_snapshots.yaml @@ -63,6 +63,16 @@ spec: spec: description: spec defines the desired state of Snapshot properties: + abortReason: + description: |- + abortReason, once set, records that the controller aborted the + take, and why. It is written in the same update that clears + suspendIO and takeSnapshot, so the abort is on record before any + satellite resumes and holds even if the status write that + follows never lands. An aborted take is over: suspendIO is never + set again and the snapshot is never marked SUCCESSFUL, as LINSTOR + keeps an aborted snapshot definition failed for good. + type: string groupID: description: |- groupID, when non-empty, marks this Snapshot as a member of a @@ -234,6 +244,20 @@ spec: items: description: SnapshotVolumeRef is one volume slot inside a Snapshot. properties: + props: + additionalProperties: + type: string + description: |- + props is the volume definition's property map as it was when the + snapshot was taken, which a restore copies onto the volume it + creates, as LINSTOR does. The block size LINSTOR keeps there is + the one the snapshot's data was written at. A snapshot recorded + before this field existed has none, and its volume definition's + current props stand in. Serialised without omitempty so a volume + definition that had no props is recorded as {} and stays told + apart from a snapshot that recorded nothing. + nullable: true + type: object sizeKib: format: int64 type: integer @@ -316,11 +340,36 @@ spec: x-kubernetes-list-map-keys: - type x-kubernetes-list-type: map + deleteFailures: + description: |- + deleteFailures records, per node, why the satellite's last + attempt to delete its copy of a deleting snapshot failed. The + delete call answers with it at once, as LINSTOR answers with the + error its satellite returned, instead of waiting on a node that + is alive but keeps failing. + items: + description: |- + SnapshotDeleteFailure is the error one satellite hit deleting its + copy of the snapshot. + properties: + message: + type: string + nodeName: + type: string + required: + - message + - nodeName + type: object + type: array + x-kubernetes-list-map-keys: + - nodeName + x-kubernetes-list-type: map flags: description: |- - flags carries terminal-state markers. Currently only - "FAILED" is meaningful — stamped by the satellite when - CreateSnapshot returns a non-retryable error class. + flags carries terminal-state markers: "SUCCESSFUL" once the + take completed on every targeted node, "FAILED" when a + satellite's CreateSnapshot returned a non-retryable error, and + "FAILED_DISCONNECT" when the controller aborted a take that hung. items: type: string type: array @@ -349,6 +398,14 @@ spec: type: string ready: type: boolean + storagePool: + description: |- + storagePool is the pool that holds this node's copy: the pool of + the replica it was taken from. The local satellite records it once + its copy exists, because the copy outlives the replica and a + restore has to be placed in the same pool, the way LINSTOR keeps + the pool on each snapshot volume. + type: string suspendIOAcked: description: |- suspendIOAcked is stamped true by the local satellite once diff --git a/packages/system/linstor/tests/backend_test.yaml b/packages/system/linstor/tests/backend_test.yaml index 0377aa544..24e45ddfd 100644 --- a/packages/system/linstor/tests/backend_test.yaml +++ b/packages/system/linstor/tests/backend_test.yaml @@ -167,7 +167,7 @@ tests: - templates/backend-guard.yaml set: backend: blockstor - blockstorController.image.tag: 0.3.0@sha256:1111111111111111111111111111111111111111111111111111111111111111 + blockstorController.image.tag: 0.4.0@sha256:1111111111111111111111111111111111111111111111111111111111111111 asserts: - hasDocuments: count: 0 diff --git a/packages/system/linstor/values.yaml b/packages/system/linstor/values.yaml index 55b2a9fa0..9a4d94d37 100644 --- a/packages/system/linstor/values.yaml +++ b/packages/system/linstor/values.yaml @@ -35,21 +35,21 @@ piraeusServer: blockstorController: image: repository: ghcr.io/cozystack/blockstor-controller - tag: 0.3.0@sha256:ca5fc964265a1fd9e1153077f0565a9f07532c593bea1182d3b97a38430822ea + tag: 0.4.0@sha256:b7526472c26475abba333b2f6d3a6a2b5c51b90ef878752490c8de85a0799075 resources: requests: {cpu: 100m, memory: 64Mi} limits: {memory: 256Mi} blockstorApiserver: image: repository: ghcr.io/cozystack/blockstor-apiserver - tag: 0.3.0@sha256:20cf599f8d0ae85a44b237b9d8ad2ca631a1feff3fd387194ef84636b538dd0b + tag: 0.4.0@sha256:7b869c114cee4fea9092be03758749df2e19096d99791336f0ee94d5d3de16d0 resources: requests: {cpu: 50m, memory: 128Mi} limits: {memory: 512Mi} blockstorSatellite: image: repository: ghcr.io/cozystack/blockstor-satellite - tag: 0.3.0@sha256:abff381da5425fdf7a6abc0d52006727cf7fe13c438acc79aaea192fc8681cb4 + tag: 0.4.0@sha256:36670bf2e50a845bcb40dc3f2dd2fb64f4fe6e3671a07865a423a169b3da190e # The LINSTOR satellite's requests and memory limit. resources: requests: {cpu: 100m, memory: 128Mi}