Ack. On 12/16/2009 06:01 PM, David Lehman wrote:
--- storage/formats/__init__.py | 13 +++++++++++++ storage/formats/disklabel.py | 16 ++++++++++++++++ storage/formats/dmraid.py | 5 +++++ storage/formats/fs.py | 10 ++++++++++ storage/formats/luks.py | 16 ++++++++++++++++ storage/formats/lvmpv.py | 8 ++++++++ storage/formats/mdraid.py | 5 +++++ storage/formats/multipath.py | 5 +++++ storage/formats/swap.py | 6 ++++++ 9 files changed, 84 insertions(+), 0 deletions(-) diff --git a/storage/formats/__init__.py b/storage/formats/__init__.py index 930d5e4..8e479b6 100644 --- a/storage/formats/__init__.py +++ b/storage/formats/__init__.py @@ -174,6 +174,19 @@ class DeviceFormat(object): #if self.__class__ is DeviceFormat: # self.exists = True + def __str__(self): + s = ("%(classname)s instance (%(id)s) --\n" + " type = %(type)s name = %(name)s status = %(status)s\n" + " device = %(device)s uuid = %(uuid)s exists = %(exists)s\n" + " options = %(options)s supported = %(supported)s" + " formattable = %(format)s resizable = %(resize)s\n" % + {"classname": self.__class__.__name__, "id": "%#x" % id(self), + "type": self.type, "name": self.name, "status": self.status, + "device": self.device, "uuid": self.uuid, "exists": self.exists, + "options": self.options, "supported": self.supported, + "format": self.formattable, "resize": self.resizable}) + return s + def _setOptions(self, options): self._options = options diff --git a/storage/formats/disklabel.py b/storage/formats/disklabel.py index 8917efd..e5c5631 100644 --- a/storage/formats/disklabel.py +++ b/storage/formats/disklabel.py @@ -85,6 +85,22 @@ class DiskLabel(DeviceFormat): return new + def __str__(self): + s = DeviceFormat.__str__(self) + s += (" type = %(type)s partition count = %(count)s" + " sectorSize = %(sectorSize)s\n" + " align_offset = %(offset)s align_grain = %(grain)s\n" + " partedDisk = %(disk)r\n" + " origPartedDisk = %(orig_disk)r\n" + " partedDevice = %(dev)r\n" % + {"type": self.labelType, "count": len(self.partitions), + "sectorSize": self.partedDevice.sectorSize, + "offset": self.alignment.offset, + "grain": self.alignment.grainSize, + "disk": self.partedDisk, "orig_disk": self._origPartedDisk, + "dev": self.partedDevice}) + return s + 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/dmraid.py b/storage/formats/dmraid.py index 1c2290c..3d2ee86 100644 --- a/storage/formats/dmraid.py +++ b/storage/formats/dmraid.py @@ -77,6 +77,11 @@ class DMRaidMember(DeviceFormat): # Initialize the attribute that will hold the block object. self._raidmem = None + def __str__(self): + s = DeviceFormat.__str__(self) + s += (" raidmem = %(raidmem)r" % {"raidmem": self.raidmem}) + return s + def _getRaidmem(self): return self._raidmem diff --git a/storage/formats/fs.py b/storage/formats/fs.py index 7c861a4..239386d 100644 --- a/storage/formats/fs.py +++ b/storage/formats/fs.py @@ -161,6 +161,16 @@ class FS(DeviceFormat): if self.supported: self.loadModule() + def __str__(self): + s = DeviceFormat.__str__(self) + s += (" mountpoint = %(mountpoint)s mountopts = %(mountopts)s\n" + " label = %(label)s size = %(size)s" + " targetSize = %(targetSize)s\n" % + {"mountpoint": self.mountpoint, "mountopts": self.mountopts, + "label": self.label, "size": self._size, + "targetSize": self.targetSize}) + return s + 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 67e5c67..1105a6f 100644 --- a/storage/formats/luks.py +++ b/storage/formats/luks.py @@ -91,6 +91,22 @@ class LUKS(DeviceFormat): elif not self.mapName and self.device: self.mapName = "luks-%s" % os.path.basename(self.device) + def __str__(self): + s = DeviceFormat.__str__(self) + if self.__passphrase: + passphrase = "(set)" + else: + passphrase = "(not set)" + s += (" cipher = %(cipher)s keySize = %(keySize)s" + " mapName = %(mapName)s\n" + " keyFile = %(keyFile)s passphrase = %(passphrase)s\n" + " escrowCert = %(escrowCert)s addBackup = %(backup)s" % + {"cipher": self.cipher, "keySize": self.key_size, + "mapName": self.mapName, "keyFile": self._key_file, + "passphrase": passphrase, "escrowCert": self.escrow_cert, + "backup": self.add_backup_passphrase}) + return s + @property def name(self): name = self._name diff --git a/storage/formats/lvmpv.py b/storage/formats/lvmpv.py index e06c1e1..67fa751 100644 --- a/storage/formats/lvmpv.py +++ b/storage/formats/lvmpv.py @@ -67,6 +67,14 @@ class LVMPhysicalVolume(DeviceFormat): # for not-yet-created devices self.peStart = kwargs.get("peStart", 0.1875) # in MB + def __str__(self): + s = DeviceFormat.__str__(self) + s += (" vgName = %(vgName)s vgUUID = %(vgUUID)s" + " peStart = %(peStart)s" % + {"vgName": self.vgName, "vgUUID": self.vgUuid, + "peStart": self.peStart}) + return s + 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 9983da4..eeef943 100644 --- a/storage/formats/mdraid.py +++ b/storage/formats/mdraid.py @@ -66,6 +66,11 @@ class MDRaidMember(DeviceFormat): #self.probe() self.biosraid = False + def __str__(self): + s = DeviceFormat.__str__(self) + s += (" mdUUID = %(mdUUID)s" % {"mdUUID": self.mdUuid}) + return s + def probe(self): """ Probe for any missing information about this format. """ log_method_call(self, device=self.device, diff --git a/storage/formats/multipath.py b/storage/formats/multipath.py index ad61b50..86c05d6 100644 --- a/storage/formats/multipath.py +++ b/storage/formats/multipath.py @@ -67,6 +67,11 @@ class MultipathMember(DeviceFormat): # Initialize the attribute that will hold the block object. self._member = None + def __str__(self): + s = DeviceFormat.__str__(self) + s += (" member = %(member)r" % {"member": self.member}) + return s + def _getMember(self): return self._member diff --git a/storage/formats/swap.py b/storage/formats/swap.py index 970f511..0d96fb1 100644 --- a/storage/formats/swap.py +++ b/storage/formats/swap.py @@ -63,6 +63,12 @@ class SwapSpace(DeviceFormat): self.priority = kwargs.get("priority") self.label = kwargs.get("label") + def __str__(self): + s = DeviceFormat.__str__(self) + s += (" priority = %(priority)s label = %(label)s" % + {"priority": self.priority, "label": self.label}) + return s + def _setPriority(self, priority): if priority is None: self._priority = None
_______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list