From d71855d5166a233b8d7990d758a39983ec830951 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Wed, 14 May 2025 18:07:32 -0400 Subject: [PATCH] spec: Add stateroot As we head towards factory reset work, this will be of critical importance. For now this only shows up in the API, not in human readable status. Signed-off-by: Colin Walters --- lib/src/fixtures/spec-only-booted.yaml | 1 + lib/src/fixtures/spec-ostree-remote.yaml | 1 + lib/src/fixtures/spec-ostree-to-bootc.yaml | 2 ++ lib/src/fixtures/spec-rfe-ostree-deployment.yaml | 2 ++ lib/src/fixtures/spec-staged-booted.yaml | 2 ++ lib/src/fixtures/spec-staged-rollback.yaml | 2 ++ lib/src/fixtures/spec-v1a1-orig.yaml | 2 ++ lib/src/fixtures/spec-v1a1.yaml | 1 + lib/src/fixtures/spec-via-local-oci.yaml | 1 + lib/src/spec.rs | 2 ++ lib/src/status.rs | 1 + tmt/tests/booted/readonly/001-test-status.nu | 4 ++++ 12 files changed, 21 insertions(+) diff --git a/lib/src/fixtures/spec-only-booted.yaml b/lib/src/fixtures/spec-only-booted.yaml index 7c28274fb..2adbf5e91 100644 --- a/lib/src/fixtures/spec-only-booted.yaml +++ b/lib/src/fixtures/spec-only-booted.yaml @@ -24,6 +24,7 @@ status: ostree: checksum: 439f6bd2e2361bee292c1f31840d798c5ac5ba76483b8021dc9f7b0164ac0f48 deploySerial: 0 + stateroot: default rollback: null rollbackQueued: false type: bootcHost \ No newline at end of file diff --git a/lib/src/fixtures/spec-ostree-remote.yaml b/lib/src/fixtures/spec-ostree-remote.yaml index fa47c16fd..2a9770de9 100644 --- a/lib/src/fixtures/spec-ostree-remote.yaml +++ b/lib/src/fixtures/spec-ostree-remote.yaml @@ -23,5 +23,6 @@ status: ostree: checksum: 41af286dc0b172ed2f1ca934fd2278de4a1192302ffa07087cea2682e7d372e3 deploySerial: 0 + stateroot: default rollback: null isContainer: false diff --git a/lib/src/fixtures/spec-ostree-to-bootc.yaml b/lib/src/fixtures/spec-ostree-to-bootc.yaml index cf250c2d8..8adcd6c94 100644 --- a/lib/src/fixtures/spec-ostree-to-bootc.yaml +++ b/lib/src/fixtures/spec-ostree-to-bootc.yaml @@ -24,6 +24,7 @@ status: ostree: checksum: 05cbf6dcae32e7a1c5a0774a648a073a5834a305ca92204b53fb6c281fe49db1 deploySerial: 0 + stateroot: default booted: image: null cachedUpdate: null @@ -33,6 +34,7 @@ status: ostree: checksum: f9fa3a553ceaaaf30cf85bfe7eed46a822f7b8fd7e14c1e3389cbc3f6d27f791 deploySerial: 0 + stateroot: default rollback: null rollbackQueued: false type: null diff --git a/lib/src/fixtures/spec-rfe-ostree-deployment.yaml b/lib/src/fixtures/spec-rfe-ostree-deployment.yaml index f7557826d..c38ac5e72 100644 --- a/lib/src/fixtures/spec-rfe-ostree-deployment.yaml +++ b/lib/src/fixtures/spec-rfe-ostree-deployment.yaml @@ -15,6 +15,7 @@ status: ostree: checksum: 1c24260fdd1be20f72a4a97a75c582834ee3431fbb0fa8e4f482bb219d633a45 deploySerial: 0 + stateroot: default booted: image: null cachedUpdate: null @@ -24,6 +25,7 @@ status: ostree: checksum: f9fa3a553ceaaaf30cf85bfe7eed46a822f7b8fd7e14c1e3389cbc3f6d27f791 deploySerial: 0 + stateroot: default rollback: null rollbackQueued: false type: null diff --git a/lib/src/fixtures/spec-staged-booted.yaml b/lib/src/fixtures/spec-staged-booted.yaml index 1fde37653..c85fb1b93 100644 --- a/lib/src/fixtures/spec-staged-booted.yaml +++ b/lib/src/fixtures/spec-staged-booted.yaml @@ -24,6 +24,7 @@ status: ostree: checksum: 3c6dad657109522e0b2e49bf44b5420f16f0b438b5b9357e5132211cfbad135d deploySerial: 0 + stateroot: default booted: image: image: @@ -39,5 +40,6 @@ status: ostree: checksum: 26836632adf6228d64ef07a26fd3efaf177104efd1f341a2cf7909a3e4e2c72c deploySerial: 0 + stateroot: default rollback: null isContainer: false diff --git a/lib/src/fixtures/spec-staged-rollback.yaml b/lib/src/fixtures/spec-staged-rollback.yaml index efc20d3d7..9b53d61fa 100644 --- a/lib/src/fixtures/spec-staged-rollback.yaml +++ b/lib/src/fixtures/spec-staged-rollback.yaml @@ -23,6 +23,7 @@ status: ostree: checksum: 3c6dad657109522e0b2e49bf44b5420f16f0b438b5b9357e5132211cfbad135d deploySerial: 0 + stateroot: default booted: null rollback: image: @@ -39,4 +40,5 @@ status: ostree: checksum: 26836632adf6228d64ef07a26fd3efaf177104efd1f341a2cf7909a3e4e2c72c deploySerial: 0 + stateroot: default isContainer: false diff --git a/lib/src/fixtures/spec-v1a1-orig.yaml b/lib/src/fixtures/spec-v1a1-orig.yaml index 568d02dfb..3419dd344 100644 --- a/lib/src/fixtures/spec-v1a1-orig.yaml +++ b/lib/src/fixtures/spec-v1a1-orig.yaml @@ -23,6 +23,7 @@ status: ostree: checksum: 3c6dad657109522e0b2e49bf44b5420f16f0b438b5b9357e5132211cfbad135d deploySerial: 0 + stateroot: default booted: image: image: @@ -38,5 +39,6 @@ status: ostree: checksum: 26836632adf6228d64ef07a26fd3efaf177104efd1f341a2cf7909a3e4e2c72c deploySerial: 0 + stateroot: default rollback: null isContainer: false diff --git a/lib/src/fixtures/spec-v1a1.yaml b/lib/src/fixtures/spec-v1a1.yaml index 125c95694..e98da73f4 100644 --- a/lib/src/fixtures/spec-v1a1.yaml +++ b/lib/src/fixtures/spec-v1a1.yaml @@ -22,5 +22,6 @@ status: ostree: checksum: 41af286dc0b172ed2f1ca934fd2278de4a1192302ffa07087cea2682e7d372e3 deploySerial: 0 + stateroot: default rollback: null isContainer: false diff --git a/lib/src/fixtures/spec-via-local-oci.yaml b/lib/src/fixtures/spec-via-local-oci.yaml index 44de7c7a5..65b076925 100644 --- a/lib/src/fixtures/spec-via-local-oci.yaml +++ b/lib/src/fixtures/spec-via-local-oci.yaml @@ -24,6 +24,7 @@ status: ostree: checksum: 439f6bd2e2361bee292c1f31840d798c5ac5ba76483b8021dc9f7b0164ac0f48 deploySerial: 0 + stateroot: default rollback: null rollbackQueued: false type: bootcHost \ No newline at end of file diff --git a/lib/src/spec.rs b/lib/src/spec.rs index 90d2e3975..69efe328b 100644 --- a/lib/src/spec.rs +++ b/lib/src/spec.rs @@ -156,6 +156,8 @@ pub struct ImageStatus { #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, JsonSchema)] #[serde(rename_all = "camelCase")] pub struct BootEntryOstree { + /// The name of the storage for /etc and /var content + pub stateroot: String, /// The ostree commit checksum pub checksum: String, /// The deployment serial diff --git a/lib/src/status.rs b/lib/src/status.rs index aa75b047a..9823e90b6 100644 --- a/lib/src/status.rs +++ b/lib/src/status.rs @@ -163,6 +163,7 @@ fn boot_entry_from_deployment( checksum: deployment.csum().into(), // SAFETY: The deployserial is really unsigned deploy_serial: deployment.deployserial().try_into().unwrap(), + stateroot: deployment.stateroot().into(), }), }; Ok(r) diff --git a/tmt/tests/booted/readonly/001-test-status.nu b/tmt/tests/booted/readonly/001-test-status.nu index 727b8a6f7..5bc680518 100644 --- a/tmt/tests/booted/readonly/001-test-status.nu +++ b/tmt/tests/booted/readonly/001-test-status.nu @@ -12,6 +12,10 @@ assert equal $st.apiVersion org.containers.bootc/v1 let st = bootc status --format=yaml | from yaml assert equal $st.apiVersion org.containers.bootc/v1 assert ($st.status.booted.image.timestamp != null) +let ostree = $st.status.booted.ostree +if $ostree != null { + assert ($ostree.stateroot != null) +} let st = bootc status --json --booted | from json assert equal $st.apiVersion org.containers.bootc/v1