Revision 3a3e4f1e
b/doc/hooks.rst | ||
---|---|---|
478 | 478 |
Called when the master IP is activated. |
479 | 479 |
|
480 | 480 |
:directory: master-ip-turnup |
481 |
:env. vars: MASTER_NETDEV, MASTER_IP |
|
481 |
:env. vars: MASTER_NETDEV, MASTER_IP, MASTER_NETMASK, CLUSTER_IP_VERSION
|
|
482 | 482 |
:pre-execution: master node |
483 | 483 |
:post-execution: master node |
484 | 484 |
|
... | ... | |
488 | 488 |
Called when the master IP is deactivated. |
489 | 489 |
|
490 | 490 |
:directory: master-ip-turndown |
491 |
:env. vars: MASTER_NETDEV, MASTER_IP |
|
491 |
:env. vars: MASTER_NETDEV, MASTER_IP, MASTER_NETMASK, CLUSTER_IP_VERSION
|
|
492 | 492 |
:pre-execution: master node |
493 | 493 |
:post-execution: master node |
494 | 494 |
|
... | ... | |
549 | 549 |
This is the list of variables which are specific to one or more |
550 | 550 |
operations. |
551 | 551 |
|
552 |
CLUSTER_IP_VERSION |
|
553 |
IP version of the master IP (4 or 6) |
|
554 |
|
|
552 | 555 |
INSTANCE_NAME |
553 | 556 |
The name of the instance which is the target of the operation. |
554 | 557 |
|
... | ... | |
627 | 630 |
MASTER_IP |
628 | 631 |
The master IP |
629 | 632 |
|
633 |
MASTER_NETMASK |
|
634 |
Netmask of the master IP |
|
635 |
|
|
630 | 636 |
INSTANCE_TAGS |
631 | 637 |
A space-delimited list of the instance's tags. |
632 | 638 |
|
b/lib/backend.py | ||
---|---|---|
283 | 283 |
return decorator |
284 | 284 |
|
285 | 285 |
|
286 |
def _BuildMasterIpHookEnv():
|
|
286 |
def _BuildMasterIpEnv(): |
|
287 | 287 |
"""Builds environment variables for master IP hooks. |
288 | 288 |
|
289 | 289 |
""" |
290 |
cfg = _GetConfig() |
|
290 |
master_netdev, master_ip, _, family, master_netmask = GetMasterInfo() |
|
291 |
version = str(netutils.IPAddress.GetVersionFromAddressFamily(family)) |
|
291 | 292 |
env = { |
292 |
"MASTER_NETDEV": cfg.GetMasterNetdev(), |
|
293 |
"MASTER_IP": cfg.GetMasterIP(), |
|
293 |
"MASTER_NETDEV": master_netdev, |
|
294 |
"MASTER_IP": master_ip, |
|
295 |
"MASTER_NETMASK": master_netmask, |
|
296 |
"CLUSTER_IP_VERSION": version, |
|
294 | 297 |
} |
295 | 298 |
|
296 | 299 |
return env |
297 | 300 |
|
298 | 301 |
|
299 | 302 |
@RunLocalHooks(constants.FAKE_OP_MASTER_TURNUP, "master-ip-turnup", |
300 |
_BuildMasterIpHookEnv)
|
|
303 |
_BuildMasterIpEnv) |
|
301 | 304 |
def ActivateMasterIp(master_ip, master_netmask, master_netdev, family): |
302 | 305 |
"""Activate the IP address of the master daemon. |
303 | 306 |
|
... | ... | |
374 | 377 |
|
375 | 378 |
|
376 | 379 |
@RunLocalHooks(constants.FAKE_OP_MASTER_TURNDOWN, "master-ip-turndown", |
377 |
_BuildMasterIpHookEnv)
|
|
380 |
_BuildMasterIpEnv) |
|
378 | 381 |
def DeactivateMasterIp(master_ip, master_netmask, master_netdev): |
379 | 382 |
"""Deactivate the master IP on this node. |
380 | 383 |
|
Also available in: Unified diff