def create(cls, sdUUID, domainName, domClass, remotePath, storageType, version, block_size=sc.BLOCK_SIZE_512, alignment=sc.ALIGNMENT_1M): """ Create new storage domain Arguments: sdUUID (UUID): Storage Domain UUID domainName (str): Storage domain name domClass (int): Data/Iso remotePath (str): server:/export_path storageType (int): NFS_DOMAIN, GLUSTERFS_DOMAIN, &etc. version (int): DOMAIN_VERSIONS, block_size (int): Underlying storage block size. Supported value is BLOCK_SIZE_512 alignment (int): Sanlock alignment in bytes to use for this storage domain. Supported value is ALIGN_1M """ cls.log.info("sdUUID=%s domainName=%s remotePath=%s " "domClass=%s, block_size=%s, alignment=%s", sdUUID, domainName, remotePath, domClass, block_size, alignment) cls._validate_block_and_alignment(block_size, alignment, version) remotePath = fileUtils.normalize_path(remotePath) if not misc.isAscii(domainName) and not sd.supportsUnicode(version): raise se.UnicodeArgumentException() # Create local path mntPath = fileUtils.transformPath(remotePath) mntPoint = cls.getMountPoint(mntPath) cls._preCreateValidation(sdUUID, mntPoint, remotePath, storageType, version) domainDir = os.path.join(mntPoint, sdUUID) cls._prepareMetadata(domainDir, sdUUID, domainName, domClass, remotePath, storageType, version, alignment, block_size) # create domain images folder imagesDir = os.path.join(domainDir, sd.DOMAIN_IMAGES) cls.log.info("Creating domain images directory %r", imagesDir) oop.getProcessPool(sdUUID).fileUtils.createdir(imagesDir) # create special imageUUID for ISO/Floppy volumes if domClass is sd.ISO_DOMAIN: isoDir = os.path.join(imagesDir, sd.ISO_IMAGE_UUID) cls.log.info("Creating ISO domain images directory %r", isoDir) oop.getProcessPool(sdUUID).fileUtils.createdir(isoDir) fsd = cls(os.path.join(mntPoint, sdUUID)) fsd.initSPMlease() return fsd
def create(cls, sdUUID, domainName, domClass, remotePath, storageType, version, block_size=sc.BLOCK_SIZE_512, alignment=sc.ALIGNMENT_1M): """ Create new storage domain Arguments: sdUUID (UUID): Storage Domain UUID domainName (str): Storage domain name domClass (int): Data/Iso remotePath (str): /data storageType (int): LOCALFS_DOMAIN version (int): DOMAIN_VERSIONS block_size (int): Underlying storage block size. Supported value is BLOCK_SIZE_512 alignment (int): Sanlock alignment to use for this storage domain. Supported value is ALIGN_1M """ cls.log.info("sdUUID=%s domainName=%s remotePath=%s " "domClass=%s, block_size=%s, alignment=%s", sdUUID, domainName, remotePath, domClass, block_size, alignment) cls._validate_block_and_alignment(block_size, alignment, version) if not misc.isAscii(domainName) and not sd.supportsUnicode(version): raise se.UnicodeArgumentException() # Create local path mntPath = fileUtils.transformPath(remotePath) mntPoint = os.path.join(sc.REPO_MOUNT_DIR, mntPath) cls._preCreateValidation(sdUUID, mntPoint, remotePath, version) domainDir = os.path.join(mntPoint, sdUUID) cls._prepareMetadata(domainDir, sdUUID, domainName, domClass, remotePath, storageType, version, alignment, block_size) # create domain images folder imagesDir = os.path.join(domainDir, sd.DOMAIN_IMAGES) cls.log.info("Creating domain images directory %r", imagesDir) fileUtils.createdir(imagesDir) # create special imageUUID for ISO/Floppy volumes # Actually the local domain shouldn't be ISO, but # we can allow it for systems without NFS at all if domClass is sd.ISO_DOMAIN: isoDir = os.path.join(imagesDir, sd.ISO_IMAGE_UUID) cls.log.info("Creating ISO domain images directory %r", isoDir) fileUtils.createdir(isoDir) fsd = LocalFsStorageDomain(os.path.join(mntPoint, sdUUID)) fsd.initSPMlease() return fsd
def create(cls, sdUUID, domainName, domClass, remotePath, storageType, version, block_size=sc.BLOCK_SIZE_512, alignment=sc.ALIGNMENT_1M): """ Create new storage domain Arguments: sdUUID (UUID): Storage Domain UUID domainName (str): Storage domain name domClass (int): Data/Iso remotePath (str): /data storageType (int): LOCALFS_DOMAIN version (int): DOMAIN_VERSIONS block_size (int): Underlying storage block size. Supported value is BLOCK_SIZE_512 alignment (int): Sanlock alignment to use for this storage domain. Supported value is ALIGN_1M """ cls.log.info("sdUUID=%s domainName=%s remotePath=%s " "domClass=%s, block_size=%s, alignment=%s", sdUUID, domainName, remotePath, domClass, block_size, alignment) cls._validate_block_and_alignment(block_size, alignment) if not misc.isAscii(domainName) and not sd.supportsUnicode(version): raise se.UnicodeArgumentException() # Create local path mntPath = fileUtils.transformPath(remotePath) mntPoint = os.path.join(sc.REPO_MOUNT_DIR, mntPath) cls._preCreateValidation(sdUUID, mntPoint, remotePath, version) domainDir = os.path.join(mntPoint, sdUUID) cls._prepareMetadata(domainDir, sdUUID, domainName, domClass, remotePath, storageType, version, alignment, block_size) # create domain images folder imagesDir = os.path.join(domainDir, sd.DOMAIN_IMAGES) cls.log.info("Creating domain images directory %r", imagesDir) fileUtils.createdir(imagesDir) # create special imageUUID for ISO/Floppy volumes # Actually the local domain shouldn't be ISO, but # we can allow it for systems without NFS at all if domClass is sd.ISO_DOMAIN: isoDir = os.path.join(imagesDir, sd.ISO_IMAGE_UUID) cls.log.info("Creating ISO domain images directory %r", isoDir) fileUtils.createdir(isoDir) fsd = LocalFsStorageDomain(os.path.join(mntPoint, sdUUID)) fsd.initSPMlease() return fsd
def create(cls, sdUUID, domainName, domClass, remotePath, storageType, version): """ Create new storage domain. 'sdUUID' - Storage Domain UUID 'domainName' - storage domain name ("iso" or "data domain name") 'domClass' - Data/Iso 'remotePath' - server:/export_path 'storageType' - NFS_DOMAIN, LOCALFS_DOMAIN, &etc. 'version' - DOMAIN_VERSIONS """ cls.log.info("sdUUID=%s domainName=%s remotePath=%s " "domClass=%s", sdUUID, domainName, remotePath, domClass) remotePath = fileUtils.normalize_path(remotePath) if not misc.isAscii(domainName) and not sd.supportsUnicode(version): raise se.UnicodeArgumentException() # Create local path mntPath = fileUtils.transformPath(remotePath) mntPoint = cls.getMountPoint(mntPath) cls._preCreateValidation(sdUUID, mntPoint, remotePath, storageType, version) domainDir = os.path.join(mntPoint, sdUUID) cls._prepareMetadata(domainDir, sdUUID, domainName, domClass, remotePath, storageType, version) # create domain images folder imagesDir = os.path.join(domainDir, sd.DOMAIN_IMAGES) cls.log.info("Creating domain images directory %r", imagesDir) oop.getProcessPool(sdUUID).fileUtils.createdir(imagesDir) # create special imageUUID for ISO/Floppy volumes if domClass is sd.ISO_DOMAIN: isoDir = os.path.join(imagesDir, sd.ISO_IMAGE_UUID) cls.log.info("Creating ISO domain images directory %r", isoDir) oop.getProcessPool(sdUUID).fileUtils.createdir(isoDir) fsd = cls(os.path.join(mntPoint, sdUUID)) fsd.initSPMlease() return fsd
def create(cls, sdUUID, domainName, domClass, remotePath, storageType, version): """ Create new storage domain. 'sdUUID' - Storage Domain UUID 'domainName' - storage domain name ("iso" or "data domain name") 'domClass' - Data/Iso 'remotePath' - /data2 'storageType' - NFS_DOMAIN, LOCALFS_DOMAIN, &etc. 'version' - DOMAIN_VERSIONS """ cls.log.info("sdUUID=%s domainName=%s remotePath=%s " "domClass=%s", sdUUID, domainName, remotePath, domClass) if not misc.isAscii(domainName) and not sd.supportsUnicode(version): raise se.UnicodeArgumentException() # Create local path mntPath = fileUtils.transformPath(remotePath) mntPoint = os.path.join(sc.REPO_MOUNT_DIR, mntPath) cls._preCreateValidation(sdUUID, mntPoint, remotePath, version) domainDir = os.path.join(mntPoint, sdUUID) cls._prepareMetadata(domainDir, sdUUID, domainName, domClass, remotePath, storageType, version) # create domain images folder imagesDir = os.path.join(domainDir, sd.DOMAIN_IMAGES) cls.log.info("Creating domain images directory %r", imagesDir) fileUtils.createdir(imagesDir) # create special imageUUID for ISO/Floppy volumes # Actually the local domain shouldn't be ISO, but # we can allow it for systems without NFS at all if domClass is sd.ISO_DOMAIN: isoDir = os.path.join(imagesDir, sd.ISO_IMAGE_UUID) cls.log.info("Creating ISO domain images directory %r", isoDir) fileUtils.createdir(isoDir) fsd = LocalFsStorageDomain(os.path.join(mntPoint, sdUUID)) fsd.initSPMlease() return fsd
def create(cls, sdUUID, domainName, domClass, remotePath, storageType, version, block_size=sc.BLOCK_SIZE_512, alignment=sc.ALIGN_1M): """ Create new storage domain Arguments: sdUUID (UUID): Storage Domain UUID domainName (str): Storage domain name domClass (int): Data/Iso remotePath (str): server:/export_path storageType (int): NFS_DOMAIN, GLUSTERFS_DOMAIN, &etc. version (int): DOMAIN_VERSIONS, block_size (int): Underlying storage block size. Supported value is BLOCK_SIZE_512 alignment (int): Sanlock alignment in bytes to use for this storage domain. Supported value is ALIGN_1M """ cls.log.info( "sdUUID=%s domainName=%s remotePath=%s " "domClass=%s, block_size=%s, alignment=%s", sdUUID, domainName, remotePath, domClass, block_size, alignment) cls._validate_block_and_alignment(block_size, alignment) remotePath = fileUtils.normalize_path(remotePath) if not misc.isAscii(domainName) and not sd.supportsUnicode(version): raise se.UnicodeArgumentException() # Create local path mntPath = fileUtils.transformPath(remotePath) mntPoint = cls.getMountPoint(mntPath) cls._preCreateValidation(sdUUID, mntPoint, remotePath, storageType, version) domainDir = os.path.join(mntPoint, sdUUID) cls._prepareMetadata(domainDir, sdUUID, domainName, domClass, remotePath, storageType, version) # create domain images folder imagesDir = os.path.join(domainDir, sd.DOMAIN_IMAGES) cls.log.info("Creating domain images directory %r", imagesDir) oop.getProcessPool(sdUUID).fileUtils.createdir(imagesDir) # create special imageUUID for ISO/Floppy volumes if domClass is sd.ISO_DOMAIN: isoDir = os.path.join(imagesDir, sd.ISO_IMAGE_UUID) cls.log.info("Creating ISO domain images directory %r", isoDir) oop.getProcessPool(sdUUID).fileUtils.createdir(isoDir) fsd = cls(os.path.join(mntPoint, sdUUID)) fsd.initSPMlease() return fsd
def create(cls, sdUUID, domainName, domClass, remotePath, storageType, version, block_size=sc.BLOCK_SIZE_512, max_hosts=sc.HOSTS_4K_1M): """ Create new storage domain Arguments: sdUUID (UUID): Storage Domain UUID domainName (str): Storage domain name domClass (int): Data/Iso remotePath (str): server:/export_path storageType (int): NFS_DOMAIN, GLUSTERFS_DOMAIN, &etc. version (int): DOMAIN_VERSIONS, block_size (int): Underlying storage block size. Supported value is BLOCK_SIZE_512 max_hosts (int): Maximum number of hosts accessing this domain, default to sc.HOSTS_4K_1M. """ cls._validate_block_size(block_size, version) remotePath = fileUtils.normalize_path(remotePath) if not misc.isAscii(domainName) and not sd.supportsUnicode(version): raise se.UnicodeArgumentException() # Create local path mntPath = fileUtils.transformPath(remotePath) mntPoint = cls.getMountPoint(mntPath) cls._preCreateValidation(sdUUID, mntPoint, remotePath, storageType, version) storage_block_size = cls._detect_block_size(sdUUID, mntPoint) block_size = cls._validate_storage_block_size(block_size, storage_block_size) alignment = clusterlock.alignment(block_size, max_hosts) domainDir = os.path.join(mntPoint, sdUUID) cls._prepareMetadata(domainDir, sdUUID, domainName, domClass, remotePath, storageType, version, alignment, block_size) # create domain images folder imagesDir = os.path.join(domainDir, sd.DOMAIN_IMAGES) cls.log.info("Creating domain images directory %r", imagesDir) oop.getProcessPool(sdUUID).fileUtils.createdir(imagesDir) # create special imageUUID for ISO/Floppy volumes if domClass is sd.ISO_DOMAIN: isoDir = os.path.join(imagesDir, sd.ISO_IMAGE_UUID) cls.log.info("Creating ISO domain images directory %r", isoDir) oop.getProcessPool(sdUUID).fileUtils.createdir(isoDir) fsd = cls(os.path.join(mntPoint, sdUUID)) fsd.initSPMlease() return fsd
def create(cls, sdUUID, domainName, domClass, remotePath, storageType, version, block_size=sc.BLOCK_SIZE_512, max_hosts=sc.HOSTS_4K_1M): """ Create new storage domain Arguments: sdUUID (UUID): Storage Domain UUID domainName (str): Storage domain name domClass (int): Data/Iso remotePath (str): /data storageType (int): LOCALFS_DOMAIN version (int): DOMAIN_VERSIONS block_size (int): Underlying storage block size. Supported value is BLOCK_SIZE_512 max_hosts (int): Maximum number of hosts accessing this domain, default to sc.HOSTS_4K_1M. """ cls._validate_block_size(block_size, version) cls.validate_version(version) if not misc.isAscii(domainName) and not sd.supportsUnicode(version): raise se.UnicodeArgumentException() # Create local path mntPath = fileUtils.transformPath(remotePath) mntPoint = os.path.join(sc.REPO_MOUNT_DIR, mntPath) cls._preCreateValidation(sdUUID, mntPoint, remotePath, version) storage_block_size = cls._detect_block_size(sdUUID, mntPoint) block_size = cls._validate_storage_block_size(block_size, storage_block_size) alignment = clusterlock.alignment(block_size, max_hosts) domainDir = os.path.join(mntPoint, sdUUID) cls._prepareMetadata(domainDir, sdUUID, domainName, domClass, remotePath, storageType, version, alignment, block_size) # create domain images folder imagesDir = os.path.join(domainDir, sd.DOMAIN_IMAGES) cls.log.info("Creating domain images directory %r", imagesDir) fileUtils.createdir(imagesDir) # create special imageUUID for ISO/Floppy volumes # Actually the local domain shouldn't be ISO, but # we can allow it for systems without NFS at all if domClass is sd.ISO_DOMAIN: isoDir = os.path.join(imagesDir, sd.ISO_IMAGE_UUID) cls.log.info("Creating ISO domain images directory %r", isoDir) fileUtils.createdir(isoDir) fsd = LocalFsStorageDomain(os.path.join(mntPoint, sdUUID)) fsd.initSPMlease() return fsd