Merge "Handle floppy disk controllers"

This commit is contained in:
Zuul 2019-08-27 07:53:00 +00:00 committed by Gerrit Code Review
commit 6d3d1367a9
3 changed files with 24 additions and 2 deletions

View File

@ -236,7 +236,8 @@ def _md_scan_and_assemble():
def list_all_block_devices(block_type='disk',
ignore_raid=False):
ignore_raid=False,
ignore_floppy=True):
"""List all physical block devices
The switches we use for lsblk: P for KEY="value" output, b for size output
@ -250,6 +251,8 @@ def list_all_block_devices(block_type='disk',
:param ignore_raid: Ignore auto-identified raid devices, example: md0
Defaults to false as these are generally disk
devices and should be treated as such if encountered.
:param ignore_floppy: Ignore floppy disk devices in the block device
list. By default, these devices are filtered out.
:return: A list of BlockDevices
"""
@ -305,6 +308,13 @@ def list_all_block_devices(block_type='disk',
if _is_known_device(devices, device.get('KNAME')):
continue
# If we collected the RM column, we could consult it for removable
# media, however USB devices are also flagged as removable media.
# we have to explicitly do this as floppy disks are type disk.
if ignore_floppy and str(device.get('KNAME')).startswith('fd'):
LOG.debug('Ignoring floppy disk device %s', device)
continue
# Search for raid in the reply type, as RAID is a
# disk device, and we should honor it if is present.
# Other possible type values, which we skip recording:

View File

@ -142,7 +142,8 @@ BLK_DEVICE_TEMPLATE = (
'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"'
'KNAME="ram3" MODEL="" SIZE="8388608" ROTA="0" TYPE="disk"\n'
'KNAME="fd1" MODEL="magic" SIZE="4096" ROTA="1" TYPE="disk"'
)
# NOTE(pas-ha) largest device is 1 byte smaller than 4GiB

View File

@ -0,0 +1,11 @@
---
fixes:
- |
Fixes cleaning operations when floppy disk devices are present on the
baremetal node.
other:
- |
The default ``list_all_block_devices`` hardware manager method has been
changed to ignore floppy disk devices. An argument ``ignore_floppy``
with a default value of ``True``. A value of ``False`` may be passed
to the ``list_all_block_devices`` method to include such devices.