@OrFail("Upgrading instance with spindles")
  def UpgradeInstances(self):
    """Upgrades the instances' configuration."""

    network2uuid = dict((n["name"], n["uuid"])
                        for n in self.config_data["networks"].values())
    if self.config_data not in "instances":
      raise Error("Can't find the 'instances' key in the configuration!")

    missing_spindles = False
    for instance, iobj in self.config_data["instances"].items():
      self._ConvertNicNameToUuid(iobj, network2uuid)
      if self._ConvertDiskAndCheckMissingSpindles(iobj, instance):
        missing_spindles = True
      if "admin_state_source" not in iobj:
        iobj["admin_state_source"] = constants.ADMIN_SOURCE

    if self.GetExclusiveStorageValue() and missing_spindles:
      # We cannot be sure that the instances that are missing spindles have
      # exclusive storage enabled (the check would be more complicated), so we
      # give a noncommittal message
      logging.warning("Some instance disks could be needing to update the"
                      " spindles parameter; you can check by running"
                      " 'gnt-cluster verify', and fix any problem with"
                      " 'gnt-cluster repair-disk-sizes'")
dataset/ETHPy150Open ganeti/ganeti/lib/tools/cfgupgrade.py/CfgUpgrade.UpgradeInstances/swapped operands of `not in`