Bug 1977216

Summary: [Azure][WALA][RHEL-9]swapfile size is incorrect if value is not integer multiple of 64M in ext4 filesystem
Product: Red Hat Enterprise Linux 9 Reporter: Yuxin Sun <yuxisun>
Component: WALinuxAgentAssignee: Vitaly Kuznetsov <vkuznets>
Status: CLOSED WONTFIX QA Contact: Yuxin Sun <yuxisun>
Severity: medium Docs Contact:
Priority: medium    
Version: 9.0CC: eterrell, virt-maint, vkuznets, xuli, yacao
Target Milestone: betaKeywords: Triaged
Target Release: ---Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1977215 Environment:
Last Closed: 2022-12-29 07:27:45 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1977215    
Bug Blocks:    

Description Yuxin Sun 2021-06-29 08:37:27 UTC
+++ This bug was initially created as a clone of Bug #1977215 +++

Description of problem:
In ext4 filesystem, if set the swapfile size as non-integer multiple of 64M(e.g. 1025), the actual swapfile size is 1024. The remaining sizes are not added.

Version-Release number of selected components (if applicable):
WALinuxAgent-2.3.0.2-1.el8.noarch.rpm

How reproducible:
100%

Steps to Reproduce:
1. Prepare a VM on Azure, install WALinuxAgent package
2. Modify /etc/waagent.conf:
ResourceDisk.EnableSwap=y
ResourceDisk.SwapSizeMB=1025
ResourceDisk.Filesystem=ext4
3. systemctl restart waagent.service
4. free -m

Actual results:
Swap:          1023

Expected results:
Swap:          1024

Additional info:
If enable verbose log we can see:
2021-06-29T07:24:18.819616Z INFO Daemon Daemon Create swap file
2021-06-29T07:24:18.820073Z VERBOSE Daemon Daemon Command: [umask 0077 && dd if=/dev/zero bs=67108864 count=16 conv=notrunc of='/mnt/resource/swapfile']
2021-06-29T07:24:20.011228Z VERBOSE Daemon Daemon Command: [umask 0077 && dd if=/dev/zero bs=1048576 count=1 conv=notrunc of='/mnt/resource/swapfile']
If run these 2 commands manually, the second command doesn't work.

Comment 6 RHEL Program Management 2022-12-29 07:27:45 UTC
After evaluating this issue, there are no plans to address it further or fix it in an upcoming release.  Therefore, it is being closed.  If plans change such that this issue will be fixed in an upcoming release, then the bug can be reopened.