Remove the job queue drain rpc call
authorGuido Trotter <ultrotter@google.com>
Wed, 9 Jun 2010 11:07:25 +0000 (12:07 +0100)
committerGuido Trotter <ultrotter@google.com>
Fri, 11 Jun 2010 09:23:03 +0000 (10:23 +0100)
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
lib/backend.py
lib/jqueue.py
lib/rpc.py

index 56acc33..281b061 100755 (executable)
@@ -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
index a60d2f1..edf6518 100644 (file)
@@ -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.
 
index 9e5d836..a830fda 100644 (file)
@@ -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
 
index 8131211..e099dde 100644 (file)
@@ -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.