Hide Forgot
Description of problem: If set resource disk file system as "xfs", the waagent fails to run "swapon" to the swapfile. "ERROR Result:swapon: /mnt/resource/swapfile: swapon failed: Invalid argument" Version-Release number of selected component (if applicable): WALinuxAgent-2.2.0 RHEL Version: RHEL-7.3-20161005.0 How reproducible: 100% Steps to Reproduce: 1. Prepare a VM with WALA-2.2.0 installed on ASM mode. 2. Set "ResourceDisk.Filesystem=xfs" in the /etc/waagent.conf 3. Deprovision. Shutdown this VM. Capture a generalized image from this VM. 4. Create a new VM base on this image. 5. Check swapsize # free -m Actual Result: swapsize is 0. Fail to enable swap. /var/log/waagent.log: 2016/10/14 15:39:39.144948 VERBOSE run cmd 'mkfs.xfs /dev/sdb1 -f' 2016/10/14 15:39:39.743088 VERBOSE run cmd 'mount /dev/sdb1 /mnt/resource' 2016/10/14 15:39:40.162923 INFO Resource disk /dev/sdb is mounted at /mnt/resource with xfs 2016/10/14 15:39:40.199074 INFO Enable swap 2016/10/14 15:39:40.203751 VERBOSE run cmd 'swapon -s' 2016/10/14 15:39:40.267425 INFO Create swap file 2016/10/14 15:39:40.272537 VERBOSE run cmd 'umask 0077 && fallocate -l 2147483648 '/mnt/resource/swapfile'' 2016/10/14 15:39:40.390053 VERBOSE run cmd 'mkswap /mnt/resource/swapfile' 2016/10/14 15:39:40.475485 VERBOSE run cmd 'swapon /mnt/resource/swapfile' 2016/10/14 15:39:40.560859 ERROR run cmd 'swapon /mnt/resource/swapfile' failed 2016/10/14 15:39:40.568498 ERROR Error Code:255 2016/10/14 15:39:40.591525 ERROR Result:swapon: /mnt/resource/swapfile: swapon failed: Invalid argument 2016/10/14 15:39:40.647574 ERROR Failed to enable swap (000005)/mnt/resource/swapfile Expect Result: Can enable swap in xfs file system. Additional Info: The fallocate does not physically allocate the space -- but swapon syscall requires a real space. (https://bugzilla.redhat.com/show_bug.cgi?id=1129205#c3) So for xfs file system, perhaps we have to use "dd" instead of "fallocate". I tried "dd" then run "swapon" and it works well in xfs file system.
Verified in WALinuxAgent-2.2.2 upstream. Result: PASS
Change the status to "POST" for developers to add it into ERRATA.