summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Fulbright <msf@redhat.com>2001-07-24 05:09:03 +0000
committerMike Fulbright <msf@redhat.com>2001-07-24 05:09:03 +0000
commitdbe3a86e1b198899d061d2d10bc11956175f9beb (patch)
tree436750a42608d3fdebcf869381163c4b598863b6
parent5b3adf5230900227957b54f87a4b87ac005d6904 (diff)
downloadanaconda-dbe3a86e1b198899d061d2d10bc11956175f9beb.tar.gz
anaconda-dbe3a86e1b198899d061d2d10bc11956175f9beb.tar.xz
anaconda-dbe3a86e1b198899d061d2d10bc11956175f9beb.zip
work to make partitionless upgrades work better than before
-rw-r--r--fsset.py38
-rw-r--r--partitioning.py27
-rw-r--r--upgrade.py2
3 files changed, 44 insertions, 23 deletions
diff --git a/fsset.py b/fsset.py
index 99f0d3365..5b365f29b 100644
--- a/fsset.py
+++ b/fsset.py
@@ -308,7 +308,7 @@ class ext2FileSystem(extFileSystem):
if entry.fsystem.getName() != "ext3":
raise RuntimeError, ("Trying to migrate ext2 to something other "
"than ext3")
-
+
rc = iutil.execWithRedirect("/usr/sbin/tune2fs",
["tunefs", "-j", devicePath ],
stdout = "/dev/tty5",
@@ -866,7 +866,7 @@ class FileSystemSet:
def hasDirtyFilesystems(self):
if self.rootOnLoop():
entry = self.getEntryByMountPoint('/')
- mountLoopbackRoot(entry.device.host, skipMount = 1)
+ mountLoopbackRoot(entry.device.host[5:], skipMount = 1)
dirty = isys.ext2IsDirty("loop1")
unmountLoopbackRoot(skipMount = 1)
if dirty: return 1
@@ -935,7 +935,7 @@ class FileSystemSetEntry:
self.badblocks = badblocks
def mount(self, chroot='/', devPrefix='/tmp'):
- device = self.device.setupDevice(chroot, devPrefix=devPrefix)
+ device = self.device.setupDevice(chroot, devPrefix=devPrefix)
self.fsystem.mount(device, "%s/%s" % (chroot, self.mountpoint))
self.mountcount = self.mountcount + 1
@@ -1159,6 +1159,18 @@ class SwapFileDevice(Device):
"required size is unknown.")
return file
+# This is a device that describes a swap file that is sitting on
+# the loopback filesystem host for partitionless installs.
+# The piggypath is the place where the loopback file host filesystem
+# will be mounted
+class PiggybackSwapFileDevice(SwapFileDevice):
+ def __init__(self, piggypath, file):
+ SwapFileDevice.__init__(self, file)
+ self.piggypath = piggypath
+
+ def setupDevice (self, chroot, devPrefix='/tmp'):
+ return SwapFileDevice.setupDevice(self, self.piggypath, devPrefix)
+
class LoopbackDevice(Device):
def __init__(self, hostPartition, hostFs):
Device.__init__(self)
@@ -1166,6 +1178,16 @@ class LoopbackDevice(Device):
self.hostfs = hostFs
self.device = "loop1"
+ def setupDevice(self, chroot, devPrefix='/tmp/'):
+ isys.makeDevInode("loop1", '/tmp/' + "loop1")
+
+ if not self.isSetup:
+ isys.mount(self.host[5:], "/mnt/loophost", fstype = "vfat")
+ isys.losetup("/tmp/loop1", "/mnt/loophost/redhat.img")
+
+ self.isSetup = 1
+ return "/tmp/loop1"
+
def getComment (self):
return "# LOOP1: %s %s /redhat.img\n" % (self.host, self.hostfs)
@@ -1243,12 +1265,10 @@ def readFstab (path):
# swap files
file = fields[0]
- # the loophost looks like /mnt/loophost to the install, not
- # like /initrd/loopfs
if file[:15] == "/initrd/loopfs/":
- file = "/mnt/loophost/" + file[14:]
+ file = file[14:]
- device = SwapFileDevice(file)
+ device = PiggybackSwapFileDevice("/mnt/loophost", file)
elif fields[0][:9] == "/dev/loop":
# look up this loop device in the index to find the
# partition that houses the filesystem image
@@ -1297,10 +1317,10 @@ def mountLoopbackRoot(device, skipMount = 0):
def unmountLoopbackRoot(skipMount = 0):
if not skipMount:
- isys.umount('/mnt/sysimage')
+ isys.umount('/mnt/sysimage')
isys.makeDevInode("loop1", '/tmp/' + "loop1")
isys.unlosetup("/tmp/loop1")
- isys.umount('/mnt/loophost')
+ isys.umount('/mnt/loophost')
def ext2FormatFilesystem(argList, messageFile, windowCreator, mntpoint):
if windowCreator:
diff --git a/partitioning.py b/partitioning.py
index 11acce538..53573697d 100644
--- a/partitioning.py
+++ b/partitioning.py
@@ -1274,21 +1274,22 @@ class DiskSet:
except parted.error, msg:
if not intf:
DiskSet.skippedDisks.append(drive)
- rc = intf.messageWindow(_("Warning"),
- _("The partition table on device %s was unreadable. "
- "To create new partitions it must be initialized, "
- "causing the loss of ALL DATA on this drive.\n\n"
- "Would you like to initialize this drive?")
- % (drive,), type = "yesno")
- if rc == 0:
- DiskSet.skippedDisks.append(drive)
else:
- try:
- dev.disk_create(getDefaultDiskType())
- disk = parted.PedDisk.open(dev)
- self.disks[drive] = disk
- except parted.error, msg:
+ rc = intf.messageWindow(_("Warning"),
+ _("The partition table on device %s was unreadable. "
+ "To create new partitions it must be initialized, "
+ "causing the loss of ALL DATA on this drive.\n\n"
+ "Would you like to initialize this drive?")
+ % (drive,), type = "yesno")
+ if rc == 0:
DiskSet.skippedDisks.append(drive)
+ else:
+ try:
+ dev.disk_create(getDefaultDiskType())
+ disk = parted.PedDisk.open(dev)
+ self.disks[drive] = disk
+ except parted.error, msg:
+ DiskSet.skippedDisks.append(drive)
def partitionTypes (self):
rc = []
diff --git a/upgrade.py b/upgrade.py
index fe1c6f05a..2fea9d6b8 100644
--- a/upgrade.py
+++ b/upgrade.py
@@ -121,7 +121,7 @@ def upgradeSwapSuggestion(dispatch, id, instPath):
if id.fsset.rootOnLoop():
space = isys.pathSpaceAvailable("/mnt/loophost")
- for entry in fsset.entries:
+ for entry in id.fsset.entries:
if entry.mountpoint != '/' or space <= 16:
continue