Skip to content
Snippets Groups Projects
Commit 00677422 authored by Cristiano Urban's avatar Cristiano Urban
Browse files

Added code portion to handle the presence of nodes on storage delete opration.

parent f5c8b829
No related branches found
No related tags found
No related merge requests found
......@@ -98,10 +98,6 @@ class VOSStorage(AMQPClient):
print("! from the database. !")
print("! The mount point on the transfer node will not be removed, you !")
print("! must do it manually. !")
print("! Anyway, you MUST BE AWARE that all the VOSpace nodes affected !")
print("! by this operation will not be accessible anymore from now on. !")
print("! We strongly recommend to move all the data to another storage !")
print("! location and update the database accordingly. !")
print("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
print()
confirm = None
......@@ -119,8 +115,12 @@ class VOSStorage(AMQPClient):
sys.exit("\nFATAL: Malformed response, storage confirmation expected.\n")
elif confirmResponse["responseType"] == "STORAGE_DEL_DONE":
print("\nStorage location deleted successfully!\n")
elif confirmResponse["responseType"] == "ERROR":
errorCode = confirmResponse["errorCode"]
errorMsg = confirmResponse["errorMsg"]
sys.exit(f"\nError code: {errorCode}\nError message: {errorMsg}\n")
else:
sys.exit("FATAL: Unknown response type.\n")
sys.exit("\nFATAL: Unknown response type.\n")
elif storeResponse["responseType"] == "ERROR":
errorCode = storeResponse["errorCode"]
errorMsg = storeResponse["errorMsg"]
......
......@@ -69,14 +69,18 @@ class StorageAMQPServer(AMQPServer):
if self.storageAck:
self.storageAck = False
self.dbConn.connect()
self.dbConn.deleteStorage(self.storageId)
result = self.dbConn.deleteStorage(self.storageId)
self.dbConn.disconnect()
if result:
response = { "responseType": "STORAGE_DEL_DONE" }
else:
response = { "responseType": "ERROR",
"errorCode": 4,
"errorMsg": "This storage location contains some VOSpace nodes. Please, move them to anoter location." }
else:
response = { "responseType": "ERROR",
"errorCode": 5,
"errorMsg": "Store request not acknowledged." }
elif requestBody["requestType"] == "STORAGE_LST":
......@@ -89,7 +93,7 @@ class StorageAMQPServer(AMQPServer):
else:
response = { "responseType": "ERROR",
"errorCode": 5,
"errorCode": 6,
"errorMsg": "Unkown request type." }
return response
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment