+ """
+ check_nodes = []
+ for name, (new_id, offline) in self.bootids.iteritems():
+ old = notepad.GetNodeBootID(name)
+ if new_id is None:
+ # Bad node, not returning a boot id
+ if not offline:
+ logging.debug("Node %s missing boot id, skipping secondary checks",
+ name)
+ continue
+ if old != new_id:
+ # Node's boot ID has changed, proably through a reboot.
+ check_nodes.append(name)
+
+ if check_nodes:
+ # Activate disks for all instances with any of the checked nodes as a
+ # secondary node.
+ for node in check_nodes:
+ if node not in self.smap:
+ continue
+ for instance_name in self.smap[node]:
+ instance = self.instances[instance_name]
+ if not instance.autostart:
+ logging.info(("Skipping disk activation for non-autostart"
+ " instance %s"), instance.name)
+ continue
+ if instance.name in self.started_instances:
+ # we already tried to start the instance, which should have
+ # activated its drives (if they can be at all)
+ continue
+ try:
+ logging.info("Activating disks for instance %s", instance.name)
+ instance.ActivateDisks()
+ except Exception:
+ logging.exception("Error while activating disks for instance %s",
+ instance.name)
+
+ # Keep changed boot IDs
+ for name in check_nodes:
+ notepad.SetNodeBootID(name, self.bootids[name][0])
+
+ def CheckInstances(self, notepad):
+ """Make a pass over the list of instances, restarting downed ones.
+
+ """
+ for instance in self.instances.values():