On Thu, 2009-10-29 at 16:53 -1000, David Cantrell wrote: > The following install test case has been failing: > https://fedoraproject.org/wiki/QA:Testcase_Anaconda_autopart_%28shrink%29_install > > The problem was with the minSize property in Ext2FS. We use resize2fs > to get the minSize for ext2/3/4 filesystems, which is good because > resize2fs accounts for additional things an extX volume may need. The > problem is the value it reports is in blocks. We have to convert those > blocks to bytes, then to megabytes, then round up to account for any > fractional megabytes. Use dumpe2fs to get the block size and use > resize2fs as we have been, but modify the calculation of size. > > Also the _setTargetSize() method in FS needed a change. minSize can be > less than or equal to newsize, not just less than. Looks good to me. Dave > --- > storage/formats/fs.py | 28 +++++++++++++++++++++++++--- > 1 files changed, 25 insertions(+), 3 deletions(-) > > diff --git a/storage/formats/fs.py b/storage/formats/fs.py > index 2f9b6e2..b1f6761 100644 > --- a/storage/formats/fs.py > +++ b/storage/formats/fs.py > @@ -168,7 +168,7 @@ class FS(DeviceFormat): > self._targetSize = None > return > > - if not self.minSize < newsize < self.maxSize: > + if not self.minSize <= newsize < self.maxSize: > raise ValueError("invalid target size request") > > self._targetSize = newsize > @@ -860,7 +860,23 @@ class Ext2FS(FS): > # try once in the beginning to get the minimum size for an > # existing filesystem. > size = self._minSize > + blockSize = None > + > if self.exists and os.path.exists(self.device): > + # get block size > + buf = iutil.execWithCapture(self.infofsProg, > + ["-h", self.device], > + stderr="/dev/tty5") > + for line in buf.splitlines(): > + if line.startswith("Block size:"): > + blockSize = int(line.split(" ")[-1]) > + break > + > + if blockSize is None: > + raise FSError("failed to get block size for %s filesystem " > + "on %s" % (self.mountType, self.device)) > + > + # get minimum size according to resize2fs > buf = iutil.execWithCapture(self.resizefsProg, > ["-P", self.device], > stderr="/dev/tty5") > @@ -868,9 +884,15 @@ class Ext2FS(FS): > if "minimum size of the filesystem:" not in line: > continue > > + # line will look like: > + # Estimated minimum size of the filesystem: 1148649 > + # > + # NOTE: The minimum size reported is in blocks. Convert > + # to bytes, then megabytes, and finally round up. > (text, sep, minSize) = line.partition(": ") > - > - size = int(minSize) / 1024.0 > + size = long(minSize) * blockSize > + size = math.ceil(size / 1024.0 / 1024.0) > + break > > if size is None: > log.warning("failed to get minimum size for %s filesystem " _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list