diff options
author | Bill Nottingham <notting@redhat.com> | 2008-04-15 22:00:44 -0400 |
---|---|---|
committer | Bill Nottingham <notting@redhat.com> | 2008-04-15 22:00:44 -0400 |
commit | 9083f70668bfeb72b5dfea73d5cc68685e057e8b (patch) | |
tree | 30f3a2b749a5c9d6513f19927dc19c19c90ba640 | |
parent | 69cf3a55408698ff74c78b949a1975d698f5a952 (diff) | |
download | anaconda-9083f70668bfeb72b5dfea73d5cc68685e057e8b.tar.gz anaconda-9083f70668bfeb72b5dfea73d5cc68685e057e8b.tar.xz anaconda-9083f70668bfeb72b5dfea73d5cc68685e057e8b.zip |
Don't use megabytes for the livecd size for copying.
Doing / 1024 / 1024 * 1024 * 1024 truncates the size to the
nearest megabyte. If the size of the live image is a multiple
of 8MB + change, it won't all get copied, leading to fs
errors. (#442106)
Thanks to Eric Sandeen for the legwork.
-rw-r--r-- | livecd.py | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -115,7 +115,7 @@ class LiveCDCopyBackend(backend.AnacondaBackend): def _getLiveBlockDevice(self): return os.path.normpath(self.osimg) - def _getLiveSizeMB(self): + def _getLiveSize(self): def parseField(output, field): for line in output.split("\n"): if line.startswith(field + ":"): @@ -127,8 +127,11 @@ class LiveCDCopyBackend(backend.AnacondaBackend): stderr=open('/dev/null', 'w') ).communicate()[0] blkcnt = int(parseField(output, "Block count")) - blksize = int(parseField(output, "Block size")) - return blkcnt * blksize / 1024 / 1024 + blksize = int(parseField(output, "Block size")) + return blkcnt * blksize + + def _getLiveSizeMB(self): + return self._getLiveSize() / 1048576 def _unmountNonFstabDirs(self, anaconda): # unmount things that aren't listed in /etc/fstab. *sigh* @@ -182,7 +185,7 @@ class LiveCDCopyBackend(backend.AnacondaBackend): r.fsystem = fsset.fileSystemTypeGet(roottype) readamt = 1024 * 1024 * 8 # 8 megs at a time - size = float(self._getLiveSizeMB() * 1024 * 1024) + size = self._getLiveSize() copied = 0 while copied < size: buf = os.read(osfd, readamt) @@ -190,7 +193,7 @@ class LiveCDCopyBackend(backend.AnacondaBackend): if (written < readamt) and (written < len(buf)): raise RuntimeError, "error copying filesystem!" copied += written - progress.set_fraction(pct = copied / size) + progress.set_fraction(pct = copied / float(size)) progress.processEvents() os.close(osfd) |