Revision 9ab91008
b/ganeti/hooks.py | ||
---|---|---|
35 | 35 |
""" |
36 | 36 |
nics = {} |
37 | 37 |
|
38 |
key_to_attr = { 'IP': 'ip', 'MAC': 'mac', 'BRIDGE': 'link' } |
|
39 |
|
|
38 | 40 |
for env in environ.keys(): |
39 | 41 |
if env.startswith("GANETI_INSTANCE_NIC"): |
40 | 42 |
s = env.replace("GANETI_INSTANCE_NIC", "").split('_', 1) |
41 |
if len(s) == 2 and s[0].isdigit() and s[1] in ('MAC', 'IP'): |
|
43 |
if len(s) == 2 and s[0].isdigit() and s[1] in ('MAC', 'IP', 'BRIDGE'):
|
|
42 | 44 |
index = int(s[0]) |
43 |
key = s[1].lower()
|
|
45 |
key = key_to_attr[s[1]]
|
|
44 | 46 |
|
45 | 47 |
if nics.has_key(index): |
46 | 48 |
nics[index][key] = environ[env] |
b/ganeti/snf-ganeti-hook.py | ||
---|---|---|
63 | 63 |
PostStartHook, PostStopHook |
64 | 64 |
|
65 | 65 |
hooks = { |
66 |
("instance-add", "post"): PostStartHook, |
|
66 | 67 |
("instance-start", "post"): PostStartHook, |
68 |
("instance-reboot", "post"): PostStartHook, |
|
67 | 69 |
("instance-stop", "post"): PostStopHook |
68 | 70 |
} |
69 | 71 |
|
Also available in: Unified diff