[master 1/1] Add support for snapshot autopart.

dwlehman installerbot-noreply at redhat.com
Wed Jun 24 17:45:57 UTC 2015


From: David Lehman <dlehman at redhat.com>

After installing the system, take a snapshot of the root device and
reconfigure the system to use the snapshot as the root device.

This is only supported with thinp and btrfs autopart.

Resolves: rhbz#1113207
---
 pyanaconda/install.py   | 17 +++++++++++++++--
 pyanaconda/kickstart.py |  4 ++--
 2 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/pyanaconda/install.py b/pyanaconda/install.py
index 2b6b8aa..102d6c8 100644
--- a/pyanaconda/install.py
+++ b/pyanaconda/install.py
@@ -60,6 +60,7 @@ def _writeKS(ksdata):
 def doConfiguration(storage, payload, ksdata, instClass):
     willWriteNetwork = not flags.flags.imageInstall and not flags.flags.dirInstall
     willRunRealmd = ksdata.realm.discovered
+    willSnapShotRoot = ksdata.autopart.autopart and ksdata.autopart.snapshot
 
     # configure base, create users, configure addons, initramfs, post-install
     step_count = 5
@@ -106,8 +107,9 @@ def doConfiguration(storage, payload, ksdata, instClass):
     with progress_report(_("Configuring addons")):
         ksdata.addons.execute(storage, ksdata, instClass, u)
 
-    with progress_report(_("Generating initramfs")):
-        payload.recreateInitrds()
+    if not willSnapShotRoot:
+        with progress_report(_("Generating initramfs")):
+            payload.recreateInitrds()
 
     # Work around rhbz#1200539, grubby doesn't handle grub2 missing initrd with /boot on btrfs
     # So rerun writing the bootloader if this is live and /boot is on btrfs
@@ -131,6 +133,17 @@ def doConfiguration(storage, payload, ksdata, instClass):
     # kickstart file over if one exists).
     _writeKS(ksdata)
 
+    if willSnapShotRoot:
+        with progress_report(_("Configuring root snapshot")):
+            blivet.autopart.setUpRootSnapShot(storage)
+
+        with progress_report(_("Generating initramfs")):
+            payload.recreateInitrds()
+
+        if not ksdata.bootloader.disabled and ksdata.bootloader != "none":
+            with progress_report(_("Installing bootloader")):
+                writeBootLoader(storage, payload, instClass, ksdata)
+
     progress_complete()
 
 def doInstall(storage, payload, ksdata, instClass):
diff --git a/pyanaconda/kickstart.py b/pyanaconda/kickstart.py
index 804f729..1d747ac 100644
--- a/pyanaconda/kickstart.py
+++ b/pyanaconda/kickstart.py
@@ -299,9 +299,9 @@ def execute(self, *args):
         except RuntimeError as msg:
             log.error("Error running %s %s: %s", cmd, args, msg)
 
-class AutoPart(commands.autopart.F21_AutoPart):
+class AutoPart(commands.autopart.F23_AutoPart):
     def parse(self, args):
-        retval = commands.autopart.F21_AutoPart.parse(self, args)
+        retval = commands.autopart.F23_AutoPart.parse(self, args)
 
         if self.fstype:
             fmt = blivet.formats.getFormat(self.fstype)


-- 
To view this commit on github, visit https://github.com/rhinstaller/anaconda/commit/7119f977ec0953c4183320873b0deb2f4d479599


More information about the anaconda-patches mailing list