> @@ -409,30 +427,15 @@ def endAlignment(self):
>
> @property
> def free(self):
> - def read_int_from_sys(path):
> - return int(open(path).readline().strip())
> + if not self.supported:
> + return Size(0)
>
> try:
> free = sum(Size(f.getLength(unit="B"))
> for f in self.partedDisk.getFreeSpacePartitions())
> except Exception: # pylint: disable=broad-except
> log_exception_info()
> - sys_block_root = "/sys/class/block/"
> -
> - # FIXME: /dev/mapper/foo won't work without massaging
> - disk_name = self.device.split("/")[-1]
> -
> - disk_root = sys_block_root + disk_name
> - disk_length = read_int_from_sys("%s/size" % disk_root)
> - sector_size = read_int_from_sys("%s/queue/logical_block_size" % disk_root)
> - partition_names = [n for n in os.listdir(disk_root) if n.startswith(disk_name)]
> - used_sectors = 0
> - for partition_name in partition_names:
> - partition_root = sys_block_root + partition_name
> - partition_length = read_int_from_sys("%s/size" % partition_root)
> - used_sectors += partition_length
> -
> - free = Size((disk_length - used_sectors) * sector_size)
Well, it is possible that sometimes it is used. However, it cannot handle `device-mapper` or `md`, and there are many other critical pieces of `DiskLabel` functionality that would not be available if we fail to get a `parted.Disk` instance. I think this one area of partial support in the absence of a `parted.Disk` is not very useful given how many other areas that become unusable in its absence.
--
To view this pull request on github, visit https://github.com/rhinstaller/blivet/pull/428#discussion_r65210098