Revision c6a9dffa lib/backend.py

b/lib/backend.py
1539 1539
  @type disks: list of L{objects.Disk}
1540 1540
  @param disks: the list of disks which we should query
1541 1541
  @rtype: disk
1542
  @return:
1543
      a list of (mirror_done, estimated_time) tuples, which
1544
      are the result of L{bdev.BlockDev.CombinedSyncStatus}
1542
  @return: List of L{objects.BlockDevStatus}, one for each disk
1545 1543
  @raise errors.BlockDeviceError: if any of the disks cannot be
1546 1544
      found
1547 1545

  
......
1557 1555
  return stats
1558 1556

  
1559 1557

  
1558
def BlockdevGetmirrorstatusMulti(disks):
1559
  """Get the mirroring status of a list of devices.
1560

  
1561
  @type disks: list of L{objects.Disk}
1562
  @param disks: the list of disks which we should query
1563
  @rtype: disk
1564
  @return: List of tuples, (bool, status), one for each disk; bool denotes
1565
    success/failure, status is L{objects.BlockDevStatus} on success, string
1566
    otherwise
1567

  
1568
  """
1569
  result = []
1570
  for disk in disks:
1571
    try:
1572
      rbd = _RecursiveFindBD(disk)
1573
      if rbd is None:
1574
        result.append((False, "Can't find device %s" % disk))
1575
        continue
1576

  
1577
      status = rbd.CombinedSyncStatus()
1578
    except errors.BlockDeviceError, err:
1579
      logging.exception("Error while getting disk status")
1580
      result.append((False, str(err)))
1581
    else:
1582
      result.append((True, status))
1583

  
1584
  assert len(disks) == len(result)
1585

  
1586
  return result
1587

  
1588

  
1560 1589
def _RecursiveFindBD(disk):
1561 1590
  """Check if a device is activated.
1562 1591

  

Also available in: Unified diff