1
0
Fork 0

plugin_disk: Fix checking the 'removable' attribute on python3

The 'removable' attribute is a bytestring, so it will never be equal to
"0" in python3. Check equality with b"0" instead.

The patch was originally written by Tomáš Korbař.

Signed-off-by: Ondřej Lysoněk <olysonek@redhat.com>
This commit is contained in:
Ondřej Lysoněk 2019-01-24 16:28:24 +01:00
parent 668bf7448d
commit 2cc3d74798

View file

@ -39,7 +39,7 @@ class DiskPlugin(hotplug.Plugin):
@classmethod
def _device_is_supported(cls, device):
return device.device_type == "disk" and \
device.attributes.get("removable", None) == "0" and \
device.attributes.get("removable", None) == b"0" and \
(device.parent is None or \
device.parent.subsystem in ["scsi", "virtio", "xen"])