On XenServer is there any way to read VM metadata (Custom fields, Tags, VM Name) from inside the VM using Linux (CentOS 5.8) ?
Basically what I want to do is:
Create new VM using
xe vm-install template=MYTEMPLATE new-name-label=MYVM
Read metadata to configure VM hostname, IP address, etc
On EC2 you can pass an user-data-file containing a script when you launch a new VM. Once the VM comes up the script is executed. Similar to this:
ec2-run-instances --key KEYPAIR --user-data-file CONFIGURE-SCRIPT ami-bf5eb9d6
I can pass some information to the VM using "OS boot parameters" inside "BOOT OPTIONS"
# cat /proc/cmdline
ro root=/dev/vg0/root console=xvc0 CUSTOMTEXT
This does not look very elegant to me and may interfere with some real Linux boot parameters. Another problem is that the CUSTOMTEXT will continue to be passed to the VM on every boot.
I just need a way to pass a few parameters once during VM creation and run a script that will use those parameters on first boot.
any ideas ?
cheers
Gustavo