Revision b7309a0d
b/daemons/ganeti-watcher | ||
---|---|---|
30 | 30 |
import os |
31 | 31 |
import sys |
32 | 32 |
import time |
33 |
import fcntl |
|
34 |
import errno |
|
35 | 33 |
import logging |
36 | 34 |
from optparse import OptionParser |
37 | 35 |
|
... | ... | |
46 | 44 |
|
47 | 45 |
|
48 | 46 |
MAXTRIES = 5 |
49 |
BAD_STATES = ['stopped']
|
|
50 |
HELPLESS_STATES = ['(node down)']
|
|
47 |
BAD_STATES = ['ERROR_down']
|
|
48 |
HELPLESS_STATES = ['ERROR_nodedown']
|
|
51 | 49 |
NOTICE = 'NOTICE' |
52 | 50 |
ERROR = 'ERROR' |
53 | 51 |
KEY_RESTART_COUNT = "restart_count" |
... | ... | |
238 | 236 |
"""Get a list of instances on this cluster. |
239 | 237 |
|
240 | 238 |
""" |
241 |
fields = ["name", "oper_state", "admin_state"]
|
|
239 |
fields = ["name", "status", "admin_state"]
|
|
242 | 240 |
|
243 | 241 |
if with_secondaries is not None: |
244 | 242 |
fields.append("snodes") |
... | ... | |
327 | 325 |
try: |
328 | 326 |
logging.info("Activating disks for instance %s", instance.name) |
329 | 327 |
instance.ActivateDisks() |
330 |
except Exception, err: |
|
331 |
logging.error(str(err), exc_info=True) |
|
328 |
except Exception: |
|
329 |
logging.exception("Error while activating disks for instance %s", |
|
330 |
instance.name) |
|
332 | 331 |
|
333 | 332 |
# Keep changed boot IDs |
334 | 333 |
for name in check_nodes: |
... | ... | |
339 | 338 |
|
340 | 339 |
""" |
341 | 340 |
for instance in self.instances: |
342 |
# Don't care about manually stopped instances |
|
343 |
if not instance.autostart: |
|
344 |
continue |
|
345 |
|
|
346 | 341 |
if instance.state in BAD_STATES: |
347 | 342 |
n = notepad.NumberOfRestartAttempts(instance) |
348 | 343 |
|
... | ... | |
361 | 356 |
instance.name, last) |
362 | 357 |
instance.Restart() |
363 | 358 |
self.started_instances.add(instance.name) |
364 |
except Exception, err:
|
|
365 |
logging.error(str(err), exc_info=True)
|
|
359 |
except Exception: |
|
360 |
logging.exception("Erro while restarting instance %s", instance.name)
|
|
366 | 361 |
|
367 | 362 |
notepad.RecordRestartAttempt(instance) |
368 | 363 |
elif instance.state in HELPLESS_STATES: |
... | ... | |
373 | 368 |
notepad.RemoveInstance(instance) |
374 | 369 |
logging.info("Restart of %s succeeded", instance.name) |
375 | 370 |
|
376 |
def VerifyDisks(self): |
|
371 |
@staticmethod |
|
372 |
def VerifyDisks(): |
|
377 | 373 |
"""Run gnt-cluster verify-disks. |
378 | 374 |
|
379 | 375 |
""" |
Also available in: Unified diff