def _misc_create_volume(self): diskType = 2 heconflib.create_and_prepare_image( self.logger, self.environment[ohostedcons.VDSMEnv.VDS_CLI], ohostedcons.VolumeFormat.RAW_FORMAT, ohostedcons.VolumeTypes.PREALLOCATED_VOL, self.environment[ohostedcons.StorageEnv.SD_UUID], self.environment[ohostedcons.StorageEnv.SP_UUID], self.environment[ohostedcons.StorageEnv.CONF_IMG_UUID], self.environment[ohostedcons.StorageEnv.CONF_VOL_UUID], diskType, self.environment[ohostedcons.StorageEnv.CONF_IMAGE_SIZE_GB], ohostedcons.Const.CONF_IMAGE_DESC, )
def _create_shared_conf_volume(self, imguuid, voluuid, sizegb): self._conf_imgUUID = imguuid self._conf_volUUID = voluuid self._log.info('Creating hosted-engine configuration volume ' 'on the shared storage domain') diskType = 2 heconflib.create_and_prepare_image( self._log, self._cli, constants.VolumeFormat.RAW_FORMAT, constants.VolumeTypes.PREALLOCATED_VOL, self._sdUUID, self._spUUID, self._conf_imgUUID, self._conf_volUUID, diskType, sizegb, constants.CONF_IMAGE_DESC, )
def _create_shared_conf_volume(self, imguuid, voluuid, sizegb): self._conf_imgUUID = imguuid self._conf_volUUID = voluuid self._log.info( 'Creating hosted-engine configuration volume ' 'on the shared storage domain' ) diskType = 2 heconflib.create_and_prepare_image( self._log, self._cli, constants.VolumeFormat.RAW_FORMAT, constants.VolumeTypes.PREALLOCATED_VOL, self._sdUUID, self._spUUID, self._conf_imgUUID, self._conf_volUUID, diskType, sizegb, constants.CONF_IMAGE_DESC, )
def _misc(self): sdUUID = self.environment[ohostedcons.StorageEnv.SD_UUID] spUUID = self.environment[ohostedcons.StorageEnv.SP_UUID] imgUUID = self.environment[ohostedcons.StorageEnv.IMG_UUID] volUUID = self.environment[ohostedcons.StorageEnv.VOL_UUID] cli = self.environment[ohostedcons.VDSMEnv.VDS_CLI] if self.environment[ohostedcons.StorageEnv.DOMAIN_TYPE] in ( ohostedcons.DomainTypes.ISCSI, ohostedcons.DomainTypes.FC, ): # Checking the available space on VG where # we have to preallocate the image try: vg_uuid = self.environment[ohostedcons.StorageEnv.VG_UUID] vginfo = cli.LVMVolumeGroup.getInfo(lvmvolumegroupID=vg_uuid) except ServerError as e: raise RuntimeError(str(e)) self.logger.debug(vginfo) vgfree = int(vginfo['vgfree']) available_gb = vgfree / pow(2, 30) required_size = int( self.environment[ohostedcons.StorageEnv.IMAGE_SIZE_GB]) + int( self.environment[ ohostedcons.StorageEnv.CONF_IMAGE_SIZE_GB]) if required_size > available_gb: raise ohosteddomains.InsufficientSpaceError( _('Error: the VG on block device has capacity of only ' '{available_gb} GiB while ' '{required_size} GiB is required for the image').format( available_gb=available_gb, required_size=required_size, )) self.logger.info(_('Creating VM Image')) self.logger.debug('createVolume') volFormat = ohostedcons.VolumeFormat.RAW_FORMAT preallocate = ohostedcons.VolumeTypes.SPARSE_VOL if self.environment[ohostedcons.StorageEnv.DOMAIN_TYPE] in ( ohostedcons.DomainTypes.ISCSI, ohostedcons.DomainTypes.FC, ): # Can't use sparse volume on block devices preallocate = ohostedcons.VolumeTypes.PREALLOCATED_VOL diskType = 2 heconflib.create_and_prepare_image( self.logger, cli, volFormat, preallocate, sdUUID, spUUID, imgUUID, volUUID, diskType, self.environment[ohostedcons.StorageEnv.IMAGE_SIZE_GB], self.environment[ohostedcons.StorageEnv.IMAGE_DESC], )
def _misc(self): sdUUID = self.environment[ohostedcons.StorageEnv.SD_UUID] spUUID = self.environment[ohostedcons.StorageEnv.SP_UUID] imgUUID = self.environment[ohostedcons.StorageEnv.IMG_UUID] volUUID = self.environment[ohostedcons.StorageEnv.VOL_UUID] cli = self.environment[ohostedcons.VDSMEnv.VDS_CLI] if self.environment[ohostedcons.StorageEnv.DOMAIN_TYPE] in ( ohostedcons.DomainTypes.ISCSI, ohostedcons.DomainTypes.FC, ): # Checking the available space on VG where # we have to preallocate the image vginfo = cli.getVGInfo( self.environment[ohostedcons.StorageEnv.VG_UUID] ) self.logger.debug(vginfo) if vginfo['status']['code'] != 0: raise RuntimeError(vginfo['status']['message']) vgfree = int(vginfo['info']['vgfree']) available_gb = vgfree / pow(2, 30) required_size = int(self.environment[ ohostedcons.StorageEnv.IMAGE_SIZE_GB ]) + int(self.environment[ ohostedcons.StorageEnv.CONF_IMAGE_SIZE_GB ]) if required_size > available_gb: raise ohosteddomains.InsufficientSpaceError( _( 'Error: the VG on block device has capacity of only ' '{available_gb} GiB while ' '{required_size} GiB is required for the image' ).format( available_gb=available_gb, required_size=required_size, ) ) self.logger.info(_('Creating VM Image')) self.logger.debug('createVolume') volFormat = ohostedcons.VolumeFormat.RAW_FORMAT preallocate = ohostedcons.VolumeTypes.SPARSE_VOL if self.environment[ohostedcons.StorageEnv.DOMAIN_TYPE] in ( ohostedcons.DomainTypes.ISCSI, ohostedcons.DomainTypes.FC, ): # Can't use sparse volume on block devices preallocate = ohostedcons.VolumeTypes.PREALLOCATED_VOL diskType = 2 heconflib.create_and_prepare_image( self.logger, cli, volFormat, preallocate, sdUUID, spUUID, imgUUID, volUUID, diskType, self.environment[ohostedcons.StorageEnv.IMAGE_SIZE_GB], self.environment[ohostedcons.StorageEnv.IMAGE_DESC], )