Revision 5119c79e

b/lib/backend.py
1353 1353
  _WipeDevice(rdev.dev_path, offset, size)
1354 1354

  
1355 1355

  
1356
def BlockdevPauseResumeSync(disks, pause):
1357
  """Pause or resume the sync of the block device.
1358

  
1359
  @type disk: list of L{objects.Disk}
1360
  @param disk: the disks object we want to pause/resume
1361
  @type pause: bool
1362
  @param pause: Wheater to pause or resume
1363

  
1364
  """
1365
  success = []
1366
  for disk in disks:
1367
    try:
1368
      rdev = _RecursiveFindBD(disk)
1369
    except errors.BlockDeviceError:
1370
      rdev = None
1371

  
1372
    if not rdev:
1373
      success.append((False, ("Cannot change sync for device %s:"
1374
                              " device not found" % disk.iv_name)))
1375
      continue
1376

  
1377
    result = rdev.PauseResumeSync(pause)
1378

  
1379
    if result:
1380
      success.append((result, None))
1381
    else:
1382
      if pause:
1383
        msg = "Pause"
1384
      else:
1385
        msg = "Resume"
1386
      success.append((result, "%s for device %s failed" % (msg, disk.iv_name)))
1387

  
1388
  return success
1389

  
1390

  
1356 1391
def BlockdevRemove(disk):
1357 1392
  """Remove a block device.
1358 1393

  

Also available in: Unified diff