HA - backup mode stop

theheavy

New Member
Jun 3, 2020
2
0
1
42
Hi folks,

I was wondering if there is any way to perform a 'stop' mode backup at HA controlled VMs or if anyone has a sweet solution for this.

Cannot execute a backup with stop mode on a HA managed and enabled Service. Use snapshot mode or disable the Service.

This is the regular status failed message.

The only way to prevent this as far as i know, would be removing the vm out of the HA configuration, perform the backup and add the vm to the HA config again.
Is there a CLI tool or do I have to use the pvesh for scripting?

Thanks in advance!
 
Hi,
the rationale behind this is that a HA managed enabled service is not allowed to be stopped except by the HA manager itself. It should be possible to get a working script with CLI tools, maybe something like:
  1. Request shutdown with HA ha-manager set vm:<ID> --state stopped
  2. Loop and wait till the service is stopped by checking the output of either qm status <ID> or ha-manager status
  3. Run vzdump
  4. Request start with HA ha-manager set vm:<ID> --state started
 
Hi,
that's totally reasonable from the HA manager perspective.

Thanks a lot for the hints and the ha-manager cli tool definetly helped heaps. I tested your approach but tbh it's a bit too much detailed work to keep the VMID.conf files updated with the hook scripts, checking the loop and so on.

As we have static backup windows from e.g. 04:00 to 05:00ish, I will do something like this:

1. 03:50, remove all the VMs out of the HA group
2. backing up all the vms, configured by the UI
3. 05:00, adding all the VMs to the HA group

I lose 1h of the HA safety net but can still configure backup tasks at one place using the UI.


For step 1. i parse all the needed VMs out of vzdump.cron, this won't work for the "all" setting but that's another days problem.

Bash:
havms=`grep ^"0 4" /etc/pve/vzdump.cron | awk -F "--" '{print $1}' | awk -F "vzdump" '{printf $2}'`

for i in ${havms}; do

ha-manager remove vm:${i}

done
 
I noticed that you can use suspend but not stop when an LXC container is configured as HA.

I think this might be a bit short sighted because I can manually right click on that LXC container and select stop and it will do this:

HA 110 - Stop
CT 110 - Stop

at this point I can do a stop mode backup.

then I just have to right click on that same LXC container and select start.

I think when your configuring your scheduled backups and you select stop as your backup mode the script should be able to do what I am able to do manually with a couple clicks, suspend mode backups work but there can possibly be issues with them and stopping the container first ensures a trouble free backup.
 
Last edited:

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!