Bug 1713618
| Summary: | [ESXi][RHEL 8.0]Cloud-init fails to set the default gateway on RHEL 8 | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 8 | Reporter: | Jaroslav Spanko <jspanko> |
| Component: | cloud-init | Assignee: | Eduardo Otubo <eterrell> |
| Status: | CLOSED CURRENTRELEASE | QA Contact: | ldu <ldu> |
| Severity: | high | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 8.0 | CC: | boyang, jgreguske, ldu, leiwang, pengpengs, ribarry, vmware-gos-qa, yacao, yujiang, yuxisun |
| Target Milestone: | rc | Keywords: | TestOnly |
| Target Release: | 8.0 | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | If docs needed, set a value | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2019-07-19 03:04:25 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
Jaroslav Spanko
2019-05-24 09:24:52 UTC
More information from customer tests
-----------------------
the default gateway is not set up because of the lack of the "PRIMARY" parameter:
/usr/lib/python3.6/site-packages/cloudinit/sources/helpers/vmware/imc/nic.py --> check if nic is PRIMARY (line 37)
/usr/lib/python3.6/site-packages/cloudinit/sources/helpers/vmware/imc/config_nic.py --> add default gw only if nic is promary (line 160)
to test it I simply added "PRIMARY = true" to the NIC session:
<...>
[ens224]
PRIMARY = true <---------------------------
MACADDR = 00:50:56:a2:61:41
<...>
and running the net_convert.py utility with the modified cust.cfg it creates the correct file with the gateway:
# Created by cloud-init on instance boot automatically, do not edit.
#
BOOTPROTO=none
DEFROUTE=yes
DEVICE=ens224
GATEWAY=192.168.160.1 <--------------
HWADDR=00:50:56:a2:47:c1
IPADDR=192.168.160.242
NETMASK=255.255.252.0
ONBOOT=yes
TYPE=Ethernet
USERCTL=no
only a test - it does not work for multi-nic setup
diff -Naur /usr/lib/python3.6/site-packages/cloudinit/sources/helpers/vmware/imc/config_nic.py.orig /usr/lib/python3.6/site-packages/cloudinit/sources/helpers/vmware/imc/config_nic.py
@@ -158,7 +158,7 @@
subnet.update({'netmask': v4.netmask})
# Add the primary gateway
- if nic.primary and v4.gateways:
+ if v4.gateways:
self.ipv4PrimaryGateway = v4.gateways[0]
subnet.update({'gateway': self.ipv4PrimaryGateway})
return ([subnet], route_list)
Now, with this change, I can provision a RHEL8 vm from a vmware template with all parameters correctly set up (gw included).
--------------------------------------
Adding more info from the latest customer test ---------------------- I confirm that the issue is related to the lack of compatibility between cloud-init 18.2 and vshere 6.5 "OS Guest customization" format (because of the lack of PRIOMARY parameter) . You can't use "OS Guest customization" (triggered by vmware tools) *and* cloud-init at the same time to post-configure a system. Removing cloud-init from my templates (I tried with both RHEL 7 and 8) I can successfully deploy VMs with a correct network setup (gateway included). -------------------------- Thank you Could reproduce on our test ENV. (In reply to Jaroslav Spanko from comment #4) > Adding more info from the latest customer test > ---------------------- > I confirm that the issue is related to the lack of compatibility between > cloud-init 18.2 and vshere 6.5 "OS Guest customization" format (because of > the lack of PRIOMARY parameter) . > You can't use "OS Guest customization" (triggered by vmware tools) *and* > cloud-init at the same time to post-configure a system. > > Removing cloud-init from my templates (I tried with both RHEL 7 and 8) I can > successfully deploy VMs with a correct network setup (gateway included). > -------------------------- > > Thank you Yes, this is due to lack of PRIMARY NIC parameter in the current vSphere6.5 Guest OS Customization specification. Without a primary NIC, static route but default gateway will be set. config_nic.py # Add routes if there is no primary nic if not self._primaryNic and v4.gateways: subnet.update( {'routes': self.gen_ipv4_route(nic, v4.gateways, v4.netmask)}) A fix is available on the next vSphere vCenter Server 6.5 update release and vSphere vCenter Server 6.7 Update 2 release. There will be PRIMARY NIC set when the NIC is the first NIC and also has a static IPv4 and a gateway configured. Details at "You cannot set a primary virtual NIC" in https://docs.vmware.com/en/VMware-vSphere/6.7/rn/vsphere-vcenter-server-67u2-release-notes.html Thanks, Pengpeng After upgrade the vCenter 6.7 update 2, The nmcli con show "System ens222" | grep -i GATEWAY had set gateway. So close this bug as current release. |