예제 #1
0
 def __is_space_available_or_exception(self):
     available_mb = self.__get_rootfs_available_mb()
     if available_mb < ROOTFS_MINIMUM_MB:
         message = 'Not enough space left: {0} MB, required space is {1} MB'.format(available_mb, ROOTFS_MINIMUM_MB)
         self.logger.error('not running sam action, {0}'.format(message))
         self.logger.error(message)
         raise ServiceException(message)
예제 #2
0
    def activate_disk(self, device):
        self.log.info('activate disk: {0}'.format(device))
        self.deactivate_disk()

        partition = self.lsblk.find_partition_by_device(device)
        if not partition:
            error_message = 'unable to find device: {0}'.format(device)
            self.log.error(error_message)
            raise Exception(error_message)

        fs_type = partition.fs_type
        if fs_type not in supported_fs:
            error_message = 'Filesystem type is not supported: {0}' \
                            ', use on of the following: {1}'.format(fs_type, supported_fs)
            self.log.error(error_message)
            raise ServiceException(error_message)

        self.systemctl.add_mount(device)

        relink_disk(self.platform_config.get_disk_link(),
                    self.platform_config.get_external_disk_dir())
        self.event_trigger.trigger_app_event_disk()