Bug 1386494 - [WALA][RHEL-7] waagent fails to run "swapon" in xfs file system
Summary: [WALA][RHEL-7] waagent fails to run "swapon" in xfs file system
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: WALinuxAgent
Version: 7.3
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Miroslav Rezanina
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-10-19 05:56 UTC by Yuxin Sun
Modified: 2019-02-26 20:57 UTC (History)
10 users (show)

Fixed In Version: WALinuxAgent-2.2.4
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-03-07 08:51:59 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github Azure WALinuxAgent issues 468 0 None None None 2016-10-19 05:56:52 UTC

Description Yuxin Sun 2016-10-19 05:56:53 UTC
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.

Comment 1 Yuxin Sun 2016-12-15 11:06:07 UTC
Verified in WALinuxAgent-2.2.2 upstream. 
Result: PASS

Comment 2 Yuxin Sun 2017-03-06 03:16:14 UTC
Change the status to "POST" for developers to add it into ERRATA.


Note You need to log in before you can comment on or make changes to this bug.