summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Katz <katzj@redhat.com>2004-04-20 19:59:02 +0000
committerJeremy Katz <katzj@redhat.com>2004-04-20 19:59:02 +0000
commit87b0928251d0141332614c4c6a3cd8a85ff39614 (patch)
treecc0820e6955f095622193827fff88c066f57abb2
parent922b91871fa523431a6e959f74077fe2857934ea (diff)
downloadanaconda-87b0928251d0141332614c4c6a3cd8a85ff39614.tar.gz
anaconda-87b0928251d0141332614c4c6a3cd8a85ff39614.tar.xz
anaconda-87b0928251d0141332614c4c6a3cd8a85ff39614.zip
fix upgrades with root on lvm1 (#121294)
-rw-r--r--fsset.py18
-rw-r--r--packages.py6
2 files changed, 21 insertions, 3 deletions
diff --git a/fsset.py b/fsset.py
index ff53560cf..e03bae2ac 100644
--- a/fsset.py
+++ b/fsset.py
@@ -17,6 +17,7 @@ import string
import isys
import iutil
import os
+import posix
import errno
import parted
import sys
@@ -1461,10 +1462,21 @@ class FileSystemSet:
entry.mountpoint, msg))
sys.exit(0)
+ self.makeLVMNodes(instPath)
+
+ def makeLVMNodes(self, instPath, trylvm1 = 0):
# XXX hack to make the device node exist for the root fs if
# it's a logical volume so that mkinitrd can create the initrd.
root = self.getEntryByMountPoint("/")
- if isinstance(root.device, LogicalVolumeDevice):
+
+ rootlvm1 = 0
+ if trylvm1:
+ dev = root.device.getDevice()
+ # lvm1 major is 58
+ if posix.major(os.stat("%s/dev/%s" %(instPath, dev)).st_rdev) == 58:
+ rootlvm1 = 1
+
+ if isinstance(root.device, LogicalVolumeDevice) or rootlvm1:
# now make sure all of the device nodes exist. *sigh*
rc = iutil.execWithRedirect("lvm",
["lvm", "vgmknodes", "-v"],
@@ -1480,10 +1492,12 @@ class FileSystemSet:
os.makedirs(rootdir)
dmdev = "/dev/mapper/" + root.device.getDevice().replace("/", "-")
iutil.copyDeviceNode(dmdev, instPath + dmdev)
+ # unlink existing so that we dtrt on upgrades
+ if os.path.exists(instPath + rootDev):
+ os.unlink(instPath + rootDev)
os.symlink(dmdev, instPath + rootDev)
if not os.path.isdir("%s/etc/lvm" %(instPath,)):
os.makedirs("%s/etc/lvm" %(instPath,))
-# raise RuntimeError
def filesystemSpace(self, chroot='/'):
space = []
diff --git a/packages.py b/packages.py
index 033bbdf38..c1f2b36cd 100644
--- a/packages.py
+++ b/packages.py
@@ -513,8 +513,12 @@ def doMigrateFilesystems(dir, thefsset, diskset, upgrade, instPath):
if thefsset.haveMigratedFilesystems():
return DISPATCH_NOOP
-
+
thefsset.migrateFilesystems (instPath)
+
+ # if we're upgrading, we may need to do lvm device node hackery
+ if upgrade.get():
+ thefsset.makeLVMNodes(instPath, trylvm1 = 1)
def turnOnFilesystems(dir, thefsset, diskset, partitions, upgrade, instPath):