Skip to content

Commit d26f40a

Browse files
blockdev: add support for dm-integrity's new UUID naming scheme
Cryptsetup commit 12eb040 ("Create dm-integrity with CRYPT_SUBDEV prefix.") changed UUID naming scheme for integrity-protected devices: ``` $ dmsetup info --columns --noheadings -o UUID /dev/dm-2 CRYPT-SUBDEV-ef0561fda2cf4f8eb9fd729f4cd3e0c7-root_dif ``` Before crytsetup-2.8.0: ``` $ dmsetup info --columns --noheadings -o UUID /dev/dm-2 CRYPT-INTEGRITY-bec07f15a1c540b0833fcccd6ac2459d-root_dif ``` This PR updates `is_luks_integrity()` to recognize both schemes. https://gitlab.com/cryptsetup/cryptsetup/-/commit/12eb04094304467232348e99df0fbf95074d35b3
1 parent ceb250d commit d26f40a

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

docs/release-notes.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Minor changes:
1515
Internal changes:
1616

1717
- Add initial TMT tests and a new workflow to execute tests on PRs
18+
- Support cryptsetup-2.8.0's UUIDs naming of dm-inegrtity devices
1819

1920
Packaging changes:
2021

src/blockdev.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ impl Disk {
198198
if !self.is_dm_device() {
199199
return Ok(false);
200200
}
201-
Ok(runcmd_output!(
201+
let dminfo = runcmd_output!(
202202
"dmsetup",
203203
"info",
204204
"--columns",
@@ -207,9 +207,11 @@ impl Disk {
207207
"uuid",
208208
&self.path
209209
)
210-
.with_context(|| format!("checking if device {} is type LUKS integrity", self.path))?
211-
.trim()
212-
.starts_with("CRYPT-INTEGRITY-"))
210+
.with_context(|| format!("checking if device {} is type LUKS integrity", self.path))?;
211+
212+
let uuid = dminfo.trim();
213+
// since cryptsetup-2.8.0 SUBDEV is used
214+
Ok(uuid.starts_with("CRYPT-INTEGRITY-") || uuid.starts_with("CRYPT-SUBDEV-"))
213215
}
214216
}
215217

0 commit comments

Comments
 (0)