Comment 6 for bug 1843334

Revision history for this message
Marat Salakhutdinov (maratsal) wrote :

I was thinking that problem in this line - https://github.com/cloud-init/cloud-init/blob/fa47d527a03a00319936323f0a857fbecafceaf7/cloudinit/sources/DataSourceCloudStack.py#L222

That the problem with dhcp.networkd_get_option_from_leases('SERVER_ADDRESS') where we don't specify location of the leases and it defaults to one specified here https://github.com/cloud-init/cloud-init/blob/fa47d527a03a00319936323f0a857fbecafceaf7/cloudinit/net/dhcp.py#L24 and because of that this function cannot return VR IP correctly.

Then it falls to the second part of the function code https://github.com/cloud-init/cloud-init/blob/fa47d527a03a00319936323f0a857fbecafceaf7/cloudinit/sources/DataSourceCloudStack.py#L234-L246 and it fails to get DHCP server address as it is looking for match "dhcp-server-identifier" and not "SERVER_ADDRESS" and as the result it posts error message (part of the code I linked to above) to the logs:
2019-09-10 20:00:40,693 - DataSourceCloudStack.py[DEBUG]: No DHCP found, using default gateway

However after using your suggestion it works. So the name of the service is NetworkManager.service:

[root@centos-host ~]# systemctl status NetworkManager
● NetworkManager.service - Network Manager
   Loaded: loaded (/usr/lib/systemd/system/NetworkManager.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2019-09-10 16:00:38 EDT; 19h ago
     Docs: man:NetworkManager(8)
 Main PID: 687 (NetworkManager)
    Tasks: 3 (limit: 5033)
   Memory: 9.2M
   CGroup: /system.slice/NetworkManager.service
           └─687 /usr/sbin/NetworkManager --no-daemon
.....
[root@centos-host ~]#

And after trying your suggestion to start cloud-init after NetworkManager it worked fine.

[root@centos-host cca-user]# cat /etc/systemd/system/cloud-init.service.d/10-nm.conf
[Unit]
After=NetworkManager.service
[root@centos-host cca-user]#

Thanks for finding solution!