mirror of
https://github.com/Pardus-LiderAhenk/ahenk
synced 2024-11-21 22:02:15 +03:00
bug fixed
This commit is contained in:
parent
a41169c869
commit
e0bd0ab14d
1 changed files with 12 additions and 0 deletions
|
@ -30,6 +30,18 @@ class DiskInfo():
|
|||
total_size += int(disk['total'])
|
||||
return total_size
|
||||
|
||||
@staticmethod
|
||||
def total_disk_free():
|
||||
ssd_list, hdd_list = DiskInfo.get_all_disks()
|
||||
total_disk_free = 0
|
||||
if len(ssd_list) > 0:
|
||||
for disk in ssd_list:
|
||||
total_disk_free += int(disk['total']) - int(disk['used'])
|
||||
if len(hdd_list) > 0:
|
||||
for disk in hdd_list:
|
||||
total_disk_free += int(disk['total']) - int(disk['used'])
|
||||
return total_disk_free
|
||||
|
||||
@staticmethod
|
||||
def get_all_disks():
|
||||
result_code, p_out, p_err = Util.execute("lsblk -b -o NAME,TYPE,ROTA,SIZE,RM,HOTPLUG,MOUNTPOINT,FSUSED | grep -v loop | awk '$5 == \"0\" { print $0 }'")
|
||||
|
|
Loading…
Reference in a new issue