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 | |
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')
-rw-r--r-- | storage/formats/__init__.py | 8 | ||||
-rw-r--r-- | storage/formats/disklabel.py | 10 | ||||
-rw-r--r-- | storage/formats/fs.py | 9 | ||||
-rw-r--r-- | storage/formats/luks.py | 9 | ||||
-rw-r--r-- | storage/formats/lvmpv.py | 7 | ||||
-rw-r--r-- | storage/formats/mdraid.py | 6 | ||||
-rw-r--r-- | storage/formats/swap.py | 6 |
7 files changed, 55 insertions, 0 deletions
diff --git a/storage/formats/__init__.py b/storage/formats/__init__.py index 8e479b639..adf5ef19d 100644 --- a/storage/formats/__init__.py +++ b/storage/formats/__init__.py @@ -187,6 +187,14 @@ class DeviceFormat(object): "format": self.formattable, "resize": self.resizable}) return s + @property + def dict(self): + d = {"type": self.type, "name": self.name, "device": self.device, + "uuid": self.uuid, "exists": self.exists, + "options": self.options, "supported": self.supported, + "resizable": self.resizable} + return d + def _setOptions(self, options): self._options = options 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) diff --git a/storage/formats/fs.py b/storage/formats/fs.py index 09e764d5f..b07bd4ab7 100644 --- a/storage/formats/fs.py +++ b/storage/formats/fs.py @@ -172,6 +172,15 @@ class FS(DeviceFormat): "targetSize": self.targetSize}) return s + @property + def dict(self): + d = super(FS, self).dict + d.update({"mountpoint": self.mountpoint, "size": self._size, + "label": self.label, "targetSize": self.targetSize, + "mountable": self.mountable, + "migratable": self.migratable}) + return d + def _setTargetSize(self, newsize): """ Set a target size for this filesystem. """ if not self.exists: diff --git a/storage/formats/luks.py b/storage/formats/luks.py index 1105a6f2b..880f652b3 100644 --- a/storage/formats/luks.py +++ b/storage/formats/luks.py @@ -108,6 +108,15 @@ class LUKS(DeviceFormat): return s @property + def dict(self): + d = super(LUKS, self).dict + d.update({"cipher": self.cipher, "keySize": self.key_size, + "mapName": self.mapName, "hasKey": self.hasKey, + "escrowCert": self.escrow_cert, + "backup": self.add_backup_passphrase}) + return d + + @property def name(self): name = self._name # for existing locked devices, show "Encrypted" instead of LUKS diff --git a/storage/formats/lvmpv.py b/storage/formats/lvmpv.py index 67fa7516f..9fe9ba35e 100644 --- a/storage/formats/lvmpv.py +++ b/storage/formats/lvmpv.py @@ -75,6 +75,13 @@ class LVMPhysicalVolume(DeviceFormat): "peStart": self.peStart}) return s + @property + def dict(self): + d = super(LVMPhysicalVolume, self).dict + d.update({"vgName": self.vgName, "vgUUID": self.vgUuid, + "peStart": self.peStart}) + return d + def probe(self): """ Probe for any missing information about this device. """ log_method_call(self, device=self.device, diff --git a/storage/formats/mdraid.py b/storage/formats/mdraid.py index eeef9431b..b26abfc52 100644 --- a/storage/formats/mdraid.py +++ b/storage/formats/mdraid.py @@ -71,6 +71,12 @@ class MDRaidMember(DeviceFormat): s += (" mdUUID = %(mdUUID)s" % {"mdUUID": self.mdUuid}) return s + @property + def dict(self): + d = super(MDRaidMember, self).dict + d.update({"mdUUID": self.mdUuid, "biosraid": self.biosraid}) + return d + def probe(self): """ Probe for any missing information about this format. """ log_method_call(self, device=self.device, diff --git a/storage/formats/swap.py b/storage/formats/swap.py index 0d96fb1fc..f7538c213 100644 --- a/storage/formats/swap.py +++ b/storage/formats/swap.py @@ -69,6 +69,12 @@ class SwapSpace(DeviceFormat): {"priority": self.priority, "label": self.label}) return s + @property + def dict(self): + d = super(SwapSpace, self).dict + d.update({"priority": self.priority, "label": self.label}) + return d + def _setPriority(self, priority): if priority is None: self._priority = None |