From 04554ddd242c4554c8ff47e58cebe00c919f6f32 Mon Sep 17 00:00:00 2001 From: Rajani Karuturi Date: Wed, 14 Oct 2015 14:28:47 +0530 Subject: [PATCH] Cloudstack-8816: Fixed missing resource uuid in delete snapshot events *event before* | management-server.AsyncJobEvent.complete.Snapshot.* | cloudstack-events | 26 | {"cmdInfo":"{\"id\":\"2ebabd8f-0b34-4461-8071-0917c231ca49\",\"response\":\"json\",\"ctxDetails\":\"{\\\"interface com.cloud.storage.Snapshot\\\":\\\"2ebabd8f-0b34-4461-8071-0917c231ca49\\\"}\",\"cmdEventType\":\"SNAPSHOT.DELETE\",\"ctxUserId\":\"2\",\"httpmethod\":\"GET\",\"_\":\"1444803845320\",\"uuid\":\"2ebabd8f-0b34-4461-8071-0917c231ca49\",\"ctxAccountId\":\"2\",\"ctxStartEventId\":\"1345\"}","instanceType":"Snapshot","jobId":"fab1feaf-3b4f-4158-b332-a78e43fee5e0","status":"SUCCEEDED","processStatus":"0","commandEventType":"SNAPSHOT.DELETE","resultCode":"0","command":"org.apache.cloudstack.api.command.user.snapshot.DeleteSnapshotCmd","jobResult":"org.apache.cloudstack.api.response.SuccessResponse/null/{\"success\":true}","account":"bd73dc2e-35c0-11e5-b094-d4ae52cb9af0","user":"bd7ea748-35c0-11e5-b094-d4ae52cb9af0"} *After* | management-server.AsyncJobEvent.complete.Snapshot.f25ad748-2fe3-4911-b40c-4698425c8a2f | cloudstack-events | 0 | {"cmdInfo":"{\"id\":\"f25ad748-2fe3-4911-b40c-4698425c8a2f\",\"response\":\"json\",\"ctxDetails\":\"{\\\"interface com.cloud.storage.Snapshot\\\":\\\"f25ad748-2fe3-4911-b40c-4698425c8a2f\\\"}\",\"cmdEventType\":\"SNAPSHOT.DELETE\",\"ctxUserId\":\"2\",\"httpmethod\":\"GET\",\"_\":\"1444806612980\",\"uuid\":\"f25ad748-2fe3-4911-b40c-4698425c8a2f\",\"ctxAccountId\":\"2\",\"ctxStartEventId\":\"1388\"}","instanceType":"Snapshot","instanceUuid":"f25ad748-2fe3-4911-b40c-4698425c8a2f","jobId":"69849909-9082-481c-b8ee-9ddc1608fe8d","status":"SUCCEEDED","processStatus":"0","commandEventType":"SNAPSHOT.DELETE","resultCode":"0","command":"org.apache.cloudstack.api.command.user.snapshot.DeleteSnapshotCmd","jobResult":"org.apache.cloudstack.api.response.SuccessResponse/null/{\"success\":true}","account":"bd73dc2e-35c0-11e5-b094-d4ae52cb9af0","user":"bd7ea748-35c0-11e5-b094-d4ae52cb9af0"} | 886 | string | True | --- server/src/com/cloud/api/ApiDBUtils.java | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/server/src/com/cloud/api/ApiDBUtils.java b/server/src/com/cloud/api/ApiDBUtils.java index 4fc9f42716d..130fa88cf5f 100644 --- a/server/src/com/cloud/api/ApiDBUtils.java +++ b/server/src/com/cloud/api/ApiDBUtils.java @@ -1033,12 +1033,7 @@ public class ApiDBUtils { } public static Snapshot findSnapshotById(long snapshotId) { - SnapshotVO snapshot = s_snapshotDao.findById(snapshotId); - if (snapshot != null && snapshot.getRemoved() == null && snapshot.getState() == Snapshot.State.BackedUp) { - return snapshot; - } else { - return null; - } + return s_snapshotDao.findByIdIncludingRemoved(snapshotId); } public static StoragePoolVO findStoragePoolById(Long storagePoolId) {