Merge ~jocave/checkbox-support:fs-usage-vs-type into checkbox-support:master

Proposed by Jonathan Cave
Status: Merged
Approved by: Jonathan Cave
Approved revision: 998802db996233e0de00c421fb0e1257a4a7a75c
Merged at revision: 630dfb3a6e2d4e2f4315c06b3984d790fcfe1b97
Proposed branch: ~jocave/checkbox-support:fs-usage-vs-type
Merge into: checkbox-support:master
Diff against target: 37 lines (+6/-6)
1 file modified
checkbox_support/parsers/udevadm.py (+6/-6)
Reviewer Review Type Date Requested Status
Sylvain Pineau (community) Approve
Review via email: mp+369585@code.launchpad.net

Description of the change

When checking devmapper devices, switch to using the ID_FS_TYPE key and ensure that a filesystem is hosted rather than just eliminating swap partitions. This has the benefit that crypt partitions are also eliminated.

All the tests still pass so there should be no change for existing devices. Tested that works as expected on beta releases of FDE IoT systems (new tests could be added when final partition layout is confirmed).

To post a comment you must log in.
Revision history for this message
Sylvain Pineau (sylvain-pineau) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/checkbox_support/parsers/udevadm.py b/checkbox_support/parsers/udevadm.py
index ded5cc7..99486f7 100644
--- a/checkbox_support/parsers/udevadm.py
+++ b/checkbox_support/parsers/udevadm.py
@@ -481,8 +481,8 @@ class UdevadmDevice(object):
481 # we need to report.481 # we need to report.
482 return "DISK"482 return "DISK"
483 if '/dev/mapper' in self._environment.get('DEVLINKS', ''):483 if '/dev/mapper' in self._environment.get('DEVLINKS', ''):
484 if "ID_FS_TYPE" in self._environment:484 if "ID_FS_USAGE" in self._environment:
485 if self._environment["ID_FS_TYPE"] != 'swap':485 if self._environment["ID_FS_USAGE"] == 'filesystem':
486 return "DISK"486 return "DISK"
487 else:487 else:
488 return "DISK"488 return "DISK"
@@ -1059,8 +1059,8 @@ class UdevadmParser(object):
10591059
1060 # Keep /dev/mapper devices (non swap)1060 # Keep /dev/mapper devices (non swap)
1061 if '/dev/mapper' in device._environment.get('DEVLINKS', ''):1061 if '/dev/mapper' in device._environment.get('DEVLINKS', ''):
1062 if "ID_FS_TYPE" in device._environment:1062 if "ID_FS_USAGE" in device._environment:
1063 if device._environment["ID_FS_TYPE"] == 'swap':1063 if device._environment["ID_FS_USAGE"] != 'filesystem':
1064 return True1064 return True
1065 return False1065 return False
10661066
@@ -1233,8 +1233,8 @@ class UdevadmParser(object):
1233 for d in self.devices.values():1233 for d in self.devices.values():
1234 if d.category == 'DISK':1234 if d.category == 'DISK':
1235 if '/dev/mapper' in d._environment.get('DEVLINKS', ''):1235 if '/dev/mapper' in d._environment.get('DEVLINKS', ''):
1236 if "ID_FS_TYPE" in d._environment:1236 if "ID_FS_USAGE" in d._environment:
1237 if d._environment["ID_FS_TYPE"] != 'swap':1237 if d._environment["ID_FS_USAGE"] == 'filesystem':
1238 dev_mapper_devices.append(d)1238 dev_mapper_devices.append(d)
1239 else:1239 else:
1240 dev_mapper_devices.append(d)1240 dev_mapper_devices.append(d)

Subscribers

People subscribed via source and target branches