diff options
Diffstat (limited to 'dozentenmodulserver')
-rw-r--r-- | dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/RuntimeConfig.java | 4 | ||||
-rw-r--r-- | dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/thrift/ServerHandler.java | 2 |
2 files changed, 6 insertions, 0 deletions
diff --git a/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/RuntimeConfig.java b/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/RuntimeConfig.java index ea450717..001e8566 100644 --- a/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/RuntimeConfig.java +++ b/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/RuntimeConfig.java @@ -87,6 +87,10 @@ public class RuntimeConfig { return cache.get().getMaxLocationsPerLecture(); } + public static long getVmSizeLimit() { + return cache.get().vmSizeLimit; + } + /** * How long a version that is not the latest version of an image will be * kept. diff --git a/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/thrift/ServerHandler.java b/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/thrift/ServerHandler.java index 8382390a..7763f7fc 100644 --- a/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/thrift/ServerHandler.java +++ b/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/thrift/ServerHandler.java @@ -113,6 +113,8 @@ public class ServerHandler implements SatelliteServer.Iface { UserInfo user = SessionManager.getOrFail(userToken); if (!FileSystem.waitForStorage()) throw new TInvocationException(InvocationError.INTERNAL_SERVER_ERROR, "VM storage not mounted"); + if (RuntimeConfig.getVmSizeLimit() > 0 && RuntimeConfig.getVmSizeLimit() < fileSize) + throw new TTransferRejectedException("VM HDD size exceeds limit of " + RuntimeConfig.getVmSizeLimit() + " bytes"); User.canEditBaseImageOrFail(user, imageBaseId); ImageDetailsRead image; try { |