Ignore /dev/ramX devices for any purposes

While most modern Linux distributions do not create RAM disks, newer
TinyCoreLinux actually does. Ignore them since we don't want to deploy
to RAM.

Change-Id: Ia810c7fb47f7098b8173d765ff9c33b48a223ff1
This commit is contained in:
Dmitry Tantsur 2019-08-12 09:22:52 +02:00
parent ef831847e6
commit 3d5fc82ece
2 changed files with 10 additions and 5 deletions

View File

@ -316,10 +316,11 @@ def list_all_block_devices(block_type='disk',
raise errors.BlockDeviceError(
'%s must be returned by lsblk.' % ', '.join(sorted(missing)))
# NOTE(dtantsur): zRAM devices can appear in the output of lsblk, but
# we cannot do anything useful with them.
if device['KNAME'].startswith('zram'):
LOG.debug('Skipping zRAM device %s', device)
# NOTE(dtantsur): RAM disks and zRAM devices appear in the output of
# lsblk as disks, but we cannot do anything useful with them.
if (device['KNAME'].startswith('ram')
or device['KNAME'].startswith('zram')):
LOG.debug('Skipping RAM device %s', device)
continue
name = os.path.join('/dev', device['KNAME'])

View File

@ -138,7 +138,11 @@ BLK_DEVICE_TEMPLATE = (
'KNAME="sdd" MODEL="NWD-BLP4-1600 " SIZE="1765517033472" '
' ROTA="0" TYPE="disk"\n'
'KNAME="loop0" MODEL="" SIZE="109109248" ROTA="1" TYPE="loop"\n'
'KNAME="zram0" MODEL="" SIZE="" ROTA="0" TYPE="disk"'
'KNAME="zram0" MODEL="" SIZE="" ROTA="0" TYPE="disk"\n'
'KNAME="ram0" MODEL="" SIZE="8388608" ROTA="0" TYPE="disk"\n'
'KNAME="ram1" MODEL="" SIZE="8388608" ROTA="0" TYPE="disk"\n'
'KNAME="ram2" MODEL="" SIZE="8388608" ROTA="0" TYPE="disk"\n'
'KNAME="ram3" MODEL="" SIZE="8388608" ROTA="0" TYPE="disk"'
)
# NOTE(pas-ha) largest device is 1 byte smaller than 4GiB