Bug 1428656

Summary: [WALA][RHEL-7] Sometimes waagent fails to mount the local disk partition
Product: Red Hat Enterprise Linux 7 Reporter: Yuxin Sun <yuxisun>
Component: WALinuxAgentAssignee: Vitaly Kuznetsov <vkuznets>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.3CC: ailan, borisb, jboutaud, jjarvis, johan.burati, leiwang, mheslin, mrezanin, tatanaka, tdrake, vkuznets, wshi, yujiang, yuxisun
Target Milestone: rcKeywords: Extras
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: WALinuxAgent-2.2.10-1.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-05-26 14:29:41 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:

Description Yuxin Sun 2017-03-03 03:34:57 UTC
Description of problem:
Sometimes the waagent mount the local disk partition (/dev/sdb1) before it exists, so that the mount is failed.
The error code of "mount: special device /dev/sdd1 does not exist" is 32, which is the same as "mount: /dev/sdb1 is already mounted" error code. As a result, the waagent regards the "device does not exist" as "already mounted" and create swap file directly even if the /dev/sdb1 is not mounted.

Version-Release number of selected component (if applicable):
WALinuxAgent-2.2.4-1

RHEL Version:
RHEL-7.3 on-demand image
kernel: 3.10.0-514.6.2.el7.x86_64

How reproducible:
30%

Steps to Reproduce:
1. Prepare a RHEL-7.3 VM(Standard_A1) with WALA-2.2.4-1 installed and enabled. Set "ResourceDisk.EnableSwap=y"
2. Reboot the VM.
3. After the VM is booted, check the swap and the mount status:
free -m
mount

Actual Result:
The swap size is 0. The local disk partition is not mounted.

Expect Result:
The local disk partition is mounted.

/var/log/waagent.log:
2017/03/02 11:40:45.629813 INFO Activate resource disk
2017/03/02 11:40:45.666904 INFO Examining partition table
2017/03/02 11:40:45.722347 INFO GPT not detected, determining filesystem
2017/03/02 11:40:45.749369 INFO sfdisk with --part-type failed [1], retrying with -c
2017/03/02 11:40:45.778195 INFO sfdisk -c -f /dev/sdb 1 succeeded
2017/03/02 11:40:45.778361 INFO The partition type is 83
2017/03/02 11:40:45.778469 INFO Mount resource disk [mount /dev/sdb1 /mnt/resource]
2017/03/02 11:40:45.808002 WARNING Resource disk is already mounted: mount: special device /dev/sdb1 does not exist

2017/03/02 11:40:45.808140 INFO Resource disk /dev/sdb is mounted at /mnt/resource with ext4
2017/03/02 11:40:45.810434 INFO Enable swap
2017/03/02 11:40:45.869825 INFO Create swap file
2017/03/02 11:40:46.141439 ERROR run cmd 'swapon /mnt/resource/swapfile' failed
2017/03/02 11:40:46.142272 ERROR Error Code:255
2017/03/02 11:40:46.142349 ERROR Result:swapon: /mnt/resource/swapfile: swapon failed: Invalid argument

2017/03/02 11:40:46.142457 ERROR Failed to enable swap (000005)/mnt/resource/swapfile

Additional Info:
1. I've rebooted 100 times on RHEL-7.3 and this issue occurs 30 times. I also tried 100 times on RHEL-6.9 and it is not observed.
2. It seems that only small size VM(like A1, A2, D1_v2) have this issue. In the large size(D5_v2) it isn't observed.

Comment 8 Johan Burati 2017-04-26 00:00:14 UTC
This problem is fixed in WALinuxAgent version 2.2.8

Ref: https://github.com/Azure/WALinuxAgent/pull/629

Comment 9 Johan Burati 2017-04-26 02:09:33 UTC
When does Red Hat plan to update the version of the package in the repo ?

Comment 10 Takayoshi Tanaka 2017-04-26 02:24:00 UTC
I found 2.2.10 seems to be the next version that Red Hat will release.
https://bugzilla.redhat.com/show_bug.cgi?id=1443425

Comment 11 Vitaly Kuznetsov 2017-04-26 09:09:37 UTC
Yes, please follow https://bugzilla.redhat.com/show_bug.cgi?id=1443425

Comment 13 Yuxin Sun 2017-04-28 07:26:07 UTC
Verify in WALA-2.2.10-1. 

Steps:
reboot VM 1000 times. This issue is not occurred.

Result: Pass

Comment 15 errata-xmlrpc 2017-05-26 14:29:41 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2017:1321