On Thu, Sep 17, 2009 at 04:54:11PM -1000, David Cantrell wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Comments inline. > > On Wed, 16 Sep 2009, Joel Granados Moreno wrote: > >> * storage/partitioning.py (hasFreeDiskSpace): New function. >> --- >> storage/partitioning.py | 32 ++++++++++++++++++++++++++++++++ >> 1 files changed, 32 insertions(+), 0 deletions(-) >> >> diff --git a/storage/partitioning.py b/storage/partitioning.py >> index d14a481..4bbc9bc 100644 >> --- a/storage/partitioning.py >> +++ b/storage/partitioning.py >> @@ -1080,6 +1080,38 @@ def growPartitions(disks, partitions): >> continue >> part.req_size = part.req_base_size >> >> +def hasFreeDiskSpace(storage, exclusiveDisks=None): >> + """Returns True if there is at least 100Mb of free usable space in any of >> + the disks. False otherwise. >> + >> + This function is the 'same" as doPartitioning. The only difference is > > Mismatched quotes around same. yep, thx. > >> + that it first allocates partitions, searches for free space, and then >> + grows partitions. First we allocate partitions without growing them >> + because it will give us a state where we can search for the regon that >> + is greater than 100Mb in every disk. >> + >> + """ >> + retval = False >> + doPartitioning(storage, exclusiveDisks=exclusiveDisks, grow=False) >> + >> + # FIXME : shouldn't this be in storage.disks? >> + disks = storage.disks >> + if exclusiveDisks: >> + disks = [d for d in disks if d.name in exclusiveDisks] >> + >> + for disk in disks: >> + regs = disk.format.partedDisk.getFreeSpaceRegions() >> + for region in regs: >> + if region.getSize(unit="MB") > 100: >> + retval = True >> + break >> + if retval: >> + break >> + >> + doPartitioning(storage, exclusiveDisks=exclusiveDisks, alloc=False) >> + return retval >> + >> + >> def lvCompare(lv1, lv2): >> """ More specifically defined lvs come first. >> >> > > The method itself looks fine, but it feels like it should be somewhere else in > the code. I just don't know where. > > - -- David Cantrell <dcantrell@xxxxxxxxxx> > Red Hat / Honolulu, HI > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.9 (GNU/Linux) > > iEYEARECAAYFAkqy9lMACgkQ5hsjjIy1VknI+QCfSAaC1nJOTXsPTq5QXFJBXxcu > 65AAn2hQ3gdXCPse2KasnvZqsa3vHqri > =Yayq > -----END PGP SIGNATURE----- > > _______________________________________________ > Anaconda-devel-list mailing list > Anaconda-devel-list@xxxxxxxxxx > https://www.redhat.com/mailman/listinfo/anaconda-devel-list -- Joel Andres Granados Brno, Czech Republic, Red Hat.
Attachment:
pgpQuEU5LFKtR.pgp
Description: PGP signature
_______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list