[CLOUDINIT] network config is being saved in the config drive but its not being applied.



  • I'm currently using the templates given by Hub but was wondering why they won't take the settings I'm putting in the network config drive box?

    It's mentioned that I need the nocloud datasource for it to work, but user-data uses cloud-config. I tried to run dpkg-reconfigure and enabled no-cloud as well but nothing changed.

    I followed this guide as well but still the same issue.

    https://xen-orchestra.com/blog/debian-cloud-template-for-xenserver/
    https://xen-orchestra.com/blog/centos-cloud-template-for-xenserver/

    Sample of the config I'm using:

    network:
    version: 1
    config:

    • type: physical
      name: eth0
      subnets:
      • type: static
        address: 10.1.xx.xx/24
        gateway: 10.1.xx.x
      • type: nameserver:
        address:

  • XCP-ng Team

    Hi!

    You are right, our templates are right now not compatible with network config, because of cloud config drive instead of the right one

    @fohdeesha might be able to assist here 🙂



  • @olivierlambert Perfect thank you. To reiterate one of my statements the user data box uses the Open Stack Cloud Drive option. For now I will try and see if by putting run commands on the user data box I can rewrite the network configuration on the vms.


  • XCP-ng Team

    It should present an openstack config drive type, and a nocloud config drive type, your cloud-init settings should be set to use nocloud first, and it will have both your settings from the network box, as well as from the user-data box. This is the config template I use:

      version: 1
      config:
        - type: physical
          name: eth0
          subnets:
            - type: static
              address: 192.168.1.40/24
              gateway: 192.168.1.1
    

    Note that cloud-init will not overwrite and replace any existing network settings in the vm (like in /etc/network/interfaces), it only appends whatever settings you add to the existing settings by placing a file in /etc/network/interfaces.d/ - I would see if you have anything here. I would also check /var/log/cloud-init.log to see if it's seeing and choosing the nocloud data source, and if not, why not. There is a currently a bug with the way OS recognizes the FAT volume label of the nocloud drive, this could be happening as well.



  • @fohdeesha Thank you for the input, we tried several different things but it seems that it might be the bug you mentioned at the end, and had everything just set with DHCP.

    Question though, for centos machine how would you go ahead and select the nocloud datasource as I didn't see that portion on the CENTOS guide?


  • XCP-ng Team

    I'm not sure, I have not used cloud-init in centos. I'd imagine it's similar, you need to find the cloud-init config file in your centos template install, and edit it to prefer the nocloud datasource


Log in to reply
 

XCP-ng Pro Support