Merge pull request #365 from mwhudson/lp-1769478

filter out disks with the ID_CDROM udev property
This commit is contained in:
Michael Hudson-Doyle 2018-06-15 10:49:08 +12:00 committed by GitHub
commit ad9d08776a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 6 deletions

View File

@ -345,8 +345,14 @@ class FilesystemModel(object):
if path in currently_mounted: if path in currently_mounted:
continue continue
if data['DEVTYPE'] == 'disk': if data['DEVTYPE'] == 'disk':
if not data["DEVPATH"].startswith('/devices/virtual'): if data["DEVPATH"].startswith('/devices/virtual'):
if data["MAJOR"] != "2" and data['attrs'].get('ro') != "1": continue
if data["MAJOR"] in ("2", "11"): # serial and cd devices
continue
if data['attrs'].get('ro') == "1":
continue
if "ID_CDROM" in data:
continue
# log.debug('disk={}\n{}'.format( # log.debug('disk={}\n{}'.format(
# path, json.dumps(data, indent=4, sort_keys=True))) # path, json.dumps(data, indent=4, sort_keys=True)))
info = self.prober.get_storage_info(path) info = self.prober.get_storage_info(path)