PR#3504: kojivmd: narrow error handling for missing VMs

Merges #3504
https://pagure.io/koji/pull-request/3504
This commit is contained in:
Tomas Kopecek 2022-09-16 09:04:33 +02:00
commit 041bbc3502

View file

@ -1033,11 +1033,14 @@ class VMTaskManager(TaskManager):
vm_name = task_info['request'][0]
try:
self.libvirt_conn.lookupByName(vm_name)
except libvirt.libvirtError:
# if this builder does not have the requested VM,
# we can't handle the task
self.logger.debug('VM %s not available, ignoring task %i', vm_name, task['id'])
return False
except libvirt.libvirtError as e:
if e.get_error_code() == libvirt.VIR_ERR_NO_DOMAIN:
# if this builder does not have the requested VM,
# we can't handle the task
self.logger.debug('VM %s not available, ignoring task %i', vm_name, task['id'])
return False
else:
raise
return super(VMTaskManager, self).takeTask(task)
def cleanupVM(self, vm_name):