Revision 26517d45

b/daemons/ganeti-watcher
29 29

  
30 30
import os
31 31
import sys
32
import re
33 32
import time
34 33
import fcntl
35 34
import errno
......
134 133
    if "node" not in self._data:
135 134
      self._data["node"] = {}
136 135

  
137
    self._orig_data = self._data.copy()
136
    self._orig_data = serializer.Dump(self._data)
138 137

  
139 138
  def Save(self):
140 139
    """Save state to file, then unlock and close it.
......
142 141
    """
143 142
    assert self.statefile
144 143

  
145
    if self._orig_data == self._data:
144
    serialized_form = serializer.Dump(self._data)
145
    if self._orig_data == serialized_form:
146 146
      logging.debug("Data didn't change, just touching status file")
147 147
      os.utime(constants.WATCHER_STATEFILE, None)
148 148
      return
......
150 150
    # We need to make sure the file is locked before renaming it, otherwise
151 151
    # starting ganeti-watcher again at the same time will create a conflict.
152 152
    fd = utils.WriteFile(constants.WATCHER_STATEFILE,
153
                         data=serializer.Dump(self._data),
153
                         data=serialized_form,
154 154
                         prewrite=LockFile, close=False)
155 155
    self.statefile = os.fdopen(fd, 'w+')
156 156

  
......
349 349

  
350 350
    """
351 351
    check_nodes = []
352
    for name, id in self.bootids.iteritems():
352
    for name, new_id in self.bootids.iteritems():
353 353
      old = notepad.GetNodeBootID(name)
354
      if old != id:
354
      if old != new_id:
355 355
        # Node's boot ID has changed, proably through a reboot.
356 356
        check_nodes.append(name)
357 357

  
......
370 370
        try:
371 371
          logging.info("Activating disks for instance %s", instance.name)
372 372
          instance.ActivateDisks()
373
        except Error, err:
373
        except Exception, err:
374 374
          logging.error(str(err), exc_info=True)
375 375

  
376 376
      # Keep changed boot IDs
......
404 404
                        instance.name, last)
405 405
          instance.Restart()
406 406
          self.started_instances.add(instance.name)
407
        except Error, err:
407
        except Exception, err:
408 408
          logging.error(str(err), exc_info=True)
409 409

  
410 410
        notepad.RecordRestartAttempt(instance)

Also available in: Unified diff