示例#1
0
文件: blockSD.py 项目: humblec/vdsm
def _zeroVolume(sdUUID, volUUID):
    """Fill a block volume.

    This function requires an active LV.
    """
    dm = lvm.lvDmDev(sdUUID, volUUID)
    size = multipath.getDeviceSize(dm)  # Bytes
    # TODO: Change for zero 128 M chuncks and log.
    # 128 M is the vdsm extent size default
    BS = constants.MEGAB  # 1024 ** 2 = 1 MiB
    count = size / BS
    cmd = [constants.EXT_DD, "oflag=%s" % misc.DIRECTFLAG, "if=/dev/zero",
           "of=%s" % lvm.lvPath(sdUUID, volUUID), "bs=%s" % BS,
           "count=%s" % count]
    p = misc.execCmd(cmd, sync=False, nice=utils.NICENESS.HIGH,
                     ioclass=utils.IOCLASS.IDLE, deathSignal=signal.SIGKILL)
    return p
示例#2
0
文件: blockSD.py 项目: oVirtorg/vdsm
def _zeroVolume(sdUUID, volUUID):
    """Fill a block volume.

    This function requires an active LV.
    """
    dm = lvm.lvDmDev(sdUUID, volUUID)
    size = multipath.getDeviceSize(dm)  # Bytes
    # TODO: Change for zero 128 M chuncks and log.
    # 128 M is the vdsm extent size default
    BS = constants.MEGAB  # 1024 ** 2 = 1 MiB
    count = size / BS
    cmd = [constants.EXT_DD, "oflag=%s" % misc.DIRECTFLAG, "if=/dev/zero",
           "of=%s" % lvm.lvPath(sdUUID, volUUID), "bs=%s" % BS,
           "count=%s" % count]
    p = misc.execCmd(cmd, sync=False, nice=utils.NICENESS.HIGH,
                     ioclass=utils.IOCLASS.IDLE, deathSignal=signal.SIGKILL)
    return p