As we are backing up a bunch of VMs, there's some chance that one of them might be removed between the time we list all
the VMs and the time we do a backup of that one, ex:
Mar 09 02:54:33 cloudvirt1024 wmcs-backup[55819]: INFO:[2021-03-09 02:54:33,369] Creating backup for vm k8splay.gitlab(f807b6cc-621d-4a17-8b00-58e93b2329d7) Mar 09 02:54:33 cloudvirt1024 wmcs-backup[55819]: INFO:[2021-03-09 02:54:33,369] Forcing a full backup as there's no previous one with a snapshot. Mar 09 02:54:33 cloudvirt1024 wmcs-backup[55819]: INFO:[2021-03-09 02:54:33,369] Creating full backup of pool:eqiad1-compute, image_name:f807b6cc-621d-4a17-8b00-58e93b2329d7_disk, snapshot_name:2021-03-09T02:54:33_cloudvirt1024 Mar 09 02:54:33 cloudvirt1024 wmcs-backup[55819]: rbd: error opening image f807b6cc-621d-4a17-8b00-58e93b2329d7_disk: (2) No such file or directory Mar 09 02:54:33 cloudvirt1024 wmcs-backup[55819]: Traceback (most recent call last): Mar 09 02:54:33 cloudvirt1024 wmcs-backup[55819]: File "/usr/local/sbin/wmcs-backup", line 2012, in <module> Mar 09 02:54:33 cloudvirt1024 wmcs-backup[55819]: args.func() Mar 09 02:54:33 cloudvirt1024 wmcs-backup[55819]: File "/usr/local/sbin/wmcs-backup", line 1847, in <lambda> Mar 09 02:54:33 cloudvirt1024 wmcs-backup[55819]: ).backup_assigned_vms(from_cache=args.from_cache, noop=args.noop) Mar 09 02:54:33 cloudvirt1024 wmcs-backup[55819]: File "/usr/local/sbin/wmcs-backup", line 1312, in backup_assigned_vms Mar 09 02:54:33 cloudvirt1024 wmcs-backup[55819]: noop=noop, Mar 09 02:54:33 cloudvirt1024 wmcs-backup[55819]: File "/usr/local/sbin/wmcs-backup", line 1121, in create_vm_backup Mar 09 02:54:33 cloudvirt1024 wmcs-backup[55819]: vm_info=vm_info, noop=noop Mar 09 02:54:33 cloudvirt1024 wmcs-backup[55819]: File "/usr/local/sbin/wmcs-backup", line 1030, in create_vm_backup Mar 09 02:54:33 cloudvirt1024 wmcs-backup[55819]: new_backup = self.vms_backups[vm_id].create_next_backup(noop=noop) Mar 09 02:54:33 cloudvirt1024 wmcs-backup[55819]: File "/usr/local/sbin/wmcs-backup", line 709, in create_next_backup Mar 09 02:54:33 cloudvirt1024 wmcs-backup[55819]: noop=noop, Mar 09 02:54:33 cloudvirt1024 wmcs-backup[55819]: File "/usr/local/sbin/wmcs-backup", line 591, in create_full_backup Mar 09 02:54:33 cloudvirt1024 wmcs-backup[55819]: noop=noop, Mar 09 02:54:33 cloudvirt1024 wmcs-backup[55819]: File "/usr/lib/python3/dist-packages/rbd2backy2.py", line 190, in create_full_backup Mar 09 02:54:33 cloudvirt1024 wmcs-backup[55819]: noop=noop, Mar 09 02:54:33 cloudvirt1024 wmcs-backup[55819]: File "/usr/lib/python3/dist-packages/rbd2backy2.py", line 91, in create Mar 09 02:54:33 cloudvirt1024 wmcs-backup[55819]: run_command([RBD, "snap", "create", str(new_snapshot)], noop=noop) Mar 09 02:54:33 cloudvirt1024 wmcs-backup[55819]: File "/usr/lib/python3/dist-packages/rbd2backy2.py", line 31, in run_command Mar 09 02:54:33 cloudvirt1024 wmcs-backup[55819]: output = subprocess.check_output(args).decode("utf8") Mar 09 02:54:33 cloudvirt1024 wmcs-backup[55819]: File "/usr/lib/python3.7/subprocess.py", line 395, in check_output Mar 09 02:54:33 cloudvirt1024 wmcs-backup[55819]: **kwargs).stdout Mar 09 02:54:33 cloudvirt1024 wmcs-backup[55819]: File "/usr/lib/python3.7/subprocess.py", line 487, in run Mar 09 02:54:33 cloudvirt1024 wmcs-backup[55819]: output=stdout, stderr=stderr) Mar 09 02:54:33 cloudvirt1024 wmcs-backup[55819]: subprocess.CalledProcessError: Command '['/usr/bin/rbd', 'snap', 'create', 'eqiad1-compute/f807b6cc-621d-4a17-8b00-58e93b2329d7_disk@2021-03-09T02:54:33_cloudvirt1024']' returned non-zero exit status 2.
That makes the service crash and stop, while it would be better to just ignore and continue (in the case the VM is
deleted).
This task is to come up with a good solution and implement it.