diff --git a/ironic_python_agent/hardware.py b/ironic_python_agent/hardware.py index 9ed0c5b85..2f532053f 100644 --- a/ironic_python_agent/hardware.py +++ b/ironic_python_agent/hardware.py @@ -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']) diff --git a/ironic_python_agent/tests/unit/test_hardware.py b/ironic_python_agent/tests/unit/test_hardware.py index f540f1f59..c99e0aaf2 100644 --- a/ironic_python_agent/tests/unit/test_hardware.py +++ b/ironic_python_agent/tests/unit/test_hardware.py @@ -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