0b05ab
From 8124b804915d54e341e80bdd84e84eec3a54aaba Mon Sep 17 00:00:00 2001
0b05ab
From: David Lehman <dlehman@redhat.com>
0b05ab
Date: Tue, 27 Nov 2018 13:37:49 -0500
0b05ab
Subject: [PATCH 1/2] Only update sysfs path in ctor for active devices.
0b05ab
0b05ab
Related: rhbz#1579375
0b05ab
---
0b05ab
 blivet/devices/storage.py | 2 +-
0b05ab
 1 file changed, 1 insertion(+), 1 deletion(-)
0b05ab
0b05ab
diff --git a/blivet/devices/storage.py b/blivet/devices/storage.py
0b05ab
index 3cc29436..904b60df 100644
0b05ab
--- a/blivet/devices/storage.py
0b05ab
+++ b/blivet/devices/storage.py
0b05ab
@@ -149,8 +149,8 @@ def __init__(self, name, fmt=None, uuid=None,
0b05ab
         self.device_links = []
0b05ab
 
0b05ab
         if self.exists:
0b05ab
-            self.update_sysfs_path()
0b05ab
             if self.status:
0b05ab
+                self.update_sysfs_path()
0b05ab
                 self.update_size()
0b05ab
 
0b05ab
     def __str__(self):
0b05ab
0b05ab
From 4cc31c735db820896278a7b91bb761df00becdb5 Mon Sep 17 00:00:00 2001
0b05ab
From: David Lehman <dlehman@redhat.com>
0b05ab
Date: Tue, 27 Nov 2018 14:03:40 -0500
0b05ab
Subject: [PATCH 2/2] Fix xfs sync of chrooted mountpoint.
0b05ab
0b05ab
Related: rhbz#1579375
0b05ab
---
0b05ab
 blivet/tasks/fssync.py | 22 ++++++++++++++++------
0b05ab
 1 file changed, 16 insertions(+), 6 deletions(-)
0b05ab
0b05ab
diff --git a/blivet/tasks/fssync.py b/blivet/tasks/fssync.py
0b05ab
index a15c8e1b..996fe782 100644
0b05ab
--- a/blivet/tasks/fssync.py
0b05ab
+++ b/blivet/tasks/fssync.py
0b05ab
@@ -49,11 +49,21 @@ class XFSSync(FSSync):
0b05ab
 
0b05ab
     ext = availability.XFSFREEZE_APP
0b05ab
 
0b05ab
-    def _freeze_command(self):
0b05ab
-        return [str(self.ext), "-f", self.fs.system_mountpoint]
0b05ab
+    def _get_mountpoint(self, root=None):
0b05ab
+        mountpoint = self.fs.system_mountpoint
0b05ab
+        if root is not None and root.replace('/', ''):
0b05ab
+            if mountpoint == root:
0b05ab
+                mountpoint = '/'
0b05ab
+            else:
0b05ab
+                mountpoint = mountpoint[len(root):]
0b05ab
 
0b05ab
-    def _unfreeze_command(self):
0b05ab
-        return [str(self.ext), "-u", self.fs.system_mountpoint]
0b05ab
+        return mountpoint
0b05ab
+
0b05ab
+    def _freeze_command(self, root=None):
0b05ab
+        return [str(self.ext), "-f", self._get_mountpoint(root=root)]
0b05ab
+
0b05ab
+    def _unfreeze_command(self, root=None):
0b05ab
+        return [str(self.ext), "-u", self._get_mountpoint(root=root)]
0b05ab
 
0b05ab
     def do_task(self, root="/"):
0b05ab
         # pylint: disable=arguments-differ
0b05ab
@@ -63,13 +73,13 @@ def do_task(self, root="/"):
0b05ab
 
0b05ab
         error_msg = None
0b05ab
         try:
0b05ab
-            rc = util.run_program(self._freeze_command(), root=root)
0b05ab
+            rc = util.run_program(self._freeze_command(root=root), root=root)
0b05ab
         except OSError as e:
0b05ab
             error_msg = "failed to sync filesytem: %s" % e
0b05ab
         error_msg = error_msg or rc
0b05ab
 
0b05ab
         try:
0b05ab
-            rc = util.run_program(self._unfreeze_command(), root=root)
0b05ab
+            rc = util.run_program(self._unfreeze_command(root=root), root=root)
0b05ab
         except OSError as e:
0b05ab
             error_msg = error_msg or "failed to sync filesystem: %s" % e
0b05ab
         error_msg = error_msg or rc