[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[PATCH 1/2] Add support for specifying upgrade partition in ks (#471232)



The support was removed during storage rewrite
(commit e1a7fe9887886044b07587b3ec2caa2ff53ebfb2),
perhaps because it hadn't worked before removing anyway
(both branches of added if clause did the same thing
- see commit 130f1e6ca2b3f46166a302ca21b1df53062383be)

It selects upgrade root based on upgrade --root-device command.
Supports partition name (e.g. 'sda1', or 'Volgroup00-LogVol00') and
UUID specified via 'UUID=<uuid>'.

---
 upgrade.py |   22 ++++++++++++++--------
 1 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/upgrade.py b/upgrade.py
index 9d7081e..48b50a2 100644
--- a/upgrade.py
+++ b/upgrade.py
@@ -62,20 +62,26 @@ def queryUpgradeContinue(anaconda):
         sys.exit(0)
     return DISPATCH_FORWARD
 
+def setUpgradeRoot(anaconda):
+    anaconda.id.upgradeRoot = []
+    root_device = None
+    # kickstart can pass device as device name or uuid. No quotes allowed.
+    if anaconda.isKickstart and anaconda.id.ksdata.upgrade.root_device is not None:
+        root_device = anaconda.id.ksdata.upgrade.root_device
+    for (dev, label) in anaconda.id.rootParts:
+        if ((root_device is not None) and
+            (root_device == dev.name or root_device == "UUID=%s" % dev.format.uuid)):
+            anaconda.id.upgradeRoot.insert(0, (dev,label))
+        else:
+            anaconda.id.upgradeRoot.append((dev,label))
+
 def findRootParts(anaconda):
     if anaconda.dir == DISPATCH_BACK:
         return
     if anaconda.id.rootParts is None:
         anaconda.id.rootParts = findExistingRoots(anaconda)
 
-    root_device = None
-    # ks.cfg can pass device as raw device, label or uuid. no quotes allowed
-    if anaconda.isKickstart and anaconda.id.ksdata.upgrade.root_device is not None:
-        root_device=anaconda.id.ksdata.upgrade.root_device
-
-    anaconda.id.upgradeRoot = []
-    for (dev, label) in anaconda.id.rootParts:
-        anaconda.id.upgradeRoot.append( (dev, label) )
+    setUpgradeRoot(anaconda)
 
     if anaconda.id.rootParts is not None and len(anaconda.id.rootParts) > 0:
         anaconda.dispatch.skipStep("findinstall", skip = 0)
-- 
1.6.0.6


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]