#4311 kojivmd: refuse tasks instead of ignoring them
Merged 6 months ago by mikem. Opened 10 months ago by mikem.
mikem/koji vm-refusals  into  master

file modified
+1
@@ -1432,6 +1432,7 @@ 

              # we do not trap these

              raise

          except koji.tasks.RefuseTask as refuse:

+             self.logger.warning("Refusing task %s: %s", handler.id, str(refuse))

              self.session.host.refuseTask(handler.id, msg=str(refuse))

              return

          except koji.tasks.ServerRestart:

file modified
+3 -2
@@ -50,6 +50,7 @@ 

  from koji.tasks import (  # noqa: F401

      BaseTaskHandler,

      MultiPlatformTask,

+     RefuseTask,

      RestartTask,        # handle restarted vm tasks

      RestartVerifyTask,  # handle restarted vm tasks

      ServerExit,
@@ -1084,8 +1085,8 @@ 

                  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

+                     msg = 'VM %s not available' % vm_name

+                     raise RefuseTask(msg)

                  else:

                      raise

          return super(VMTaskManager, self).takeTask(task)

Chased down an issue where a host would not take a task, to find the reason hidden in a debug message. It makes more sense to use the refuse mechanism here, plus this will make it much easier to diagnose a similar problem in the future.

Fixes https://pagure.io/koji/issue/4312

Metadata Update from @tkopecek:
- Pull-request tagged with: testing-ready

10 months ago

Metadata Update from @tkopecek:
- Pull-request untagged with: testing-ready
- Pull-request tagged with: testing-basic

9 months ago

Metadata Update from @mfilip:
- Pull-request tagged with: testing-done

6 months ago

rebased onto 724dbe3

6 months ago

Commit c608307 fixes this pull-request

Pull-Request has been merged by mikem

6 months ago