예제 #1
0
파일: blockSD.py 프로젝트: humblec/vdsm
 def getStats(self):
     """
     """
     vg = lvm.getVG(self.sdUUID)
     vgMetadataStatus = metadataValidity(vg)
     return dict(disktotal=vg.size, diskfree=vg.free,
                 mdasize=vg.vg_mda_size, mdafree=vg.vg_mda_free,
                 mdavalid=vgMetadataStatus['mdavalid'],
                 mdathreshold=vgMetadataStatus['mdathreshold'])
예제 #2
0
파일: blockSD.py 프로젝트: oVirtorg/vdsm
 def getStats(self):
     """
     """
     vg = lvm.getVG(self.sdUUID)
     vgMetadataStatus = metadataValidity(vg)
     return dict(disktotal=vg.size, diskfree=vg.free,
                 mdasize=vg.vg_mda_size, mdafree=vg.vg_mda_free,
                 mdavalid=vgMetadataStatus['mdavalid'],
                 mdathreshold=vgMetadataStatus['mdathreshold'])
예제 #3
0
파일: blockSD.py 프로젝트: humblec/vdsm
    def findDomainPath(sdUUID):
        try:
            vg = lvm.getVG(sdUUID)
        except se.VolumeGroupDoesNotExist:
            raise se.StorageDomainDoesNotExist(sdUUID)

        if _isSD(vg):
            return vg.name

        raise se.StorageDomainDoesNotExist(sdUUID)
예제 #4
0
파일: blockSD.py 프로젝트: oVirtorg/vdsm
    def findDomainPath(sdUUID):
        try:
            vg = lvm.getVG(sdUUID)
        except se.VolumeGroupDoesNotExist:
            raise se.StorageDomainDoesNotExist(sdUUID)

        if _isSD(vg):
            return vg.name

        raise se.StorageDomainDoesNotExist(sdUUID)
예제 #5
0
파일: blockSD.py 프로젝트: humblec/vdsm
    def readlines(self):
        lvm.invalidateVG(self._vgName)
        vg = lvm.getVG(self._vgName)
        metadata = []
        for tag in vg.tags:
            if not tag.startswith(self.METADATA_TAG_PREFIX):
                continue

            metadata.append(lvmTagDecode(tag[self.METADATA_TAG_PREFIX_LEN:]))

        return metadata
예제 #6
0
파일: blockSD.py 프로젝트: oVirtorg/vdsm
    def readlines(self):
        lvm.invalidateVG(self._vgName)
        vg = lvm.getVG(self._vgName)
        metadata = []
        for tag in vg.tags:
            if not tag.startswith(self.METADATA_TAG_PREFIX):
                continue

            metadata.append(lvmTagDecode(tag[self.METADATA_TAG_PREFIX_LEN:]))

        return metadata
예제 #7
0
파일: blockSD.py 프로젝트: humblec/vdsm
 def getInfo(self):
     """
     Get storage domain info
     """
     # self.log.info("sdUUID=%s", self.sdUUID)
     # First call parent getInfo() - it fills in all the common details
     info = sd.StorageDomain.getInfo(self)
     # Now add blockSD specific data
     vg = lvm.getVG(self.sdUUID)  # vg.name = self.sdUUID
     info['vguuid'] = vg.uuid
     info['state'] = vg.partial
     return info
예제 #8
0
파일: blockSD.py 프로젝트: oVirtorg/vdsm
 def getInfo(self):
     """
     Get storage domain info
     """
     # self.log.info("sdUUID=%s", self.sdUUID)
     # First call parent getInfo() - it fills in all the common details
     info = sd.StorageDomain.getInfo(self)
     # Now add blockSD specific data
     vg = lvm.getVG(self.sdUUID)  # vg.name = self.sdUUID
     info['vguuid'] = vg.uuid
     info['state'] = vg.partial
     return info
예제 #9
0
파일: blockSD.py 프로젝트: humblec/vdsm
    def selftest(self):
        """
        Run the underlying VG validation routine
        """

        timeout = config.getint("irs", "repo_stats_cache_refresh_timeout")
        now = time.time()

        if now - self._lastUncachedSelftest > timeout:
            self._lastUncachedSelftest = now
            lvm.chkVG(self.sdUUID)
        elif lvm.getVG(self.sdUUID).partial != lvm.VG_OK:
            raise se.StorageDomainAccessError(self.sdUUID)
예제 #10
0
파일: blockSD.py 프로젝트: oVirtorg/vdsm
    def selftest(self):
        """
        Run the underlying VG validation routine
        """

        timeout = config.getint("irs", "repo_stats_cache_refresh_timeout")
        now = time.time()

        if now - self._lastUncachedSelftest > timeout:
            self._lastUncachedSelftest = now
            lvm.chkVG(self.sdUUID)
        elif lvm.getVG(self.sdUUID).partial != lvm.VG_OK:
            raise se.StorageDomainAccessError(self.sdUUID)
예제 #11
0
파일: blockSD.py 프로젝트: openSUSE/vdsm
 def metaSize(cls, vgroup):
     ''' Calc the minimal meta volume size in MB'''
     # In any case the metadata volume cannot be less than 512MB for the
     # case of 512 bytes per volume metadata, 2K for domain metadata and
     # extent size of 128MB. In any case we compute the right size on line.
     vg = lvm.getVG(vgroup)
     minmetasize = (SD_METADATA_SIZE / sd.METASIZE * int(vg.extent_size) +
         (1024 * 1024 - 1)) / (1024 * 1024)
     metaratio = int(vg.extent_size) / sd.METASIZE
     metasize = (int(vg.extent_count) * sd.METASIZE + (1024*1024-1)) / (1024*1024)
     metasize = max(minmetasize, metasize)
     if metasize > int(vg.free) / (1024*1024):
         raise se.VolumeGroupSizeError("volume group has not enough extents %s (Minimum %s), VG may be too small" % (vg.extent_count, (1024*1024)/sd.METASIZE))
     cls.log.info("size %s MB (metaratio %s)" % (metasize, metaratio))
     return metasize
예제 #12
0
 def metaSize(cls, vgroup):
     ''' Calc the minimal meta volume size in MB'''
     # In any case the metadata volume cannot be less than 512MB for the
     # case of 512 bytes per volume metadata, 2K for domain metadata and
     # extent size of 128MB. In any case we compute the right size on line.
     vg = lvm.getVG(vgroup)
     minmetasize = (SD_METADATA_SIZE / sd.METASIZE * int(vg.extent_size) +
                    (1024 * 1024 - 1)) / (1024 * 1024)
     metaratio = int(vg.extent_size) / sd.METASIZE
     metasize = (int(vg.extent_count) * sd.METASIZE +
                 (1024 * 1024 - 1)) / (1024 * 1024)
     metasize = max(minmetasize, metasize)
     if metasize > int(vg.free) / (1024 * 1024):
         raise se.VolumeGroupSizeError(
             "volume group has not enough extents %s (Minimum %s), VG may be too small"
             % (vg.extent_count, (1024 * 1024) / sd.METASIZE))
     cls.log.info("size %s MB (metaratio %s)" % (metasize, metaratio))
     return metasize