Skip to content

Commit 884e7d4

Browse files
committed
(MODULES-9004) Resize XFS file system by mount point, not by volume
1 parent d621bd9 commit 884e7d4

File tree

1 file changed

+6
-2
lines changed
  • lib/puppet/provider/logical_volume

1 file changed

+6
-2
lines changed

lib/puppet/provider/logical_volume/lvm.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
:blkid => 'blkid',
1616
:dmsetup => 'dmsetup',
1717
:lvconvert => 'lvconvert',
18-
:lvdisplay => 'lvdisplay'
18+
:lvdisplay => 'lvdisplay',
19+
:lsblk => 'lsblk'
1920

2021
optional_commands :xfs_growfs => 'xfs_growfs',
2122
:resize4fs => 'resize4fs'
@@ -240,7 +241,10 @@ def size=(new_size)
240241
elsif blkid_type =~ /\bTYPE=\"(ext[34])\"/
241242
resize2fs( path) || fail( "Cannot resize file system to size #{new_size} because resize2fs failed." )
242243
elsif blkid_type =~ /\bTYPE=\"(xfs)\"/
243-
xfs_growfs( path) || fail( "Cannot resize filesystem to size #{new_size} because xfs_growfs failed." )
244+
# New versions of xfs_growfs only support resizing by mount point, not by volume (e.g. under RHEL8)
245+
# * https://tickets.puppetlabs.com/browse/MODULES-9004
246+
mount_point = lsblk( '-o', 'MOUNTPOINT', '-nr', path).chomp
247+
xfs_growfs( mount_point) || fail( "Cannot resize filesystem to size #{new_size} because xfs_growfs failed." )
244248
elsif blkid_type =~ /\bTYPE=\"(swap)\"/
245249
swapoff( path) && mkswap( path) && swapon( path) || fail( "Cannot resize swap to size #{new_size} because mkswap failed." )
246250
end

0 commit comments

Comments
 (0)