示例#1
0
文件: sd.py 项目: benipeled/vdsm
    def __init__(self, sdUUID, domaindir, metadata):
        self.sdUUID = sdUUID
        self.domaindir = domaindir
        self.replaceMetadata(metadata)
        self._external_leases_lock = rwlock.RWLock()
        self._alignment = metadata.get(DMDK_ALIGNMENT, sc.ALIGNMENT_1M)
        self._block_size = metadata.get(DMDK_BLOCK_SIZE, sc.BLOCK_SIZE_512)

        # Validate alignment and block size.

        version = self.getVersion()
        if version < 5:
            if self.alignment != sc.ALIGNMENT_1M:
                raise se.MetaDataValidationError(
                    "Storage domain version {} does not support alignment {}".
                    format(version, self.alignment))

            if self.block_size != sc.BLOCK_SIZE_512:
                raise se.MetaDataValidationError(
                    "Storage domain version {} does not support block size {}".
                    format(version, self.block_size))

        self._domainLock = self._makeDomainLock()
示例#2
0
文件: volume.py 项目: bronhaim/vdsm
 def getSize(self):
     size = int(self.getMetaParam(sc.SIZE))
     if size < 1:  # Size stored in the metadata is not valid
         raise se.MetaDataValidationError()
     return size