diff options
author | David Lehman <dlehman@redhat.com> | 2009-12-21 19:13:24 -0600 |
---|---|---|
committer | David Lehman <dlehman@redhat.com> | 2009-12-22 15:02:36 -0600 |
commit | 0ac007dda15f2fefa59924e905a919828b8fd6a4 (patch) | |
tree | ed8457a61fac942c43a5eff5e6473ff1a90769d6 /storage/formats/disklabel.py | |
parent | 59fae899cf0895778c8a615bb32bacd203a47a03 (diff) | |
download | anaconda-0ac007dda15f2fefa59924e905a919828b8fd6a4.tar.gz anaconda-0ac007dda15f2fefa59924e905a919828b8fd6a4.tar.xz anaconda-0ac007dda15f2fefa59924e905a919828b8fd6a4.zip |
Add a "dict" attribute to Device and DeviceFormat classes.
This attribute is a dict that describes the device or format instance
with considerable detail. It is intended that the dict will be
pickled using the shelve module, so values should be picklable objects.
Keys should be descriptive strings.
Diffstat (limited to 'storage/formats/disklabel.py')
-rw-r--r-- | storage/formats/disklabel.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/storage/formats/disklabel.py b/storage/formats/disklabel.py index e5c563108..e5fab94a7 100644 --- a/storage/formats/disklabel.py +++ b/storage/formats/disklabel.py @@ -101,6 +101,16 @@ class DiskLabel(DeviceFormat): "dev": self.partedDevice}) return s + @property + def dict(self): + d = super(DiskLabel, self).dict + d.update({"labelType": self.labelType, + "partitionCount": len(self.partitions), + "sectorSize": self.partedDevice.sectorSize, + "offset": self.alignment.offset, + "grainSize": self.alignment.grainSize}) + return d + def resetPartedDisk(self): """ Set this instance's partedDisk to reflect the disk's contents. """ log_method_call(self, device=self.device) |