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'])
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)
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
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
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)
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
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