only claim vmExec tasks if the requested VM is available on the current host
This commit is contained in:
parent
123f007e51
commit
63f0d357a3
1 changed files with 16 additions and 0 deletions
16
vm/kojivmd
16
vm/kojivmd
|
|
@ -781,6 +781,22 @@ class VMTaskManager(TaskManager):
|
|||
"""See if we have enough space to accept another job"""
|
||||
return self.checkDisk() and self.checkMem()
|
||||
|
||||
def takeTask(self, task):
|
||||
"""
|
||||
Verify that this builder can handle the task before claiming it.
|
||||
"""
|
||||
if task['method'] == 'vmExec':
|
||||
task_info = self.session.getTaskInfo(task['id'], request=True)
|
||||
vm_name = task_info['request'][0]
|
||||
try:
|
||||
vm = 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
|
||||
return super(VMTaskManager, self).takeTask(task)
|
||||
|
||||
def cleanupVM(self, vm_name):
|
||||
"""
|
||||
Cleanup a single VM with the given name.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue