From 9687a1efe1c98ca4562bd0365ef228420c1aa4e5 Mon Sep 17 00:00:00 2001 From: Yolanda Robla Date: Mon, 18 Jun 2018 12:57:37 +0200 Subject: [PATCH] Convert labels to upper case When booting on UEFI, there was an issue mounting the vfat filesystem. It was caused because the mount was defined in /etc/fstab in lowercase, but the disk had it labeled in upper case, and system could not find it. Conver the label to upper case in case of fat/vfat. Change-Id: Id3dee735e6f8fb221d199c4aba648f3e9a6e4206 --- diskimage_builder/block_device/level2/mkfs.py | 5 +++++ diskimage_builder/block_device/tests/test_mount_order.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/diskimage_builder/block_device/level2/mkfs.py b/diskimage_builder/block_device/level2/mkfs.py index d213b0c9..1f623406 100644 --- a/diskimage_builder/block_device/level2/mkfs.py +++ b/diskimage_builder/block_device/level2/mkfs.py @@ -58,6 +58,11 @@ class FilesystemNode(NodeBase): if self.label is None: self.label = self.name + # for fat/vfat, we use the label as an identifier for the disk + # so we need that the label is converted to upper case + if self.type in ('vfat', 'fat'): + self.label = self.label.upper() + # ensure we don't already have a fs with this label ... they # all must be unique. if 'fs_labels' in self.state: diff --git a/diskimage_builder/block_device/tests/test_mount_order.py b/diskimage_builder/block_device/tests/test_mount_order.py index 65a09ce8..097ae7d4 100644 --- a/diskimage_builder/block_device/tests/test_mount_order.py +++ b/diskimage_builder/block_device/tests/test_mount_order.py @@ -100,7 +100,7 @@ class TestMountOrder(tc.TestGraphGeneration): mock.call(['mkfs', '-t', 'xfs', '-L', 'mkfs_var', '-m', 'uuid=var-uuid-1234', '-q', '/dev/loopXp2/var']), - mock.call(['mkfs', '-t', 'vfat', '-n', 'varlog', + mock.call(['mkfs', '-t', 'vfat', '-n', 'VARLOG', '/dev/loopXp3/var_log']) ] self.assertEqual(mock_exec_sudo_mkfs.call_count, len(cmd_sequence))