Revision d61cbe76 lib/backend.py

b/lib/backend.py
1477 1477

  
1478 1478
  Args:
1479 1479
    file_storage_dir: string with path
1480
  
1480

  
1481 1481
  Returns:
1482 1482
    normalized file_storage_dir (string) if valid, None otherwise
1483 1483

  
......
1592 1592
  return result
1593 1593

  
1594 1594

  
1595
def CloseBlockDevices(disks):
1596
  """Closes the given block devices.
1597

  
1598
  This means they will be switched to secondary mode (in case of DRBD).
1599

  
1600
  """
1601
  bdevs = []
1602
  for cf in disks:
1603
    rd = _RecursiveFindBD(cf)
1604
    if rd is None:
1605
      return (False, "Can't find device %s" % cf)
1606
    bdevs.append(rd)
1607

  
1608
  msg = []
1609
  for rd in bdevs:
1610
    try:
1611
      rd.Close()
1612
    except errors.BlockDeviceError, err:
1613
      msg.append(str(err))
1614
  if msg:
1615
    return (False, "Can't make devices secondary: %s" % ",".join(msg))
1616
  else:
1617
    return (True, "All devices secondary")
1618

  
1619

  
1595 1620
class HooksRunner(object):
1596 1621
  """Hook runner.
1597 1622

  

Also available in: Unified diff