Revision 0188611b lib/backend.py

b/lib/backend.py
1595 1595
  @param size: The size in MiB to write
1596 1596

  
1597 1597
  """
1598
  # Internal sizes are always in Mebibytes; if the following "dd" command
1599
  # should use a different block size the offset and size given to this
1600
  # function must be adjusted accordingly before being passed to "dd".
1601
  block_size = 1024 * 1024
1602

  
1598 1603
  cmd = [constants.DD_CMD, "if=/dev/zero", "seek=%d" % offset,
1599
         "bs=%d" % constants.WIPE_BLOCK_SIZE, "oflag=direct", "of=%s" % path,
1604
         "bs=%s" % block_size, "oflag=direct", "of=%s" % path,
1600 1605
         "count=%d" % size]
1601 1606
  result = utils.RunCmd(cmd)
1602 1607

  
......
1625 1630
    _Fail("Cannot execute wipe for device %s: device not found", disk.iv_name)
1626 1631

  
1627 1632
  # Do cross verify some of the parameters
1633
  if offset < 0:
1634
    _Fail("Negative offset")
1635
  if size < 0:
1636
    _Fail("Negative size")
1628 1637
  if offset > rdev.size:
1629 1638
    _Fail("Offset is bigger than device size")
1630 1639
  if (offset + size) > rdev.size:

Also available in: Unified diff