[Feature] Migrate templates while performing a rolling update
Describe the feature
Provide a checkbox which allows the migration of templates during a rolling update cycle.
Use Case
Templates are unavailable while performing a rolling release update, once that specified host is down, this while we are busy with templates sometimes during maintenance schedule, as maintenance windows are brief and we try to perform as much as possibly can be scheduled in them.
Alternatives considered
Copying them manually works, but it would be convenient if this could be done automatically
How important is this for you?
Nice to have
Checklist
- [X] I have searched existing issues and discussions to make sure this hasn't been requested before
Noted — a checkbox to also move templates during a rolling update is a sensible ask, we'll keep it on the list. (No promises on timing, but it's a reasonable gap.) We run on donations if you'd like to chip in: https://opencollective.com/pegaprox
Not built yet, but I went and found out why it happens, which was not written down anywhere.
Evacuation picks the guests to move with this filter:
node_vms = [vm for vm in vms
if vm.get('node') == node_name
and vm.get('status') == 'running'
and vm.get('type') in ('qemu', 'lxc')]
A template is never running - it has no runtime state to have - so it is not excluded by an explicit decision about templates, it simply never enters the list. That also explains why nothing warns you: from the evacuation's point of view the node is empty once the guests are off it, and your templates go down with the host.
So the checkbox is the right shape, but the work behind it is not a one-line filter change: a template cannot be live-migrated, it needs an offline migration, which is a different call with different failure modes (target storage has to hold the disk, the move is a copy rather than a handover, and it takes as long as the disk is big - inside a maintenance window that matters). It also needs a decision on what happens when the offline move fails halfway through a rolling update: block the node's reboot, or carry on and leave that template where it is.
I listed this as a small one in an internal sweep earlier today and that was wrong - correcting it here rather than leaving you with an over-optimistic impression. It is a real gap with a clear cause and it is worth doing properly, just not in the same pass as a couple of one-file changes.
Rolling updates now have an option to move templates along with the evacuation: with it on, a node's templates are migrated offline after the running guests, only to a node that has every storage their disks use, and a template that cannot move is listed with the reason without failing or pausing the run. The same option is available for scheduled rolling updates and in the node maintenance dialog. This ships in 1.3.0.
A tip on https://opencollective.com/pegaprox helps us keep fixing things like this.
Marcus