Virtual machines (VMs) on XCP-ng can be easily made to auto-start through the very friendly XCP-ng Center interface. This is great for building resilient services that restart themselves after for example a power failure. However, there is a flaw in XCP-ng Center where setting the VMs to autostart will not have the intended effect because the pool itself will not automatically be set to autostart.

For a fresh install of the XCP-ng hypervisor, the following procedure to turn on autostart for the pool has to be performed before the autostart feature on each of the pool’s VMs can work.

To begin, first obtain the pool UUID using the xe pool-list command.

[16:49 myxcp ~]# xe pool-list
uuid ( RO)                : f24c10d7-6708-4e9b-9097-142fbd8a8cc7
          name-label ( RW): 
    name-description ( RW): 
              master ( RO): c379935a-8867-4a64-8787-521322275329
          default-SR ( RW): <not in database>

If this is a freshly installed pool, the following command will turn up blank because there is no auto_poweron setting configured yet.

xe pool-param-list uuid=f24c10d7-6708-4e9b-9097-142fbd8a8cc7 | grep auto_poweron

Configure the pool parameter such that the pool can autostart.

xe pool-param-set uuid=f24c10d7-6708-4e9b-9097-142fbd8a8cc7 other-config:auto_poweron=true

Observe that auto_poweron is now visible in the pool param list.

xe pool-param-list uuid=f24c10d7-6708-4e9b-9097-142fbd8a8cc7 | grep auto_poweron
[16:54 myxcp ~]# xe pool-param-list uuid=f24c10d7-6708-4e9b-9097-142fbd8a8cc7 | grep auto_poweron
                    other-config (MRW): auto_poweron: true; memory-ratio-hvm: 0.25; memory-ratio-pv: 0.25

An alternative to using command line options to turn on the pool autostart feature is to instead use XOA to set each required VM to autostart. XOA will automatically set the pool to autostart while configuring each VM to autostart.