Manually set Cloud-init `instance_id` doesn't work

May 20, 2017
185
20
83
Netherlands
cyberfusion.io
There's a known issue (https://bugzilla.proxmox.com/show_bug.cgi?id=1739) where "each time you update the cloud-init configuration, or manualy regenerate the image, the instance-id is changed."

To ensure that `instance_id` never changes again unless we explicitly do so—the only 'foolproof' solution—we have chosen to write meta-configs with a self-generated `instance_id`. This advice is also given in a number of forum posts and in the bug tracker.

However, that does not work. Here is an example VM (236). You can see that `cicustom` contains the meta-config, and it contains an `instance-id`, but it is not picked up.

Code:
root@pve-test:/mnt/pve/CIFS_Test# pvesh get /nodes/pve-test/qemu/236/cloudinit
┌────────────┬────────┬───────────────────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────────────────────────────────────────────────
│ key        │ delete │ pending                                                               │ value
╞════════════╪════════╪═══════════════════════════════════════════════════════════════════════╪════════════════════════════════════════════════════════════════════════════════════════════════════════
│ cicustom   │        │                                                                       │ meta=CIFS_Test:snippets/2-236-meta.yaml,user=CIFS_Test:snippets/2-236.yaml,vendor=CIFS_Test:snippets/ve
├────────────┼────────┼───────────────────────────────────────────────────────────────────────┼────────────────────────────────────────────────────────────────────────────────────────────────────────
│ nameserver │        │ 2a0c:eb00:0:f7::38 2a0c:eb00:0:f7::39 185.233.175.229 185.233.175.243 │
└────────────┴────────┴───────────────────────────────────────────────────────────────────────┴────────────────────────────────────────────────────────────────────────────────────────────────────────

root@pve-test:/mnt/pve/CIFS_Test# cat snippets/2-236-meta.yaml
#cloud-config
instance-id: 579229cbcd5cb55cdff9cdc1539d48931f1d7723

root@pve-test:/mnt/pve/CIFS_Test# qm cloudinit dump 236 meta
instance-id: 6e94e23bd69a9c5268d9dadd6b484543d4f117a2


I'm going to look into this further. But does anyone see/understand what is going wrong here?
 
The dump option only has a view into internal PVE CI, it does not reflect custom configuration.
Booting your VM is the best way to check whether the ID was applied, and if it was not - check ci log inside the VM.
Cheers,


Blockbridge : Ultra low latency all-NVME shared storage for Proxmox - https://www.blockbridge.com/proxmox

Well, life can be so simple sometimes. Can confirm my instance ID is in fact used, based on `/run/cloud-init/.instance-id`. I'll add to the tracker that this behaviour is not really intuitive. Thanks again!
 
  • Like
Reactions: bbgeek17
I'll add to the tracker that this behaviour is not really intuitive.
The man page does call it it out:
Code:
       qm cloudinit dump <vmid> <type>

       Get automatically generated cloudinit config.

       <vmid>: <integer> (100 - 999999999)
           The (unique) ID of the VM.

       <type>: <meta | network | user>
           Config type.

Automatic=built-in


Blockbridge : Ultra low latency all-NVME shared storage for Proxmox - https://www.blockbridge.com/proxmox