From 6abf7f2cbf99cc747b3681c2f334427d0b6fe78d Mon Sep 17 00:00:00 2001
From: Guido Trotter <ultrotter@google.com>
Date: Wed, 9 Jun 2010 12:07:25 +0100
Subject: [PATCH] Remove the job queue drain rpc call

This call was introduced but never used. In two years.
Since it's just creating/removing a file it can also be in simpler ways,
without a special rpc call, if/when we need it again. In the meantime,
let's give it to history.

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
---
 daemons/ganeti-noded |  9 ---------
 lib/backend.py       | 18 ------------------
 lib/jqueue.py        |  3 ---
 lib/rpc.py           | 16 ----------------
 4 files changed, 46 deletions(-)

diff --git a/daemons/ganeti-noded b/daemons/ganeti-noded
index 56acc33c8..281b06183 100755
--- a/daemons/ganeti-noded
+++ b/daemons/ganeti-noded
@@ -803,15 +803,6 @@ class NodeHttpServer(http.server.HttpServer):
     # TODO: What if a file fails to rename?
     return [backend.JobQueueRename(old, new) for old, new in params]
 
-  @staticmethod
-  def perspective_jobqueue_set_drain(params):
-    """Set/unset the queue drain flag.
-
-    """
-    drain_flag = params[0]
-    return backend.JobQueueSetDrainFlag(drain_flag)
-
-
   # hypervisor ---------------
 
   @staticmethod
diff --git a/lib/backend.py b/lib/backend.py
index a60d2f148..edf65188d 100644
--- a/lib/backend.py
+++ b/lib/backend.py
@@ -2357,24 +2357,6 @@ def JobQueueRename(old, new):
   utils.RenameFile(old, new, mkdir=True)
 
 
-def JobQueueSetDrainFlag(drain_flag):
-  """Set the drain flag for the queue.
-
-  This will set or unset the queue drain flag.
-
-  @type drain_flag: boolean
-  @param drain_flag: if True, will set the drain flag, otherwise reset it.
-  @rtype: truple
-  @return: always True, None
-  @warning: the function always returns True
-
-  """
-  if drain_flag:
-    utils.WriteFile(constants.JOB_QUEUE_DRAIN_FILE, data="", close=True)
-  else:
-    utils.RemoveFile(constants.JOB_QUEUE_DRAIN_FILE)
-
-
 def BlockdevClose(instance_name, disks):
   """Closes the given block devices.
 
diff --git a/lib/jqueue.py b/lib/jqueue.py
index 9e5d83663..a830fdae6 100644
--- a/lib/jqueue.py
+++ b/lib/jqueue.py
@@ -1026,9 +1026,6 @@ class JobQueue(object):
   def SetDrainFlag(drain_flag):
     """Sets the drain flag for the queue.
 
-    This is similar to the function L{backend.JobQueueSetDrainFlag},
-    and in the future we might merge them.
-
     @type drain_flag: boolean
     @param drain_flag: Whether to set or unset the drain flag
 
diff --git a/lib/rpc.py b/lib/rpc.py
index 813121154..e099ddeb5 100644
--- a/lib/rpc.py
+++ b/lib/rpc.py
@@ -1265,22 +1265,6 @@ class RpcRunner(object):
     return cls._StaticMultiNodeCall(node_list, "jobqueue_rename", rename,
                                     address_list=address_list)
 
-  @classmethod
-  @_RpcTimeout(_TMO_FAST)
-  def call_jobqueue_set_drain(cls, node_list, drain_flag):
-    """Set the drain flag on the queue.
-
-    This is a multi-node call.
-
-    @type node_list: list
-    @param node_list: the list of nodes to query
-    @type drain_flag: bool
-    @param drain_flag: if True, will set the drain flag, otherwise reset it.
-
-    """
-    return cls._StaticMultiNodeCall(node_list, "jobqueue_set_drain",
-                                    [drain_flag])
-
   @_RpcTimeout(_TMO_NORMAL)
   def call_hypervisor_validate_params(self, node_list, hvname, hvparams):
     """Validate the hypervisor params.
-- 
GitLab