4cd9fd
From 433d863cd8a57e5fc30948ff905e6a477ed5f17c Mon Sep 17 00:00:00 2001
4cd9fd
From: Vojtech Trefny <vtrefny@redhat.com>
4cd9fd
Date: Tue, 14 Jul 2020 11:27:08 +0200
4cd9fd
Subject: [PATCH 1/4] Add support for XFS format grow
4cd9fd
4cd9fd
---
4cd9fd
 blivet/formats/fs.py         |  2 ++
4cd9fd
 blivet/tasks/availability.py |  1 +
4cd9fd
 blivet/tasks/fsresize.py     | 54 ++++++++++++++++++++++++++++++++++++
4cd9fd
 3 files changed, 57 insertions(+)
4cd9fd
4cd9fd
diff --git a/blivet/formats/fs.py b/blivet/formats/fs.py
4cd9fd
index eee15aaa..12cb9885 100644
4cd9fd
--- a/blivet/formats/fs.py
4cd9fd
+++ b/blivet/formats/fs.py
4cd9fd
@@ -1089,11 +1089,13 @@ class XFS(FS):
4cd9fd
     _formattable = True
4cd9fd
     _linux_native = True
4cd9fd
     _supported = True
4cd9fd
+    _resizable = True
4cd9fd
     _packages = ["xfsprogs"]
4cd9fd
     _info_class = fsinfo.XFSInfo
4cd9fd
     _mkfs_class = fsmkfs.XFSMkfs
4cd9fd
     _readlabel_class = fsreadlabel.XFSReadLabel
4cd9fd
     _size_info_class = fssize.XFSSize
4cd9fd
+    _resize_class = fsresize.XFSResize
4cd9fd
     _sync_class = fssync.XFSSync
4cd9fd
     _writelabel_class = fswritelabel.XFSWriteLabel
4cd9fd
     _writeuuid_class = fswriteuuid.XFSWriteUUID
4cd9fd
diff --git a/blivet/tasks/availability.py b/blivet/tasks/availability.py
4cd9fd
index b6b5955a..df62780c 100644
4cd9fd
--- a/blivet/tasks/availability.py
4cd9fd
+++ b/blivet/tasks/availability.py
4cd9fd
@@ -455,5 +455,6 @@ TUNE2FS_APP = application_by_version("tune2fs", E2FSPROGS_VERSION)
4cd9fd
 XFSADMIN_APP = application("xfs_admin")
4cd9fd
 XFSDB_APP = application("xfs_db")
4cd9fd
 XFSFREEZE_APP = application("xfs_freeze")
4cd9fd
+XFSRESIZE_APP = application("xfs_growfs")
4cd9fd
 
4cd9fd
 MOUNT_APP = application("mount")
4cd9fd
diff --git a/blivet/tasks/fsresize.py b/blivet/tasks/fsresize.py
4cd9fd
index e7e26984..12c0367f 100644
4cd9fd
--- a/blivet/tasks/fsresize.py
4cd9fd
+++ b/blivet/tasks/fsresize.py
4cd9fd
@@ -20,7 +20,10 @@
4cd9fd
 # Red Hat Author(s): Anne Mulhern <amulhern@redhat.com>
4cd9fd
 
4cd9fd
 import abc
4cd9fd
+import os
4cd9fd
+import tempfile
4cd9fd
 
4cd9fd
+from contextlib import contextmanager
4cd9fd
 from six import add_metaclass
4cd9fd
 
4cd9fd
 from ..errors import FSError
4cd9fd
@@ -32,6 +35,9 @@ from . import task
4cd9fd
 from . import fstask
4cd9fd
 from . import dfresize
4cd9fd
 
4cd9fd
+import logging
4cd9fd
+log = logging.getLogger("blivet")
4cd9fd
+
4cd9fd
 
4cd9fd
 @add_metaclass(abc.ABCMeta)
4cd9fd
 class FSResizeTask(fstask.FSTask):
4cd9fd
@@ -115,6 +121,54 @@ class NTFSResize(FSResize):
4cd9fd
         ]
4cd9fd
 
4cd9fd
 
4cd9fd
+class XFSResize(FSResize):
4cd9fd
+    ext = availability.XFSRESIZE_APP
4cd9fd
+    unit = B
4cd9fd
+    size_fmt = None
4cd9fd
+
4cd9fd
+    @contextmanager
4cd9fd
+    def _do_temp_mount(self):
4cd9fd
+        if self.fs.status:
4cd9fd
+            yield
4cd9fd
+        else:
4cd9fd
+            dev_name = os.path.basename(self.fs.device)
4cd9fd
+            tmpdir = tempfile.mkdtemp(prefix="xfs-tempmount-%s" % dev_name)
4cd9fd
+            log.debug("mounting XFS on '%s' to '%s' for resize", self.fs.device, tmpdir)
4cd9fd
+            try:
4cd9fd
+                self.fs.mount(mountpoint=tmpdir)
4cd9fd
+            except FSError as e:
4cd9fd
+                raise FSError("Failed to mount XFS filesystem for resize: %s" % str(e))
4cd9fd
+
4cd9fd
+            try:
4cd9fd
+                yield
4cd9fd
+            finally:
4cd9fd
+                util.umount(mountpoint=tmpdir)
4cd9fd
+                os.rmdir(tmpdir)
4cd9fd
+
4cd9fd
+    def _get_block_size(self):
4cd9fd
+        if self.fs._current_info:
4cd9fd
+            # this should be set by update_size_info()
4cd9fd
+            for line in self.fs._current_info.split("\n"):
4cd9fd
+                if line.startswith("blocksize ="):
4cd9fd
+                    return int(line.split("=")[-1])
4cd9fd
+
4cd9fd
+        raise FSError("Failed to get XFS filesystem block size for resize")
4cd9fd
+
4cd9fd
+    def size_spec(self):
4cd9fd
+        # size for xfs_growfs is in blocks
4cd9fd
+        return str(self.fs.target_size.convert_to(self.unit) / self._get_block_size())
4cd9fd
+
4cd9fd
+    @property
4cd9fd
+    def args(self):
4cd9fd
+        return [self.fs.system_mountpoint, "-D", self.size_spec()]
4cd9fd
+
4cd9fd
+    def do_task(self):
4cd9fd
+        """ Resizes the XFS format. """
4cd9fd
+
4cd9fd
+        with self._do_temp_mount():
4cd9fd
+            super(XFSResize, self).do_task()
4cd9fd
+
4cd9fd
+
4cd9fd
 class TmpFSResize(FSResize):
4cd9fd
 
4cd9fd
     ext = availability.MOUNT_APP
4cd9fd
-- 
4cd9fd
2.26.2
4cd9fd
4cd9fd
4cd9fd
From 56d05334231c30699a9c77dedbc23fdb021b9dee Mon Sep 17 00:00:00 2001
4cd9fd
From: Vojtech Trefny <vtrefny@redhat.com>
4cd9fd
Date: Tue, 14 Jul 2020 11:27:51 +0200
4cd9fd
Subject: [PATCH 2/4] Add tests for XFS resize
4cd9fd
4cd9fd
XFS supports only grow so we can't reuse most of the fstesting
4cd9fd
code and we also need to test the resize on partition because
4cd9fd
XFS won't allow grow to size bigger than the underlying block
4cd9fd
device.
4cd9fd
---
4cd9fd
 tests/formats_test/fs_test.py   | 91 +++++++++++++++++++++++++++++++++
4cd9fd
 tests/formats_test/fstesting.py | 33 ++++++------
4cd9fd
 2 files changed, 107 insertions(+), 17 deletions(-)
4cd9fd
4cd9fd
diff --git a/tests/formats_test/fs_test.py b/tests/formats_test/fs_test.py
4cd9fd
index 15fc0c35..9bc5d20d 100644
4cd9fd
--- a/tests/formats_test/fs_test.py
4cd9fd
+++ b/tests/formats_test/fs_test.py
4cd9fd
@@ -2,8 +2,13 @@ import os
4cd9fd
 import tempfile
4cd9fd
 import unittest
4cd9fd
 
4cd9fd
+import parted
4cd9fd
+
4cd9fd
 import blivet.formats.fs as fs
4cd9fd
 from blivet.size import Size, ROUND_DOWN
4cd9fd
+from blivet.errors import DeviceFormatError
4cd9fd
+from blivet.formats import get_format
4cd9fd
+from blivet.devices import PartitionDevice, DiskDevice
4cd9fd
 
4cd9fd
 from tests import loopbackedtestcase
4cd9fd
 
4cd9fd
@@ -50,6 +55,92 @@ class ReiserFSTestCase(fstesting.FSAsRoot):
4cd9fd
 class XFSTestCase(fstesting.FSAsRoot):
4cd9fd
     _fs_class = fs.XFS
4cd9fd
 
4cd9fd
+    def can_resize(self, an_fs):
4cd9fd
+        resize_tasks = (an_fs._resize, an_fs._size_info)
4cd9fd
+        return not any(t.availability_errors for t in resize_tasks)
4cd9fd
+
4cd9fd
+    def _create_partition(self, disk, size):
4cd9fd
+        disk.format = get_format("disklabel", device=disk.path, label_type="msdos")
4cd9fd
+        disk.format.create()
4cd9fd
+        pstart = disk.format.alignment.grainSize
4cd9fd
+        pend = pstart + int(Size(size) / disk.format.parted_device.sectorSize)
4cd9fd
+        disk.format.add_partition(pstart, pend, parted.PARTITION_NORMAL)
4cd9fd
+        disk.format.parted_disk.commit()
4cd9fd
+        part = disk.format.parted_disk.getPartitionBySector(pstart)
4cd9fd
+
4cd9fd
+        device = PartitionDevice(os.path.basename(part.path))
4cd9fd
+        device.disk = disk
4cd9fd
+        device.exists = True
4cd9fd
+        device.parted_partition = part
4cd9fd
+
4cd9fd
+        return device
4cd9fd
+
4cd9fd
+    def _remove_partition(self, partition, disk):
4cd9fd
+        disk.format.remove_partition(partition.parted_partition)
4cd9fd
+        disk.format.parted_disk.commit()
4cd9fd
+
4cd9fd
+    def test_resize(self):
4cd9fd
+        an_fs = self._fs_class()
4cd9fd
+        if not an_fs.formattable:
4cd9fd
+            self.skipTest("can not create filesystem %s" % an_fs.name)
4cd9fd
+        an_fs.device = self.loop_devices[0]
4cd9fd
+        self.assertIsNone(an_fs.create())
4cd9fd
+        an_fs.update_size_info()
4cd9fd
+
4cd9fd
+        self._test_sizes(an_fs)
4cd9fd
+        # CHECKME: target size is still 0 after updated_size_info is called.
4cd9fd
+        self.assertEqual(an_fs.size, Size(0) if an_fs.resizable else an_fs._size)
4cd9fd
+
4cd9fd
+        if not self.can_resize(an_fs):
4cd9fd
+            self.assertFalse(an_fs.resizable)
4cd9fd
+            # Not resizable, so can not do resizing actions.
4cd9fd
+            with self.assertRaises(DeviceFormatError):
4cd9fd
+                an_fs.target_size = Size("64 MiB")
4cd9fd
+            with self.assertRaises(DeviceFormatError):
4cd9fd
+                an_fs.do_resize()
4cd9fd
+        else:
4cd9fd
+            disk = DiskDevice(os.path.basename(self.loop_devices[0]))
4cd9fd
+            part = self._create_partition(disk, Size("50 MiB"))
4cd9fd
+            an_fs = self._fs_class()
4cd9fd
+            an_fs.device = part.path
4cd9fd
+            self.assertIsNone(an_fs.create())
4cd9fd
+            an_fs.update_size_info()
4cd9fd
+
4cd9fd
+            self.assertTrue(an_fs.resizable)
4cd9fd
+
4cd9fd
+            # grow the partition so we can grow the filesystem
4cd9fd
+            self._remove_partition(part, disk)
4cd9fd
+            part = self._create_partition(disk, size=part.size + Size("40 MiB"))
4cd9fd
+
4cd9fd
+            # Try a reasonable target size
4cd9fd
+            TARGET_SIZE = Size("64 MiB")
4cd9fd
+            an_fs.target_size = TARGET_SIZE
4cd9fd
+            self.assertEqual(an_fs.target_size, TARGET_SIZE)
4cd9fd
+            self.assertNotEqual(an_fs._size, TARGET_SIZE)
4cd9fd
+            self.assertIsNone(an_fs.do_resize())
4cd9fd
+            ACTUAL_SIZE = TARGET_SIZE.round_to_nearest(an_fs._resize.unit, rounding=ROUND_DOWN)
4cd9fd
+            self.assertEqual(an_fs.size, ACTUAL_SIZE)
4cd9fd
+            self.assertEqual(an_fs._size, ACTUAL_SIZE)
4cd9fd
+            self._test_sizes(an_fs)
4cd9fd
+
4cd9fd
+            self._remove_partition(part, disk)
4cd9fd
+
4cd9fd
+        # and no errors should occur when checking
4cd9fd
+        self.assertIsNone(an_fs.do_check())
4cd9fd
+
4cd9fd
+    def test_shrink(self):
4cd9fd
+        self.skipTest("Not checking resize for this test category.")
4cd9fd
+
4cd9fd
+    def test_too_small(self):
4cd9fd
+        self.skipTest("Not checking resize for this test category.")
4cd9fd
+
4cd9fd
+    def test_no_explicit_target_size2(self):
4cd9fd
+        self.skipTest("Not checking resize for this test category.")
4cd9fd
+
4cd9fd
+    def test_too_big2(self):
4cd9fd
+        # XXX this tests assumes that resizing to max size - 1 B will fail, but xfs_grow won't
4cd9fd
+        self.skipTest("Not checking resize for this test category.")
4cd9fd
+
4cd9fd
 
4cd9fd
 class HFSTestCase(fstesting.FSAsRoot):
4cd9fd
     _fs_class = fs.HFS
4cd9fd
diff --git a/tests/formats_test/fstesting.py b/tests/formats_test/fstesting.py
4cd9fd
index 62f806f9..86b2a116 100644
4cd9fd
--- a/tests/formats_test/fstesting.py
4cd9fd
+++ b/tests/formats_test/fstesting.py
4cd9fd
@@ -11,16 +11,6 @@ from blivet.size import Size, ROUND_DOWN
4cd9fd
 from blivet.formats import fs
4cd9fd
 
4cd9fd
 
4cd9fd
-def can_resize(an_fs):
4cd9fd
-    """ Returns True if this filesystem has all necessary resizing tools
4cd9fd
-        available.
4cd9fd
-
4cd9fd
-        :param an_fs: a filesystem object
4cd9fd
-    """
4cd9fd
-    resize_tasks = (an_fs._resize, an_fs._size_info, an_fs._minsize)
4cd9fd
-    return not any(t.availability_errors for t in resize_tasks)
4cd9fd
-
4cd9fd
-
4cd9fd
 @add_metaclass(abc.ABCMeta)
4cd9fd
 class FSAsRoot(loopbackedtestcase.LoopBackedTestCase):
4cd9fd
 
4cd9fd
@@ -32,6 +22,15 @@ class FSAsRoot(loopbackedtestcase.LoopBackedTestCase):
4cd9fd
     def __init__(self, methodName='run_test'):
4cd9fd
         super(FSAsRoot, self).__init__(methodName=methodName, device_spec=[self._DEVICE_SIZE])
4cd9fd
 
4cd9fd
+    def can_resize(self, an_fs):
4cd9fd
+        """ Returns True if this filesystem has all necessary resizing tools
4cd9fd
+            available.
4cd9fd
+
4cd9fd
+            :param an_fs: a filesystem object
4cd9fd
+        """
4cd9fd
+        resize_tasks = (an_fs._resize, an_fs._size_info, an_fs._minsize)
4cd9fd
+        return not any(t.availability_errors for t in resize_tasks)
4cd9fd
+
4cd9fd
     def _test_sizes(self, an_fs):
4cd9fd
         """ Test relationships between different size values.
4cd9fd
 
4cd9fd
@@ -190,7 +189,7 @@ class FSAsRoot(loopbackedtestcase.LoopBackedTestCase):
4cd9fd
         # CHECKME: target size is still 0 after updated_size_info is called.
4cd9fd
         self.assertEqual(an_fs.size, Size(0) if an_fs.resizable else an_fs._size)
4cd9fd
 
4cd9fd
-        if not can_resize(an_fs):
4cd9fd
+        if not self.can_resize(an_fs):
4cd9fd
             self.assertFalse(an_fs.resizable)
4cd9fd
             # Not resizable, so can not do resizing actions.
4cd9fd
             with self.assertRaises(DeviceFormatError):
4cd9fd
@@ -221,7 +220,7 @@ class FSAsRoot(loopbackedtestcase.LoopBackedTestCase):
4cd9fd
         # in constructor call behavior would be different.
4cd9fd
 
4cd9fd
         an_fs = self._fs_class()
4cd9fd
-        if not can_resize(an_fs):
4cd9fd
+        if not self.can_resize(an_fs):
4cd9fd
             self.skipTest("Not checking resize for this test category.")
4cd9fd
         if not an_fs.formattable:
4cd9fd
             self.skipTest("can not create filesystem %s" % an_fs.name)
4cd9fd
@@ -244,7 +243,7 @@ class FSAsRoot(loopbackedtestcase.LoopBackedTestCase):
4cd9fd
         """
4cd9fd
         SIZE = Size("64 MiB")
4cd9fd
         an_fs = self._fs_class(size=SIZE)
4cd9fd
-        if not can_resize(an_fs):
4cd9fd
+        if not self.can_resize(an_fs):
4cd9fd
             self.skipTest("Not checking resize for this test category.")
4cd9fd
         if not an_fs.formattable:
4cd9fd
             self.skipTest("can not create filesystem %s" % an_fs.name)
4cd9fd
@@ -264,7 +263,7 @@ class FSAsRoot(loopbackedtestcase.LoopBackedTestCase):
4cd9fd
 
4cd9fd
     def test_shrink(self):
4cd9fd
         an_fs = self._fs_class()
4cd9fd
-        if not can_resize(an_fs):
4cd9fd
+        if not self.can_resize(an_fs):
4cd9fd
             self.skipTest("Not checking resize for this test category.")
4cd9fd
         if not an_fs.formattable:
4cd9fd
             self.skipTest("can not create filesystem %s" % an_fs.name)
4cd9fd
@@ -296,7 +295,7 @@ class FSAsRoot(loopbackedtestcase.LoopBackedTestCase):
4cd9fd
 
4cd9fd
     def test_too_small(self):
4cd9fd
         an_fs = self._fs_class()
4cd9fd
-        if not can_resize(an_fs):
4cd9fd
+        if not self.can_resize(an_fs):
4cd9fd
             self.skipTest("Not checking resize for this test category.")
4cd9fd
         if not an_fs.formattable:
4cd9fd
             self.skipTest("can not create or resize filesystem %s" % an_fs.name)
4cd9fd
@@ -315,7 +314,7 @@ class FSAsRoot(loopbackedtestcase.LoopBackedTestCase):
4cd9fd
 
4cd9fd
     def test_too_big(self):
4cd9fd
         an_fs = self._fs_class()
4cd9fd
-        if not can_resize(an_fs):
4cd9fd
+        if not self.can_resize(an_fs):
4cd9fd
             self.skipTest("Not checking resize for this test category.")
4cd9fd
         if not an_fs.formattable:
4cd9fd
             self.skipTest("can not create filesystem %s" % an_fs.name)
4cd9fd
@@ -334,7 +333,7 @@ class FSAsRoot(loopbackedtestcase.LoopBackedTestCase):
4cd9fd
 
4cd9fd
     def test_too_big2(self):
4cd9fd
         an_fs = self._fs_class()
4cd9fd
-        if not can_resize(an_fs):
4cd9fd
+        if not self.can_resize(an_fs):
4cd9fd
             self.skipTest("Not checking resize for this test category.")
4cd9fd
         if not an_fs.formattable:
4cd9fd
             self.skipTest("can not create filesystem %s" % an_fs.name)
4cd9fd
-- 
4cd9fd
2.26.2
4cd9fd
4cd9fd
4cd9fd
From 51acc04f4639f143b55789a06a68aae988a91296 Mon Sep 17 00:00:00 2001
4cd9fd
From: Vojtech Trefny <vtrefny@redhat.com>
4cd9fd
Date: Wed, 15 Jul 2020 12:59:04 +0200
4cd9fd
Subject: [PATCH 3/4] Add support for checking and fixing XFS using xfs_repair
4cd9fd
4cd9fd
---
4cd9fd
 blivet/formats/fs.py          |  1 +
4cd9fd
 blivet/tasks/availability.py  |  1 +
4cd9fd
 blivet/tasks/fsck.py          | 12 ++++++++++++
4cd9fd
 tests/formats_test/fs_test.py |  6 +++---
4cd9fd
 4 files changed, 17 insertions(+), 3 deletions(-)
4cd9fd
4cd9fd
diff --git a/blivet/formats/fs.py b/blivet/formats/fs.py
4cd9fd
index 12cb9885..06fbdf10 100644
4cd9fd
--- a/blivet/formats/fs.py
4cd9fd
+++ b/blivet/formats/fs.py
4cd9fd
@@ -1091,6 +1091,7 @@ class XFS(FS):
4cd9fd
     _supported = True
4cd9fd
     _resizable = True
4cd9fd
     _packages = ["xfsprogs"]
4cd9fd
+    _fsck_class = fsck.XFSCK
4cd9fd
     _info_class = fsinfo.XFSInfo
4cd9fd
     _mkfs_class = fsmkfs.XFSMkfs
4cd9fd
     _readlabel_class = fsreadlabel.XFSReadLabel
4cd9fd
diff --git a/blivet/tasks/availability.py b/blivet/tasks/availability.py
4cd9fd
index df62780c..f3b76650 100644
4cd9fd
--- a/blivet/tasks/availability.py
4cd9fd
+++ b/blivet/tasks/availability.py
4cd9fd
@@ -456,5 +456,6 @@ XFSADMIN_APP = application("xfs_admin")
4cd9fd
 XFSDB_APP = application("xfs_db")
4cd9fd
 XFSFREEZE_APP = application("xfs_freeze")
4cd9fd
 XFSRESIZE_APP = application("xfs_growfs")
4cd9fd
+XFSREPAIR_APP = application("xfs_repair")
4cd9fd
 
4cd9fd
 MOUNT_APP = application("mount")
4cd9fd
diff --git a/blivet/tasks/fsck.py b/blivet/tasks/fsck.py
4cd9fd
index 5274f13a..8477f5f8 100644
4cd9fd
--- a/blivet/tasks/fsck.py
4cd9fd
+++ b/blivet/tasks/fsck.py
4cd9fd
@@ -123,6 +123,18 @@ class Ext2FSCK(FSCK):
4cd9fd
         return "\n".join(msgs) or None
4cd9fd
 
4cd9fd
 
4cd9fd
+class XFSCK(FSCK):
4cd9fd
+    _fsck_errors = {1: "Runtime error encountered during repair operation.",
4cd9fd
+                    2: "XFS repair was unable to proceed due to a dirty log."}
4cd9fd
+
4cd9fd
+    ext = availability.XFSREPAIR_APP
4cd9fd
+    options = []
4cd9fd
+
4cd9fd
+    def _error_message(self, rc):
4cd9fd
+        msgs = (self._fsck_errors[c] for c in self._fsck_errors.keys() if rc & c)
4cd9fd
+        return "\n".join(msgs) or None
4cd9fd
+
4cd9fd
+
4cd9fd
 class HFSPlusFSCK(FSCK):
4cd9fd
     _fsck_errors = {3: "Quick check found a dirty filesystem; no repairs done.",
4cd9fd
                     4: "Root filesystem was dirty. System should be rebooted.",
4cd9fd
diff --git a/tests/formats_test/fs_test.py b/tests/formats_test/fs_test.py
4cd9fd
index 9bc5d20d..8fb099fd 100644
4cd9fd
--- a/tests/formats_test/fs_test.py
4cd9fd
+++ b/tests/formats_test/fs_test.py
4cd9fd
@@ -123,10 +123,10 @@ class XFSTestCase(fstesting.FSAsRoot):
4cd9fd
             self.assertEqual(an_fs._size, ACTUAL_SIZE)
4cd9fd
             self._test_sizes(an_fs)
4cd9fd
 
4cd9fd
-            self._remove_partition(part, disk)
4cd9fd
+            # and no errors should occur when checking
4cd9fd
+            self.assertIsNone(an_fs.do_check())
4cd9fd
 
4cd9fd
-        # and no errors should occur when checking
4cd9fd
-        self.assertIsNone(an_fs.do_check())
4cd9fd
+            self._remove_partition(part, disk)
4cd9fd
 
4cd9fd
     def test_shrink(self):
4cd9fd
         self.skipTest("Not checking resize for this test category.")
4cd9fd
-- 
4cd9fd
2.26.2
4cd9fd
4cd9fd
4cd9fd
From 2a6947098e66f880193f3bac2282a6c7857ca5f7 Mon Sep 17 00:00:00 2001
4cd9fd
From: Vojtech Trefny <vtrefny@redhat.com>
4cd9fd
Date: Thu, 16 Jul 2020 09:05:35 +0200
4cd9fd
Subject: [PATCH 4/4] Use xfs_db in read-only mode when getting XFS information
4cd9fd
4cd9fd
This way it will also work on mounted filesystems.
4cd9fd
---
4cd9fd
 blivet/tasks/fsinfo.py | 2 +-
4cd9fd
 1 file changed, 1 insertion(+), 1 deletion(-)
4cd9fd
4cd9fd
diff --git a/blivet/tasks/fsinfo.py b/blivet/tasks/fsinfo.py
4cd9fd
index af208f5d..41ff700f 100644
4cd9fd
--- a/blivet/tasks/fsinfo.py
4cd9fd
+++ b/blivet/tasks/fsinfo.py
4cd9fd
@@ -95,7 +95,7 @@ class ReiserFSInfo(FSInfo):
4cd9fd
 
4cd9fd
 class XFSInfo(FSInfo):
4cd9fd
     ext = availability.XFSDB_APP
4cd9fd
-    options = ["-c", "sb 0", "-c", "p dblocks", "-c", "p blocksize"]
4cd9fd
+    options = ["-c", "sb 0", "-c", "p dblocks", "-c", "p blocksize", "-r"]
4cd9fd
 
4cd9fd
 
4cd9fd
 class UnimplementedFSInfo(fstask.UnimplementedFSTask):
4cd9fd
-- 
4cd9fd
2.26.2
4cd9fd