[PATCH 1/2] text based storage spoke.
Brian C. Lane
bcl at redhat.com
Tue Aug 14 18:56:45 UTC 2012
On Tue, Aug 14, 2012 at 10:54:45AM -0700, Jesse Keating wrote:
> A fair amount of this code comes from the gui storage spoke. When we
> refactor things this will hopefully see a reduction in code.
>
> Initially we can only pick disks to use and what way to clear the
> partitions. Autopartitioning (plain) is forced.
> ---
This looks fairly good to me. My bigbest concern is the duplication of
logic from the other spoke code. When it doesn't depend on tui/gui we
should move it someplace common. eg.
> +class FakeDiskLabel(object):
> + def __init__(self, free=0):
> + self.free = free
> +
> +class FakeDisk(object):
> + def __init__(self, name, size=0, free=0, partitioned=True, vendor=None,
> + model=None, serial=None, removable=False):
> + self.name = name
> + self.size = size
> + self.format = FakeDiskLabel(free=free)
> + self.partitioned = partitioned
> + self.vendor = vendor
> + self.model = model
> + self.serial = serial
> + self.removable = removable
> +
> + @property
> + def description(self):
> + return "%s %s" % (self.vendor, self.model)
> +
This stuff could probably be in Storage someplace.
> + def _update_summary(self):
> + """ Update the summary based on the UI. """
> + count = 0
> + capacity = 0
> + free = Size(bytes=0)
> +
> + # pass in our disk list so hidden disks' free space is available
> + free_space = self.storage.getFreeSpace(disks=self.disks)
> + selected = [d for d in self.disks if d.name in self.selected_disks]
> +
> + for disk in selected:
> + capacity += disk.size
> + free += free_space[disk.name][0]
> + count += 1
> +
This is the kind of stuff that shouldn't be in 2 places, one or the
other will end up not getting updated when things change in the future.
--
Brian C. Lane | Anaconda Team | IRC: bcl #anaconda | Port Orchard, WA (PST8PDT)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 482 bytes
Desc: not available
URL: <https://lists.fedorahosted.org/pipermail/anaconda-patches/attachments/20120814/940f0c75/attachment.sig>
More information about the anaconda-patches
mailing list