Created cloud config, but can't select it when creating a new VM.

  • XCP-ng Team

    Keep us posted please 🙂

  • @olivierlambert
    I got it working by applying the diff you posted above. I edited the ds-identity file and added the fatboot label. I then added the datasource entries to cloud.cfg.

    I converted to a template and 1st bootup it updated automaticaly and ran everything I had already setup in the cloud.cfg.

    I would say that the blog post from December 2015 or the wiki needs to be updated with that new information. Also worth mentioning is that unless a network configuration is specified in the cloud.cfg file you need to add this snippet at the bottom so that any future customization of the network interfaces doesn't get wiped up by cloud-init:

      config: disabled

  • @MrMike could you please post the changes to ds-identity file? Also, I don't see the /usr/lib/cloud-init/ds-identify.ORIGINAL file. Is this something that gets created after the new VM is created?

  • @eperez539

    You need to add the following 2 lines to /usr/lib/cloud-init/ds-identify at or around line 245 if your file is different than mine.

             LABEL_FATBOOT=*) label="${line#LABEL_FATBOOT=}";

    The file diff /usr/lib/cloud-init/ds-identify.ORIGINAL is just a backup of the original file. You should do the same in case you need to roll back changes one day.

    Here's the end result in my file (see line 245 where I added the above):

        236     for line in "$@"; do
        237         case "${line}" in
        238             DEVNAME=*)
        239                 [ -n "$dev" -a "$ftype" = "iso9660" ] &&
        240                     isodevs="${isodevs},${dev}=$label"
        241                 ftype=""; dev=""; label="";
        242                 dev=${line#DEVNAME=};;
        243             LABEL=*) label="${line#LABEL=}";
        244                      labels="${labels}${line#LABEL=}${delim}";;
        245             LABEL_FATBOOT=*) label="${line#LABEL_FATBOOT=}";
        246                              labels="${labels}${line#LABEL_FATBOOT=}${delim}";;
        247             TYPE=*) ftype=${line#TYPE=};;
        248             UUID=*) uuids="${uuids}${line#UUID=}$delim";;
        249         esac
        250     done

  • @MrMike Great, thanks. I'll try this out.

  • @eperez539 good luck

  • @MrMike nope, not working.

    • Created VM
    • Installed guest-tools
    • Installed cloud init, cloud-initramfs-growroot
    • Updated /etc/cloud/cloud.cfg
    • Updated /usr/lib/cloud-init/ds-identify with lines given above
    • Created template
    • Created new vm from template using cloud init config on XO
    • New VM has nothing from the cloud init config...

    I could see how you could tweak the /etc/cloud/cloud.cfg with the users, etc. But cloud.cfg should have minimal settings on it. All the settings and configuration should come from the cloud init config in XO.

  • XCP-ng Team

    Check if you can read the config file in the extra disk while inside the VM. If yes, it's clearly a cloudinit config issue 🙂

  • @olivierlambert I see the drive attached to the new VM but it is not mounted. After mounting, I can see the contents of cloud-init config and everything looks ok unless I missed something:

    drwxr-xr-x  3 root root 16384 Jan  1  1970 ./
    drwxr-xr-x 24 root root  4096 May 22 18:58 ../
    -rwxr-xr-x  1 root root    50 May 22 18:54 meta-data*
    -rwxr-xr-x  1 root root   104 May 22 18:54 network-config*
    drwxr-xr-x  3 root root  2048 May 22 18:54 openstack/
    -rwxr-xr-x  1 root root   469 May 22 18:54 user-data*
    root@cloudbase:/mnt# cat user-data
    hostname: testingtheothertime0
    timezone: America/New_York
    package_update: true
    package_upgrade: true
      - htop
      - tree
      - vim
      - ffmpeg
      - content: |
        version: 2
        path: /etc/netplan/00-installer-config.yaml
      - [ netplan, apply ]
    root@cloudbase:/mnt# cat network-config
    #  version: 1
    #  config:
    #  - type: physical
    #    name: eth0
    #    subnets:
    #      - type: dhcproot@cloudbase:/mnt#
    root@cloudbase:/mnt# cat meta-data
    instance-id: 3824858a-0679-2863-5416-e03640479e8c

    From the cloud config, the packages were not installed. Also, tried the do the networking in different ways but nothing worked.

  • XCP-ng Team

    So double check cloudinit logs, so you'll know at boot what happened and why it didn't take your configuration into account

Log in to reply

XCP-ng Pro Support

XCP-ng Pro Support