FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > ArchLinux > ArchLinux Development

 
 
LinkBack Thread Tools
 
Old 01-14-2012, 07:06 PM
David Lehman
 
Default Add properties to return free space in an existing filesystem or disklabel.

---
pyanaconda/storage/formats/disklabel.py | 5 +++++
pyanaconda/storage/formats/fs.py | 10 ++++++++++
2 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/pyanaconda/storage/formats/disklabel.py b/pyanaconda/storage/formats/disklabel.py
index 734f13e..dbae626 100644
--- a/pyanaconda/storage/formats/disklabel.py
+++ b/pyanaconda/storage/formats/disklabel.py
@@ -367,5 +367,10 @@ class DiskLabel(DeviceFormat):

return self._endAlignment

+ @property
+ def free(self):
+ return sum([f.getSize()
+ for f in self.partedDisk.getFreeSpacePartitions()])
+
register_device_format(DiskLabel)

diff --git a/pyanaconda/storage/formats/fs.py b/pyanaconda/storage/formats/fs.py
index bb2dddc..3909dc4 100644
--- a/pyanaconda/storage/formats/fs.py
+++ b/pyanaconda/storage/formats/fs.py
@@ -308,6 +308,16 @@ class FS(DeviceFormat):
size = self._size
return float(size)

+ @property
+ def free(self):
+ free = 0
+ if self.exists:
+ if self.currentSize and self.minSize and
+ self.currentSize != self.minSize:
+ free = int(self.currentSize - self.minSize) # truncate
+
+ return free
+
def _getFormatOptions(self, options=None):
argv = []
if options and isinstance(options, list):
--
1.7.6

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 

Thread Tools




All times are GMT. The time now is 10:41 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org