Class DiskAllocationStrategy

    • Constructor Detail

      • DiskAllocationStrategy

        public DiskAllocationStrategy()
    • Method Detail

      • allocateDisk

        @Nonnull
        public abstract Disk allocateDisk​(@Nonnull
                                          List<Disk> disks)
                                   throws IOException
        Allocates a disk from the given list. The list contains at least one Disk entry.
        Parameters:
        disks - the entries from which to allocate a disk. The list has at least one element
        Returns:
        the selected disk
        Throws:
        IOException - if any mandatory field is missing from the Disk entry, or if the disk allocation fails for any reason
      • retrieveUsableSpaceInBytes

        @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class)
        public long retrieveUsableSpaceInBytes​(Disk disk)
                                        throws IOException
        Retrieves the usable space in bytes for the given Disk entry. It uses the mounting point property that is defined in the Jenkins global config for each Disk.
        Parameters:
        disk - the disk entry
        Returns:
        the disk's usable space in bytes
        Throws:
        IOException - if mounting point from Jenkins master to Disk is null, or if the usable space can't be retrieved for security reasons
        See Also:
        File.getUsableSpace()
      • getEstimatedWorkspaceSize

        public long getEstimatedWorkspaceSize()
        Returns the estimated workspace size in MB.
        Returns:
        the estimated workspace size in MB
      • setEstimatedWorkspaceSize

        public void setEstimatedWorkspaceSize​(long estimatedWorkspaceSize)
        Sets the estimated workspace size. It must be set in MB.
        Parameters:
        estimatedWorkspaceSize - the estimated workspace size in MB