Skip to content

Commit 41a644b

Browse files
author
Riccardo Capecchi
committed
Added support to the resize of a logical volume with swap
1 parent 879c4bd commit 41a644b

File tree

1 file changed

+5
-0
lines changed
  • lib/puppet/provider/logical_volume

1 file changed

+5
-0
lines changed

lib/puppet/provider/logical_volume/lvm.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
:lvextend => 'lvextend',
77
:lvs => 'lvs',
88
:resize2fs => 'resize2fs',
9+
:mkswap => 'mkswap',
10+
:swapoff => 'swapoff',
11+
:swapon => 'swapon',
912
:umount => 'umount',
1013
:blkid => 'blkid',
1114
:dmsetup => 'dmsetup',
@@ -188,6 +191,8 @@ def size=(new_size)
188191
resize2fs( path) || fail( "Cannot resize file system to size #{new_size} because resize2fs failed." )
189192
elsif blkid_type =~ /\bTYPE=\"(xfs)\"/
190193
xfs_growfs( path) || fail( "Cannot resize filesystem to size #{new_size} because xfs_growfs failed." )
194+
elsif blkid_type =~ /\bTYPE=\"(swap)\"/
195+
swapoff( path) && mkswap( path) && swapon( path) || fail( "Cannot resize swap to size #{new_size} because mkswap failed." )
191196
end
192197

193198
end

0 commit comments

Comments
 (0)