Revision c69b147d tools/cfgupgrade

b/tools/cfgupgrade
155 155
      UpgradeIPolicy(ipolicy, cl_ipolicy, True)
156 156

  
157 157

  
158
def GetExclusiveStorageValue(config_data):
159
  """Return a conservative value of the exclusive_storage flag.
160

  
161
  Return C{True} if the cluster or at least a nodegroup have the flag set.
162

  
163
  """
164
  ret = False
165
  cluster = config_data["cluster"]
166
  ndparams = cluster.get("ndparams")
167
  if ndparams is not None and ndparams.get("exclusive_storage"):
168
    ret = True
169
  for group in config_data["nodegroups"].values():
170
    ndparams = group.get("ndparams")
171
    if ndparams is not None and ndparams.get("exclusive_storage"):
172
      ret = True
173
  return ret
174

  
175

  
158 176
def UpgradeInstances(config_data):
159 177
  network2uuid = dict((n["name"], n["uuid"])
160 178
                      for n in config_data["networks"].values())
161 179
  if "instances" not in config_data:
162 180
    raise Error("Can't find the 'instances' key in the configuration!")
163 181

  
182
  missing_spindles = False
164 183
  for instance, iobj in config_data["instances"].items():
165 184
    for nic in iobj["nics"]:
166 185
      name = nic.get("network", None)
......
182 201
                        " from '%s' to '%s'",
183 202
                        instance, idx, current, expected)
184 203
        dobj["iv_name"] = expected
204
      if not "spindles" in dobj:
205
        missing_spindles = True
206

  
207
  if GetExclusiveStorageValue(config_data) and missing_spindles:
208
    # We cannot be sure that the instances that are missing spindles have
209
    # exclusive storage enabled (the check would be more complicated), so we
210
    # give a noncommittal message
211
    logging.warning("Some instance disks could be needing to update the"
212
                    " spindles parameter; you can check by running"
213
                    " 'gnt-cluster verify', and fix any problem with"
214
                    " 'gnt-cluster repair-disk-sizes'")
185 215

  
186 216

  
187 217
def UpgradeRapiUsers():

Also available in: Unified diff