-
Notifications
You must be signed in to change notification settings - Fork 276
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add swap support. #109
Add swap support. #109
Conversation
|
@ckoenig thanks for the contribution! Could you please squash this down to a single commit? |
|
No problem, now as a single commit. |
| exec { "swapon for '${mount_title}'": | ||
| path => [ '/bin', '/usr/bin', '/sbin' ], | ||
| command => "swapon ${lvm_device_path}", | ||
| unless => "grep `readlink -f ${lvm_device_path}` /proc/swaps", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could use swapon -s | grep ${mount_title} for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, sorry, but that doesn't really work in my case. It looks like this:
- ${lvm_device_path} = ${mount_title} = /dev/vg0/swap, which is a link to /dev/dm-2
- The output of
swapon -slists /dev/mapper/vg0-swap, which is also a link to /dev/dm-2 - The output of
cat /proc/swapslists /dev/dm-2
So in order to use the output of swapon -s we either have to extract the device and follow its redirect with readlink -f and do the same for ${lvm_device_path} to make the comparison work, or we adjust the way the device path is built. At the moment ${lvm_device_path} reflects the logic, which was used up until now and sets the path to /dev/${volume_group}/${name}. Instead of that we could probably use /dev/mapper/${volume_group}-${name}. That would make the comparison of the output of swapon -s easier.
Is there any specific problem with my approach, which doesn't occur with your proposed alternative?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense 👍
|
👍 thanks! |
Add swap support.
This pull request is based on #57 / #89, which wasn't merged.
It would be great, if you could have another look at this pull request.