diff --git a/daemons/ganeti-masterd b/daemons/ganeti-masterd index 5f512fdb685a5d6690b06af4a1db8347ca30a830..784a871786d0b9e19130c9423db85e545d0449d7 100755 --- a/daemons/ganeti-masterd +++ b/daemons/ganeti-masterd @@ -114,7 +114,7 @@ class MasterClientHandler(daemon.AsyncTerminatedMessageStream): self.server = server def handle_message(self, message, _): - self.server.request_workers.AddTask(self.server, message, self) + self.server.request_workers.AddTask((self.server, message, self)) class MasterServer(daemon.AsyncStreamServer): diff --git a/lib/jqueue.py b/lib/jqueue.py index 110109048d59fa75f72710f7b74dab6c46e2e6a4..0958798d0929359815635636ce354b9635876119 100644 --- a/lib/jqueue.py +++ b/lib/jqueue.py @@ -912,7 +912,7 @@ class JobQueue(object): status = job.CalcStatus() if status in (constants.JOB_STATUS_QUEUED, ): - self._wpool.AddTask(job) + self._wpool.AddTask((job, )) elif status in (constants.JOB_STATUS_RUNNING, constants.JOB_STATUS_WAITLOCK, @@ -1339,7 +1339,7 @@ class JobQueue(object): """ job_id = self._NewSerialsUnlocked(1)[0] - self._wpool.AddTask(self._SubmitJobUnlocked(job_id, ops)) + self._wpool.AddTask((self._SubmitJobUnlocked(job_id, ops), )) return job_id @locking.ssynchronized(_LOCK) diff --git a/lib/workerpool.py b/lib/workerpool.py index e1985beabd2ed5ec39b669da7e36e268c9feadcc..33ef9328aff9bb30cc71d2ff3c6a889982fcfe5f 100644 --- a/lib/workerpool.py +++ b/lib/workerpool.py @@ -189,9 +189,10 @@ class WorkerPool(object): # Notify a waiting worker self._pool_to_worker.notify() - def AddTask(self, *args): + def AddTask(self, args): """Adds a task to the queue. + @type args: sequence @param args: arguments passed to L{BaseWorker.RunTask} """ diff --git a/test/ganeti.workerpool_unittest.py b/test/ganeti.workerpool_unittest.py index cd15123d3c1c9ad3254d92128754aef7fd4722c9..586cc5e9f12fb38fa7c651cacb657314f0a13878 100755 --- a/test/ganeti.workerpool_unittest.py +++ b/test/ganeti.workerpool_unittest.py @@ -93,7 +93,7 @@ class TestWorkerpool(unittest.TestCase): self._CheckWorkerCount(wp, 3) for i in range(10): - wp.AddTask(ctx, "Hello world %s" % i) + wp.AddTask((ctx, "Hello world %s" % i)) wp.Quiesce() finally: @@ -133,7 +133,7 @@ class TestWorkerpool(unittest.TestCase): checksum = ChecksumContext.CHECKSUM_START for i in range(1, 100): checksum = ChecksumContext.UpdateChecksum(checksum, i) - wp.AddTask(ctx, i) + wp.AddTask((ctx, i)) wp.Quiesce() @@ -156,8 +156,8 @@ class TestWorkerpool(unittest.TestCase): self._CheckWorkerCount(wp, 3) wp.AddManyTasks([(ctx, "Hello world %s" % i, ) for i in range(10)]) - wp.AddTask(ctx, "A separate hello") - wp.AddTask(ctx, "Once more, hi!") + wp.AddTask((ctx, "A separate hello")) + wp.AddTask((ctx, "Once more, hi!")) wp.AddManyTasks([(ctx, "Hello world %s" % i, ) for i in range(10)]) wp.Quiesce() @@ -180,7 +180,7 @@ class TestWorkerpool(unittest.TestCase): [i for i in range(10)]) wp.AddManyTasks([(ctx, "Hello world %s" % i, ) for i in range(10)]) - wp.AddTask(ctx, "A separate hello") + wp.AddTask((ctx, "A separate hello")) wp.Quiesce() diff --git a/tools/move-instance b/tools/move-instance index 079a662102d495badb4066aeecf7314788e6c1a0..dda8798f7ed8d251b484a2b180b2e2706e01480a 100755 --- a/tools/move-instance +++ b/tools/move-instance @@ -819,7 +819,7 @@ def main(): try: # Add instance moves to workerpool for move in moves: - wp.AddTask(rapi_factory, move) + wp.AddTask((rapi_factory, move)) # Wait for all moves to finish wp.Quiesce()