Bug 1460592 - [WALA] /etc/resolv.conf is removed while create a VM base on a specialized image
[WALA] /etc/resolv.conf is removed while create a VM base on a specialized image
Status: CLOSED CURRENTRELEASE
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: WALinuxAgent (Show other bugs)
7.4
x86_64 Linux
medium Severity medium
: rc
: ---
Assigned To: Vitaly Kuznetsov
Virtualization Bugs
: Extras
Depends On: 1451172
Blocks: 1460616
  Show dependency treegraph
 
Reported: 2017-06-12 02:38 EDT by yuxisun@redhat.com
Modified: 2017-07-24 05:32 EDT (History)
12 users (show)

See Also:
Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1460616 (view as bug list)
Environment:
Last Closed: 2017-07-24 05:32:06 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Github Azure/WALinuxAgent/issues/754 None None None 2017-06-12 02:38 EDT

  None (edit)
Description yuxisun@redhat.com 2017-06-12 02:38:34 EDT
Description of problem:
When we create a VM base on a specialized image, the /etc/resolv.conf file will be removed and cannot be generated only if restart network or reboot.

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

RHEL Version:
RHEL-7.4/6.9

How reproducible:
100%

Steps to Reproduce:
1. Prepare a running VM in Azure. Capture it as a specialized image.
2. Create a VM base on this image.
3. Check /etc/resolv.conf
4. Check /var/log/waagent.log and /var/log/messages

Actual results:
The /etc/resolv.conf doesn't exist.

Expected results:
The /erc/resolv.conf exists.

/var/log/messages:
Jun  8 13:25:26 wala74fips python: 2017/06/08 13:25:26.019325 WARNING VM is provisioned, but the VM unique identifier has changed -- clearing cached state
Jun  8 13:25:26 wala74fips python: WARNING! Cached DHCP leases will be deleted.
Jun  8 13:25:26 wala74fips python: WARNING! /etc/resolv.conf will be deleted.

Additional info:

1. Root cause is when creating a VM and the /var/lib/waagent/provisioned file exists, wala runs "deprovision_handler.run_changed_unique_id()", it calls "del_resolv"(Line#212 in pa/deprovision/default.py), which will delete the /etc/resolv.conf.
    In my opinion, when we create a new VM, the /etc/resolv.conf will be regenerated my dhclient script or NetworkManager.

2. The WARNING logs "WARNING! Cached DHCP leases will be deleted.", "WARNING! /etc/resolv.conf will be deleted." are only printed in /var/log/messages but not in /var/log/waagent.log. We'd better also print them in /var/log/waagent.log.
Comment 2 Mohammed Gamal 2017-06-22 07:39:00 EDT
Fixed upstream. Not yet released
See: https://github.com/Azure/WALinuxAgent/pull/776
Comment 3 Mohammed Gamal 2017-06-23 04:43:25 EDT
v2.2.14 now released containing the fix
https://github.com/Azure/WALinuxAgent/releases/tag/v2.2.14
Comment 4 yuxisun@redhat.com 2017-06-26 05:21:47 EDT
Verify in WALinuxAgent-2.2.14-1.el7
RHEL version: RHEL-7.4-20170621.0
Result: Issue 1(remove /etc/resolv.conf issue) is passed.
        Issue 2(print WARNING logs into /var/log/waagent.log) is failed

Steps:
1. Prepare a running VM in Azure. Capture it as a specialized image.
2. Create a VM base on this image.
3. Check /etc/resolv.conf
4. Check /var/log/waagent.log and /var/log/messages

Actual result:
1. /etc/resolv.conf is not removed.
2. The "WARNING! Cached DHCP leases will be deleted." message only exists in /var/log/messages but not in /var/log/waagent.log
Comment 5 yuxisun@redhat.com 2017-07-24 05:32:06 EDT
Close this issue because WALinuxAgent-2.2.14-1.el7/6 has shipped.

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