Fix fuel-agent crashes during ks_spaces validation
fuel-agent validates pm_data.ks_spaces data structure to have a valid
schema, to be non-empty and to have a root partition less than 16T.
If it encounters a volume which does not have an assigned mountpoint
(could be an LVM PV) and at the same time is larger than 16T, it crashes
with a KeyError.
This change avoids a crash by using dict.get which does not throw an
exception in case a key is not present in the dict.
Change-Id: I34971f756d6b17c334dd5f7834af5ca778f2462a
Closes-Bug: 1526845
(cherry picked from commit 96a19bd791
)
This commit is contained in:
parent
337e782048
commit
57d3855758
|
@ -141,7 +141,7 @@ def validate(scheme):
|
|||
|
||||
for space in scheme:
|
||||
for volume in space.get('volumes', []):
|
||||
if volume['size'] > 16777216 and volume['mount'] == '/':
|
||||
if volume['size'] > 16777216 and volume.get('mount') == '/':
|
||||
raise errors.WrongPartitionSchemeError(
|
||||
'Root file system must be less than 16T')
|
||||
|
||||
|
|
Loading…
Reference in New Issue