Getting VMs to boot up automatically when an XCP host powers up is fairly easy but not entirely logical. With the old Xen we'd just copy the config file into /etc/xen/auto but XCP/Xenserver has no such directory. Using XCP/Xenserver you have to tell the pool to turn on auto_poweron and you also have to set it for the VM you want to autoboot as well.
1. Get the Pool UUID number
Use xe pool-list to get the UUID of the pool. We see the pool UUID is d47b4251-60bc-aa36-c572-c425fdc1b897.
[root@testcloud1 ~]# xe pool-list uuid ( RO) : d47b4251-60bc-aa36-c572-c425fdc1b897 name-label ( RW): name-description ( RW): master ( RO): c76a1ba7-8cdd-45a7-8399-38f242355a43 default-SR ( RW): 735f9d8e-64eb-71b7-9fd4-47c342c7c9e4
2. Set auto_poweron for the pool
To set the value of a pool parameter we'll use the xe pool-param-set. Use the pool UUID from the previous step here. We'll be setting the auto_poweron item of the other-config map parameter to true.
xe pool-param-set uuid=d47b4251-60bc-aa36-c572-c425fdc1b897 other-config:auto_poweron=true
3. Get the VM UUID number
Use xe vm-list to get the UUID of the VM you'd like to autoboot. We see the VM UUID is d2e81fdd-e2cd-b0db-8b0e-e280611eb446.
[root@testcloud1 ~]# xe vm-list uuid ( RO) : d2e81fdd-e2cd-b0db-8b0e-e280611eb446 name-label ( RW): CentOS6 power-state ( RO): halted
4. Set auto_poweron for the VM
To set the value of a VM parameter we'll use xe vm-param-set. Use the VM UUID from the previous step here. We'll be setting the auto_poweron item of the other-config map parameter to true.
xe vm-param-set uuid=d2e81fdd-e2cd-b0db-8b0e-e280611eb446 other-config:auto_poweron=true
5. Test
Test your work by rebooting the host.