Revision 2d88fdd3
b/lib/backend.py | ||
---|---|---|
283 | 283 |
return decorator |
284 | 284 |
|
285 | 285 |
|
286 |
def _BuildMasterIpHookEnv(): |
|
287 |
"""Builds environment variables for master IP hooks. |
|
288 |
|
|
289 |
""" |
|
290 |
cfg = _GetConfig() |
|
291 |
env = { |
|
292 |
"MASTER_NETDEV": cfg.GetMasterNetdev(), |
|
293 |
"MASTER_IP": cfg.GetMasterIP(), |
|
294 |
} |
|
295 |
|
|
296 |
return env |
|
297 |
|
|
298 |
|
|
299 |
@RunLocalHooks(constants.FAKE_OP_MASTER_TURNUP, "master-ip-turnup", |
|
300 |
_BuildMasterIpHookEnv) |
|
286 | 301 |
def ActivateMasterIp(): |
287 | 302 |
"""Activate the IP address of the master daemon. |
288 | 303 |
|
... | ... | |
353 | 368 |
_Fail(msg) |
354 | 369 |
|
355 | 370 |
|
371 |
@RunLocalHooks(constants.FAKE_OP_MASTER_TURNDOWN, "master-ip-turndown", |
|
372 |
_BuildMasterIpHookEnv) |
|
356 | 373 |
def DeactivateMasterIp(): |
357 | 374 |
"""Deactivate the master IP on this node. |
358 | 375 |
|
b/lib/constants.py | ||
---|---|---|
1708 | 1708 |
# The hail iallocator |
1709 | 1709 |
IALLOC_HAIL = "hail" |
1710 | 1710 |
|
1711 |
# Fake opcodes for functions that have hooks attached to them via |
|
1712 |
# backend.RunLocalHooks |
|
1713 |
FAKE_OP_MASTER_TURNUP = "OP_CLUSTER_IP_TURNUP" |
|
1714 |
FAKE_OP_MASTER_TURNDOWN = "OP_CLUSTER_IP_TURNDOWN" |
|
1715 |
|
|
1711 | 1716 |
# Do not re-export imported modules |
1712 | 1717 |
del re, _vcsversion, _autoconf |
Also available in: Unified diff