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>
# 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
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.
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
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.