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
This commit is contained in:
Yolanda Robla 2018-06-18 12:57:37 +02:00
parent e210f79500
commit 9687a1efe1
2 changed files with 6 additions and 1 deletions

View File

@ -58,6 +58,11 @@ class FilesystemNode(NodeBase):
if self.label is None: if self.label is None:
self.label = self.name 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 # ensure we don't already have a fs with this label ... they
# all must be unique. # all must be unique.
if 'fs_labels' in self.state: if 'fs_labels' in self.state:

View File

@ -100,7 +100,7 @@ class TestMountOrder(tc.TestGraphGeneration):
mock.call(['mkfs', '-t', 'xfs', '-L', 'mkfs_var', mock.call(['mkfs', '-t', 'xfs', '-L', 'mkfs_var',
'-m', 'uuid=var-uuid-1234', '-m', 'uuid=var-uuid-1234',
'-q', '/dev/loopXp2/var']), '-q', '/dev/loopXp2/var']),
mock.call(['mkfs', '-t', 'vfat', '-n', 'varlog', mock.call(['mkfs', '-t', 'vfat', '-n', 'VARLOG',
'/dev/loopXp3/var_log']) '/dev/loopXp3/var_log'])
] ]
self.assertEqual(mock_exec_sudo_mkfs.call_count, len(cmd_sequence)) self.assertEqual(mock_exec_sudo_mkfs.call_count, len(cmd_sequence))