Skip to content

Commit a397c1f

Browse files
committed
Merge pull request #136 from ricciocri/master
Added support to the resize of a logical volume with swap
2 parents f0d0789 + 41a644b commit a397c1f

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',
@@ -192,6 +195,8 @@ def size=(new_size)
192195
resize2fs( path) || fail( "Cannot resize file system to size #{new_size} because resize2fs failed." )
193196
elsif blkid_type =~ /\bTYPE=\"(xfs)\"/
194197
xfs_growfs( path) || fail( "Cannot resize filesystem to size #{new_size} because xfs_growfs failed." )
198+
elsif blkid_type =~ /\bTYPE=\"(swap)\"/
199+
swapoff( path) && mkswap( path) && swapon( path) || fail( "Cannot resize swap to size #{new_size} because mkswap failed." )
195200
end
196201

197202
end

0 commit comments

Comments
 (0)