예제 #1
0
 def updateInvalidatedSize(self):
     # During some complex flows the volume size might have been marked as
     # invalidated (e.g. during a transaction). Here we are checking
     # NOTE: the prerequisite to run this is that the volume is accessible
     # (e.g. lv active) and not in use by another process (e.g. dd, qemu).
     # Going directly to the metadata parameter as we should skip the size
     # validation in getSize.
     if int(self.getMetaParam(SIZE)) < 1:
         volInfo = qemuImg.info(self.getVolumePath(), fmt2str(self.getFormat()))
         # qemu/qemu-img rounds down
         self.setSize(volInfo["virtualsize"] / BLOCK_SIZE)
예제 #2
0
 def updateInvalidatedSize(self):
     # During some complex flows the volume size might have been marked as
     # invalidated (e.g. during a transaction). Here we are checking
     # NOTE: the prerequisite to run this is that the volume is accessible
     # (e.g. lv active) and not in use by another process (e.g. dd, qemu).
     # Going directly to the metadata parameter as we should skip the size
     # validation in getSize.
     if int(self.getMetaParam(SIZE)) < 1:
         volInfo = qemuImg.info(
             self.getVolumePath(), fmt2str(self.getFormat()))
         # qemu/qemu-img rounds down
         self.setSize(volInfo['virtualsize'] / BLOCK_SIZE)
예제 #3
0
    def v3ResetMetaVolSize(vol):
        # BZ811880 Verifiying that the volume size is the same size advertised
        # by the metadata
        log.debug("Checking the volume size for the volume %s", vol.volUUID)

        metaVolSize = int(vol.getMetaParam(volume.SIZE))

        if vol.getFormat() == volume.COW_FORMAT:
            qemuVolInfo = qemuImg.info(vol.getVolumePath(),
                                       qemuImg.FORMAT.QCOW2)
            virtVolSize = qemuVolInfo["virtualsize"] / V2META_SECTORSIZE
        else:
            virtVolSize = vol.getVolumeSize()

        if metaVolSize != virtVolSize:
            log.warn("Fixing the mismatch between the metadata volume size "
                     "(%s) and the volume virtual size (%s) for the volume "
                     "%s", vol.volUUID, metaVolSize, virtVolSize)
            vol.setMetaParam(volume.SIZE, str(virtVolSize))
예제 #4
0
    def v3ResetMetaVolSize(vol):
        # BZ811880 Verifiying that the volume size is the same size advertised
        # by the metadata
        log.debug("Checking the volume size for the volume %s", vol.volUUID)

        metaVolSize = int(vol.getMetaParam(volume.SIZE))

        if vol.getFormat() == volume.COW_FORMAT:
            qemuVolInfo = qemuImg.info(vol.getVolumePath(),
                                       qemuImg.FORMAT.QCOW2)
            virtVolSize = qemuVolInfo["virtualsize"] / V2META_SECTORSIZE
        else:
            virtVolSize = vol.getVolumeSize()

        if metaVolSize != virtVolSize:
            log.warn(
                "Fixing the mismatch between the metadata volume size "
                "(%s) and the volume virtual size (%s) for the volume "
                "%s", vol.volUUID, metaVolSize, virtVolSize)
            vol.setMetaParam(volume.SIZE, str(virtVolSize))