def validateCreateVolumeParams(self, volFormat, srcVolUUID, diskType=None, preallocate=None, add_bitmaps=False): """ Validate create volume parameters """ if volFormat not in sc.VOL_FORMAT: raise se.IncorrectFormat(volFormat) # Volumes with a parent must be cow if srcVolUUID != sc.BLANK_UUID and volFormat != sc.COW_FORMAT: raise se.IncorrectFormat(sc.type2name(volFormat)) if diskType is not None and diskType not in sc.VOL_DISKTYPE: raise se.InvalidParameterException("DiskType", diskType) if preallocate is not None and preallocate not in sc.VOL_TYPE: raise se.IncorrectType(preallocate) if add_bitmaps: if srcVolUUID == sc.BLANK_UUID: raise se.UnsupportedOperation( "Cannot add bitmaps for volume without parent volume", srcVolUUID=srcVolUUID, add_bitmaps=add_bitmaps) if not self.supports_bitmaps_operations(): raise se.UnsupportedOperation( "Cannot perform bitmaps operations on " "storage domain version < 4", domain_version=self.getVersion(), add_bitmaps=add_bitmaps)
def validateCreateVolumeParams(self, volFormat, srcVolUUID, preallocate=None): """ Validate create volume parameters """ if volFormat not in sc.VOL_FORMAT: raise se.IncorrectFormat(volFormat) # Volumes with a parent must be cow if srcVolUUID != sc.BLANK_UUID and volFormat != sc.COW_FORMAT: raise se.IncorrectFormat(sc.type2name(volFormat)) if preallocate is not None and preallocate not in sc.VOL_TYPE: raise se.IncorrectType(preallocate)
def validateCreateVolumeParams(cls, volFormat, srcVolUUID, diskType=None, preallocate=None): """ Validate create volume parameters """ if volFormat not in sc.VOL_FORMAT: raise se.IncorrectFormat(volFormat) # Volumes with a parent must be cow if srcVolUUID != sc.BLANK_UUID and volFormat != sc.COW_FORMAT: raise se.IncorrectFormat(sc.type2name(volFormat)) if diskType is not None and diskType not in sc.VOL_DISKTYPE: raise se.InvalidParameterException("DiskType", diskType) if preallocate is not None and preallocate not in sc.VOL_TYPE: raise se.IncorrectType(preallocate)
def validateCreateVolumeParams(cls, volFormat, srcVolUUID, diskType=None, preallocate=None, add_bitmaps=False): """ Validate create volume parameters """ if volFormat not in sc.VOL_FORMAT: raise se.IncorrectFormat(volFormat) # Volumes with a parent must be cow if srcVolUUID != sc.BLANK_UUID and volFormat != sc.COW_FORMAT: raise se.IncorrectFormat(sc.type2name(volFormat)) if diskType is not None and diskType not in sc.VOL_DISKTYPE: raise se.InvalidParameterException("DiskType", diskType) if preallocate is not None and preallocate not in sc.VOL_TYPE: raise se.IncorrectType(preallocate) if add_bitmaps and srcVolUUID == sc.BLANK_UUID: raise se.UnsupportedOperation( "Cannot add bitmaps for volume without parent volume", srcVolUUID=srcVolUUID, add_bitmaps=add_bitmaps)