Revision bd29052f ganeti/hooks.py
b/ganeti/hooks.py | ||
---|---|---|
57 | 57 |
nics[0]['ipv6'] = mac2eui64(nics[0]['mac'], |
58 | 58 |
settings.PUBLIC_IPV6_PREFIX) |
59 | 59 |
|
60 |
# Amend notification with firewall settings |
|
61 |
tags = environ.get('GANETI_INSTANCE_TAGS', '') |
|
62 |
for tag in tags.split(' '): |
|
63 |
t = tag.split(':') |
|
64 |
if t[0:2] == ['synnefo', 'network']: |
|
65 |
if len(t) != 4: |
|
66 |
logger.error("Malformed synnefo tag %s", tag) |
|
67 |
continue |
|
68 |
try: |
|
69 |
index = int(t[2]) |
|
70 |
nics[index]['firewall'] = t[3] |
|
71 |
except ValueError: |
|
72 |
logger.error("Malformed synnefo tag %s", tag) |
|
73 |
except KeyError: |
|
74 |
logger.error("Found tag %s for non-existent NIC %d", |
|
75 |
tag, index) |
|
76 |
|
|
60 | 77 |
# Verify our findings are consistent with the Ganeti environment |
61 | 78 |
indexes = list(nics.keys()) |
62 | 79 |
ganeti_nic_count = int(environ['GANETI_INSTANCE_NIC_COUNT']) |
Also available in: Unified diff