vzdump over ssh stop the VM

Inglebard

Renowned Member
May 20, 2016
109
7
83
33
Hi,

I create a simple script to backup proxmox vm over ssh with borg.
The script can be found here : https://github.com/Inglebard/probodo/blob/main/scripts/client/backupvm.example.sh

During my test, I forgot to open the ssh port to our backup server. Due to this mistake, the VM stop.

I suppose the issue come from this line :

Bash:
"/usr/bin/vzdump $VMID --compress 0 --mode snapshot --dumpdir /tmp --stdout --quiet | /usr/bin/borg create --stdin-name $BACKUP_NAME.vma --compression=lz4 --stats ssh://$SSH_USER@$SSH_IP:$SSH_PORT/home/$SSH_USER/backupproxmox::$BACKUP_NAME"

The backup start but the ssh was not "ready" and the following appear in the proxmox log :

Code:
Nov 18 14:24:05 proxmox pvestatd[1070]: VM 100 qmp command failed - VM 100 qmp command 'query-proxmox-support' failed - unable to connect to VM 100 qmp socket - timeout after 31 retries
Nov 18 14:24:15 proxmox pvestatd[1070]: VM 100 qmp command failed - VM 100 qmp command 'query-proxmox-support' failed - unable to connect to VM 100 qmp socket - timeout after 31 retries
Nov 18 14:24:16 proxmox pvestatd[1070]: status update time (6.347 seconds)
Nov 18 14:24:16 proxmox QEMU[1127]: kvm: ../block/io.c:477: bdrv_do_drained_end: Assertion `bs->quiesce_counter > 0' failed.
Nov 18 14:24:18 proxmox systemd[1]: 100.scope: Succeeded.
Nov 18 14:24:18 proxmox vzdump[29231]: VM 100 qmp command failed - VM 100 qmp command 'query-backup' failed - client closed connection
Nov 18 14:24:18 proxmox vzdump[29231]: VM 100 qmp command failed - VM 100 not running
Nov 18 14:24:18 proxmox vzdump[29231]: VM 100 qmp command failed - VM 100 not running
Nov 18 14:24:18 proxmox vzdump[29231]: ERROR: Backup of VM 100 failed - VM 100 not running

I would like to know if it is possible in this case to failed the vzdump command instead to stop the vm ? or maybe there is a better way to achieve this ?
 
My simple approach would be to test connectivity via ssh and start vzdump only if successful: ssh user@host "echo ok" && vzdump...

Of course there might be better solutions...

Best regards
 
Yes, I think of it, but I suppose the same issue happens if internet connectivity goes down during a backup.

I suppose it's require to set "ConnectTimeout","ClientAliveCountMax" and "ClientAliveInterval" ssh options to be safe.

However, the issue is not mention here and here. So I would like to know if it is a normal behavior or not ?