Small improvements related to packet quota handling.

This commit is contained in:
Michael Hierweck 2013-07-15 18:23:46 +02:00
parent 5637091ea2
commit b05ce2184e
3 changed files with 27 additions and 29 deletions

View File

@ -2,8 +2,9 @@ package de.hsadmin.hostsharing;
public class QuotaLimit {
public static final double USER_HARD_FACTOR = 1.50;
public static final double GROUP_HARD_FACTOR = 1.50;
public static final double INODE_LIMIT_FACTOR = 0.25;
public static final double BLOCK_QUOTA_FACTOR = 1.00;
public static final double BLOCK_LIMIT_FACTOR = 1.50;
public static final double FILE_QUOTA_FACTOR = 0.10;
public static final double FILE_LIMIT_FACTOR = 0.15;
}

View File

@ -147,10 +147,10 @@ public class PacProcessorFactory implements EntityProcessorFactory {
quota = pacComponent.getQuantity() * 1024;
}
}
int blocksSoft = quota;
int blocksHard = ((Double) (quota * QuotaLimit.GROUP_HARD_FACTOR)).intValue();
int inodesSoft = ((Double) (quota * QuotaLimit.INODE_LIMIT_FACTOR)).intValue();
int inodesHard = ((Double) (quota * QuotaLimit.INODE_LIMIT_FACTOR)).intValue();
int blocksSoft = ((Double) (quota * QuotaLimit.BLOCK_QUOTA_FACTOR)).intValue();
int blocksHard = ((Double) (quota * QuotaLimit.BLOCK_LIMIT_FACTOR)).intValue();
int inodesSoft = ((Double) (quota * QuotaLimit.FILE_QUOTA_FACTOR)).intValue();
int inodesHard = ((Double) (quota * QuotaLimit.FILE_QUOTA_FACTOR)).intValue();
return new ShellProcessor("setquota -g " + pac.getName() + " "
+ blocksSoft + " " + blocksHard + " "
+ inodesSoft + " " + inodesHard + " "

View File

@ -90,9 +90,6 @@ public class UnixUserProcessorFactory implements EntityProcessorFactory {
quotaHard = new Integer(0);
} else {
quotaHard = quotaHard * 1024;
}
if (quotaHard.intValue() < quotaSoft.intValue()) {
quotaHard = ((Double) (quotaSoft * QuotaLimit.USER_HARD_FACTOR)).intValue();
}
aCP.appendProcessor(new ShellProcessor("setquota -u "
+ user.getName() + " " + quotaSoft + " "