[PATCH 3/5] Make the storage.writeKS method useful and called from instdata (#493703).

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

 



---
 instdata.py         |    3 +--
 storage/__init__.py |   44 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 45 insertions(+), 2 deletions(-)

diff --git a/instdata.py b/instdata.py
index 1e48db9..30bdaf6 100644
--- a/instdata.py
+++ b/instdata.py
@@ -269,8 +269,7 @@ class InstallData:
         self.security.writeKS(f)
         self.timezone.writeKS(f)
         self.bootloader.writeKS(f)
-        self.storage.iscsi.writeKS(f)
-        self.storage.zfcp.writeKS(f)
+        self.storage.writeKS(f)
 
         if self.backend is not None:
             self.backend.writeKS(f)
diff --git a/storage/__init__.py b/storage/__init__.py
index d7b53b6..5d25667 100644
--- a/storage/__init__.py
+++ b/storage/__init__.py
@@ -940,6 +940,50 @@ class Storage(object):
 
     def writeKS(self, f):
         log.warning("Storage.writeKS not completely implemented")
+        f.write("# The following is the partition information you requested\n")
+        f.write("# Note that any partitions you deleted are not expressed\n")
+        f.write("# here so unless you clear all partitions first, this is\n")
+        f.write("# not guaranteed to work\n")
+
+        # clearpart
+        if self.clearPartType == CLEARPART_TYPE_NONE:
+            args = ["--none"]
+        elif self.clearPartType == CLEARPART_TYPE_LINUX:
+            args = ["--linux"]
+        else:
+            args = ["--all"]
+
+        if self.clearPartDisks:
+            args += ["--drives=%" % ",".join(self.clearPartDisks)]
+        if self.reinitializeDisks:
+            args += ["--initlabel"]
+
+        f.write("#clearpart %s\n" % " ".join(args))
+
+        # ignoredisks
+        if self.ignoredDisks:
+            f.write("#ignoredisk --drives=%s\n" % ",".join(self.ignoredDisks))
+        elif self.exclusiveDisks:
+            f.write("#ignoredisk --only-use=%s\n" % ",".join(self.exclusiveDisks))
+
+        # the various partitioning commands
+        dict = {}
+        ordering = []
+        actions = filter(lambda x: x.device.format.type != "luks",
+                         self.devicetree.findActions(type="create"))
+
+        for action in actions:
+            if dict.has_key(action.device.path):
+                dict[action.device.path].append(action)
+            else:
+                dict[action.device.path] = [action]
+                ordering.append(action.device.path)
+
+        for path in ordering:
+            for device in map(lambda x: x.device, dict[path]):
+                device.writeKS(f)
+                f.write("\n")
+
         self.iscsi.writeKS(f)
         self.zfcp.writeKS(f)
 
-- 
1.6.1.3

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux