Revision 29d376ec

b/daemons/ganeti-noded
339 339

  
340 340
    """
341 341
    vgname = params[0]
342
    return backend.GetVolumeList(vgname)
342
    return True, backend.GetVolumeList(vgname)
343 343

  
344 344
  @staticmethod
345 345
  def perspective_vg_list(params):
b/lib/backend.py
494 494
                         "--separator=%s" % sep,
495 495
                         "-olv_name,lv_size,lv_attr", vg_name])
496 496
  if result.failed:
497
    logging.error("Failed to list logical volumes, lvs output: %s",
498
                  result.output)
499
    return result.output
497
    _Fail("Failed to list logical volumes, lvs output: %s", result.output)
500 498

  
501 499
  valid_line_re = re.compile("^ *([^|]+)\|([0-9.]+)\|([^|]{6})\|?$")
502 500
  for line in result.stdout.splitlines():
b/lib/cmdlib.py
1289 1289
  def Exec(self, feedback_fn):
1290 1290
    """Verify integrity of cluster disks.
1291 1291

  
1292
    @rtype: tuple of three items
1293
    @return: a tuple of (dict of node-to-node_error, list of instances
1294
        which need activate-disks, dict of instance: (node, volume) for
1295
        missing volumes
1296

  
1292 1297
    """
1293
    result = res_nodes, res_nlvm, res_instances, res_missing = [], {}, [], {}
1298
    result = res_nodes, res_instances, res_missing = {}, [], {}
1294 1299

  
1295 1300
    vg_name = self.cfg.GetVGName()
1296 1301
    nodes = utils.NiceSort(self.cfg.GetNodeList())
......
1317 1322
    to_act = set()
1318 1323
    for node in nodes:
1319 1324
      # node_volume
1320
      lvs = node_lvs[node]
1321
      if lvs.failed:
1322
        if not lvs.offline:
1323
          self.LogWarning("Connection to node %s failed: %s" %
1324
                          (node, lvs.data))
1325
        continue
1326
      lvs = lvs.data
1327
      if isinstance(lvs, basestring):
1328
        logging.warning("Error enumerating LVs on node %s: %s", node, lvs)
1329
        res_nlvm[node] = lvs
1325
      node_res = node_lvs[node]
1326
      if node_res.offline:
1330 1327
        continue
1331
      elif not isinstance(lvs, dict):
1332
        logging.warning("Connection to node %s failed or invalid data"
1333
                        " returned", node)
1334
        res_nodes.append(node)
1328
      msg = node_res.RemoteFailMsg()
1329
      if msg:
1330
        logging.warning("Error enumerating LVs on node %s: %s", node, msg)
1331
        res_nodes[node] = msg
1335 1332
        continue
1336 1333

  
1337
      for lv_name, (_, lv_inactive, lv_online) in lvs.iteritems():
1334
      lvs = node_res.payload
1335
      for lv_name, (_, lv_inactive, lv_online) in lvs.items():
1338 1336
        inst = nv_dict.pop((node, lv_name), None)
1339 1337
        if (not lv_online and inst is not None
1340 1338
            and inst.name not in res_instances):
b/scripts/gnt-cluster
361 361
  """
362 362
  op = opcodes.OpVerifyDisks()
363 363
  result = SubmitOpCode(op)
364
  if not isinstance(result, (list, tuple)) or len(result) != 4:
364
  if not isinstance(result, (list, tuple)) or len(result) != 3:
365 365
    raise errors.ProgrammerError("Unknown result type for OpVerifyDisks")
366 366

  
367
  nodes, nlvm, instances, missing = result
367
  bad_nodes, instances, missing = result
368 368

  
369
  if nodes:
370
    ToStdout("Nodes unreachable or with bad data:")
371
    for name in nodes:
372
      ToStdout("\t%s", name)
373 369
  retcode = constants.EXIT_SUCCESS
374 370

  
375
  if nlvm:
376
    for node, text in nlvm.iteritems():
377
      ToStdout("Error on node %s: LVM error: %s",
371
  if bad_nodes:
372
    for node, text in bad_nodes.items():
373
      ToStdout("Error gathering data on node %s: %s",
378 374
               node, utils.SafeEncode(text[-400:]))
379 375
      retcode |= 1
380 376
      ToStdout("You need to fix these nodes first before fixing instances")
......
394 390

  
395 391
  if missing:
396 392
    for iname, ival in missing.iteritems():
397
      all_missing = utils.all(ival, lambda x: x[0] in nlvm)
393
      all_missing = utils.all(ival, lambda x: x[0] in bad_nodes)
398 394
      if all_missing:
399 395
        ToStdout("Instance %s cannot be verified as it lives on"
400 396
                 " broken nodes", iname)
......
402 398
        ToStdout("Instance %s has missing logical volumes:", iname)
403 399
        ival.sort()
404 400
        for node, vol in ival:
405
          if node in nlvm:
401
          if node in bad_nodes:
406 402
            ToStdout("\tbroken node %s /dev/xenvg/%s", node, vol)
407 403
          else:
408 404
            ToStdout("\t%s /dev/xenvg/%s", node, vol)

Also available in: Unified diff