summaryrefslogtreecommitdiffstats
path: root/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/thrift/ServerHandler.java
diff options
context:
space:
mode:
authorSimon Rettberg2015-09-22 15:44:51 +0200
committerSimon Rettberg2015-09-22 15:44:51 +0200
commit780b4dc20f8ca4f176ad5849f07bcfbf5e8a06ae (patch)
treee9af254c746e94ddd4c9036fef6d1143ec66548d /dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/thrift/ServerHandler.java
parent[client] Show number of the items in the table in image- and lecture window. (diff)
downloadtutor-module-780b4dc20f8ca4f176ad5849f07bcfbf5e8a06ae.tar.gz
tutor-module-780b4dc20f8ca4f176ad5849f07bcfbf5e8a06ae.tar.xz
tutor-module-780b4dc20f8ca4f176ad5849f07bcfbf5e8a06ae.zip
[server] Fix race condition on delete; check for vmstore before up/download
Diffstat (limited to 'dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/thrift/ServerHandler.java')
-rw-r--r--dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/thrift/ServerHandler.java10
1 files changed, 9 insertions, 1 deletions
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 936e2272..40a51c70 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
@@ -87,6 +87,8 @@ public class ServerHandler implements SatelliteServer.Iface {
List<ByteBuffer> blockHashes, ByteBuffer machineDescription) throws TTransferRejectedException,
TAuthorizationException, TInvocationException, TNotFoundException, TException {
UserInfo user = SessionManager.getOrFail(userToken);
+ if (!FileSystem.waitForStorage())
+ throw new TInvocationException(InvocationError.INTERNAL_SERVER_ERROR, "VM storage not mounted");
User.canEditBaseImageOrFail(user, imageBaseId);
ImageDetailsRead image;
try {
@@ -140,6 +142,8 @@ public class ServerHandler implements SatelliteServer.Iface {
throws TAuthorizationException, TInvocationException, TNotFoundException,
TTransferRejectedException {
UserInfo user = SessionManager.getOrFail(userToken);
+ if (!FileSystem.waitForStorage())
+ throw new TInvocationException(InvocationError.INTERNAL_SERVER_ERROR, "VM storage not mounted");
ImageVersionMeta imageVersion;
try {
imageVersion = DbImage.getVersionDetails(imageVersionId);
@@ -343,6 +347,8 @@ public class ServerHandler implements SatelliteServer.Iface {
public void deleteImageVersion(String userToken, String imageVersionId) throws TAuthorizationException,
TNotFoundException, TInvocationException {
UserInfo user = SessionManager.getOrFail(userToken);
+ if (!FileSystem.waitForStorage())
+ throw new TInvocationException(InvocationError.INTERNAL_SERVER_ERROR, "VM storage not mounted");
User.canDeleteImageVersionOrFail(user, imageVersionId);
try {
DbImage.markForDeletion(imageVersionId);
@@ -378,7 +384,7 @@ public class ServerHandler implements SatelliteServer.Iface {
} catch (Exception e) {
LOGGER.warn("Could not delete version when trying to delete base image", e);
}
- DeleteOldImages.hardDeleteImagesAsync();
+ DeleteOldImages.hardDeleteImages();
}
try {
DbImage.deleteBasePermanently(imageBaseId);
@@ -443,6 +449,8 @@ public class ServerHandler implements SatelliteServer.Iface {
throws TAuthorizationException, TNotFoundException, TInvocationException {
UserInfo user = SessionManager.getOrFail(userToken);
User.canTriggerReplicationOrFail(user, imageVersionId);
+ if (!FileSystem.waitForStorage())
+ throw new TInvocationException(InvocationError.INTERNAL_SERVER_ERROR, "VM storage not mounted");
// Query master server
ImagePublishData imagePublishData;
try {