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