Skip to content

Commit d71855d

Browse files
committed
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 <walters@verbum.org>
1 parent 3d93701 commit d71855d

12 files changed

+21
-0
lines changed

lib/src/fixtures/spec-only-booted.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ status:
2424
ostree:
2525
checksum: 439f6bd2e2361bee292c1f31840d798c5ac5ba76483b8021dc9f7b0164ac0f48
2626
deploySerial: 0
27+
stateroot: default
2728
rollback: null
2829
rollbackQueued: false
2930
type: bootcHost

lib/src/fixtures/spec-ostree-remote.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,6 @@ status:
2323
ostree:
2424
checksum: 41af286dc0b172ed2f1ca934fd2278de4a1192302ffa07087cea2682e7d372e3
2525
deploySerial: 0
26+
stateroot: default
2627
rollback: null
2728
isContainer: false

lib/src/fixtures/spec-ostree-to-bootc.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ status:
2424
ostree:
2525
checksum: 05cbf6dcae32e7a1c5a0774a648a073a5834a305ca92204b53fb6c281fe49db1
2626
deploySerial: 0
27+
stateroot: default
2728
booted:
2829
image: null
2930
cachedUpdate: null
@@ -33,6 +34,7 @@ status:
3334
ostree:
3435
checksum: f9fa3a553ceaaaf30cf85bfe7eed46a822f7b8fd7e14c1e3389cbc3f6d27f791
3536
deploySerial: 0
37+
stateroot: default
3638
rollback: null
3739
rollbackQueued: false
3840
type: null

lib/src/fixtures/spec-rfe-ostree-deployment.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ status:
1515
ostree:
1616
checksum: 1c24260fdd1be20f72a4a97a75c582834ee3431fbb0fa8e4f482bb219d633a45
1717
deploySerial: 0
18+
stateroot: default
1819
booted:
1920
image: null
2021
cachedUpdate: null
@@ -24,6 +25,7 @@ status:
2425
ostree:
2526
checksum: f9fa3a553ceaaaf30cf85bfe7eed46a822f7b8fd7e14c1e3389cbc3f6d27f791
2627
deploySerial: 0
28+
stateroot: default
2729
rollback: null
2830
rollbackQueued: false
2931
type: null

lib/src/fixtures/spec-staged-booted.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ status:
2424
ostree:
2525
checksum: 3c6dad657109522e0b2e49bf44b5420f16f0b438b5b9357e5132211cfbad135d
2626
deploySerial: 0
27+
stateroot: default
2728
booted:
2829
image:
2930
image:
@@ -39,5 +40,6 @@ status:
3940
ostree:
4041
checksum: 26836632adf6228d64ef07a26fd3efaf177104efd1f341a2cf7909a3e4e2c72c
4142
deploySerial: 0
43+
stateroot: default
4244
rollback: null
4345
isContainer: false

lib/src/fixtures/spec-staged-rollback.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ status:
2323
ostree:
2424
checksum: 3c6dad657109522e0b2e49bf44b5420f16f0b438b5b9357e5132211cfbad135d
2525
deploySerial: 0
26+
stateroot: default
2627
booted: null
2728
rollback:
2829
image:
@@ -39,4 +40,5 @@ status:
3940
ostree:
4041
checksum: 26836632adf6228d64ef07a26fd3efaf177104efd1f341a2cf7909a3e4e2c72c
4142
deploySerial: 0
43+
stateroot: default
4244
isContainer: false

lib/src/fixtures/spec-v1a1-orig.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ status:
2323
ostree:
2424
checksum: 3c6dad657109522e0b2e49bf44b5420f16f0b438b5b9357e5132211cfbad135d
2525
deploySerial: 0
26+
stateroot: default
2627
booted:
2728
image:
2829
image:
@@ -38,5 +39,6 @@ status:
3839
ostree:
3940
checksum: 26836632adf6228d64ef07a26fd3efaf177104efd1f341a2cf7909a3e4e2c72c
4041
deploySerial: 0
42+
stateroot: default
4143
rollback: null
4244
isContainer: false

lib/src/fixtures/spec-v1a1.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,6 @@ status:
2222
ostree:
2323
checksum: 41af286dc0b172ed2f1ca934fd2278de4a1192302ffa07087cea2682e7d372e3
2424
deploySerial: 0
25+
stateroot: default
2526
rollback: null
2627
isContainer: false

lib/src/fixtures/spec-via-local-oci.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ status:
2424
ostree:
2525
checksum: 439f6bd2e2361bee292c1f31840d798c5ac5ba76483b8021dc9f7b0164ac0f48
2626
deploySerial: 0
27+
stateroot: default
2728
rollback: null
2829
rollbackQueued: false
2930
type: bootcHost

lib/src/spec.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,8 @@ pub struct ImageStatus {
156156
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, JsonSchema)]
157157
#[serde(rename_all = "camelCase")]
158158
pub struct BootEntryOstree {
159+
/// The name of the storage for /etc and /var content
160+
pub stateroot: String,
159161
/// The ostree commit checksum
160162
pub checksum: String,
161163
/// The deployment serial

lib/src/status.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ fn boot_entry_from_deployment(
163163
checksum: deployment.csum().into(),
164164
// SAFETY: The deployserial is really unsigned
165165
deploy_serial: deployment.deployserial().try_into().unwrap(),
166+
stateroot: deployment.stateroot().into(),
166167
}),
167168
};
168169
Ok(r)

tmt/tests/booted/readonly/001-test-status.nu

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ assert equal $st.apiVersion org.containers.bootc/v1
1212
let st = bootc status --format=yaml | from yaml
1313
assert equal $st.apiVersion org.containers.bootc/v1
1414
assert ($st.status.booted.image.timestamp != null)
15+
let ostree = $st.status.booted.ostree
16+
if $ostree != null {
17+
assert ($ostree.stateroot != null)
18+
}
1519

1620
let st = bootc status --json --booted | from json
1721
assert equal $st.apiVersion org.containers.bootc/v1

0 commit comments

Comments
 (0)