Revision 6abf7f2c
b/daemons/ganeti-noded | ||
---|---|---|
803 | 803 |
# TODO: What if a file fails to rename? |
804 | 804 |
return [backend.JobQueueRename(old, new) for old, new in params] |
805 | 805 |
|
806 |
@staticmethod |
|
807 |
def perspective_jobqueue_set_drain(params): |
|
808 |
"""Set/unset the queue drain flag. |
|
809 |
|
|
810 |
""" |
|
811 |
drain_flag = params[0] |
|
812 |
return backend.JobQueueSetDrainFlag(drain_flag) |
|
813 |
|
|
814 |
|
|
815 | 806 |
# hypervisor --------------- |
816 | 807 |
|
817 | 808 |
@staticmethod |
b/lib/backend.py | ||
---|---|---|
2357 | 2357 |
utils.RenameFile(old, new, mkdir=True) |
2358 | 2358 |
|
2359 | 2359 |
|
2360 |
def JobQueueSetDrainFlag(drain_flag): |
|
2361 |
"""Set the drain flag for the queue. |
|
2362 |
|
|
2363 |
This will set or unset the queue drain flag. |
|
2364 |
|
|
2365 |
@type drain_flag: boolean |
|
2366 |
@param drain_flag: if True, will set the drain flag, otherwise reset it. |
|
2367 |
@rtype: truple |
|
2368 |
@return: always True, None |
|
2369 |
@warning: the function always returns True |
|
2370 |
|
|
2371 |
""" |
|
2372 |
if drain_flag: |
|
2373 |
utils.WriteFile(constants.JOB_QUEUE_DRAIN_FILE, data="", close=True) |
|
2374 |
else: |
|
2375 |
utils.RemoveFile(constants.JOB_QUEUE_DRAIN_FILE) |
|
2376 |
|
|
2377 |
|
|
2378 | 2360 |
def BlockdevClose(instance_name, disks): |
2379 | 2361 |
"""Closes the given block devices. |
2380 | 2362 |
|
b/lib/jqueue.py | ||
---|---|---|
1026 | 1026 |
def SetDrainFlag(drain_flag): |
1027 | 1027 |
"""Sets the drain flag for the queue. |
1028 | 1028 |
|
1029 |
This is similar to the function L{backend.JobQueueSetDrainFlag}, |
|
1030 |
and in the future we might merge them. |
|
1031 |
|
|
1032 | 1029 |
@type drain_flag: boolean |
1033 | 1030 |
@param drain_flag: Whether to set or unset the drain flag |
1034 | 1031 |
|
b/lib/rpc.py | ||
---|---|---|
1265 | 1265 |
return cls._StaticMultiNodeCall(node_list, "jobqueue_rename", rename, |
1266 | 1266 |
address_list=address_list) |
1267 | 1267 |
|
1268 |
@classmethod |
|
1269 |
@_RpcTimeout(_TMO_FAST) |
|
1270 |
def call_jobqueue_set_drain(cls, node_list, drain_flag): |
|
1271 |
"""Set the drain flag on the queue. |
|
1272 |
|
|
1273 |
This is a multi-node call. |
|
1274 |
|
|
1275 |
@type node_list: list |
|
1276 |
@param node_list: the list of nodes to query |
|
1277 |
@type drain_flag: bool |
|
1278 |
@param drain_flag: if True, will set the drain flag, otherwise reset it. |
|
1279 |
|
|
1280 |
""" |
|
1281 |
return cls._StaticMultiNodeCall(node_list, "jobqueue_set_drain", |
|
1282 |
[drain_flag]) |
|
1283 |
|
|
1284 | 1268 |
@_RpcTimeout(_TMO_NORMAL) |
1285 | 1269 |
def call_hypervisor_validate_params(self, node_list, hvname, hvparams): |
1286 | 1270 |
"""Validate the hypervisor params. |
Also available in: Unified diff