Skip to content

Commit dc3d279

Browse files
committed
CLOUDSTACK-4833:[Automation][BVT] Template and ISO test cases failing
from BVT suite, during LIST api call.
1 parent c233492 commit dc3d279

3 files changed

Lines changed: 14 additions & 4 deletions

File tree

framework/db/src/com/cloud/dao/EntityManagerImpl.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ public <T> T findByUuid(Class<T> entityType, String uuid) {
5757
return dao.findByUuid(uuid);
5858
}
5959

60+
@Override
6061
public <T> T findByUuidIncludingRemoved(Class<T> entityType, String uuid) {
6162
// Finds and returns a unique VO using uuid, null if entity not found in db
6263
GenericDao<? extends T, String> dao = (GenericDao<? extends T, String>)GenericDaoBase.getDao(entityType);
@@ -94,7 +95,7 @@ public boolean configure(String name, Map<String, Object> params) throws Configu
9495
_name = name;
9596

9697
return true;
97-
}
98+
}
9899

99100
@Override
100101
public boolean start() {

server/src/com/cloud/api/ApiDispatcher.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
import javax.annotation.PostConstruct;
3434
import javax.inject.Inject;
3535

36+
import org.apache.log4j.Logger;
37+
3638
import org.apache.cloudstack.acl.ControlledEntity;
3739
import org.apache.cloudstack.acl.InfrastructureEntity;
3840
import org.apache.cloudstack.acl.RoleType;
@@ -49,7 +51,6 @@
4951
import org.apache.cloudstack.api.InternalIdentity;
5052
import org.apache.cloudstack.api.Parameter;
5153
import org.apache.cloudstack.api.ServerApiException;
52-
import org.apache.cloudstack.api.Validate;
5354
import org.apache.cloudstack.api.command.admin.resource.ArchiveAlertsCmd;
5455
import org.apache.cloudstack.api.command.admin.resource.DeleteAlertsCmd;
5556
import org.apache.cloudstack.api.command.user.event.ArchiveEventsCmd;
@@ -58,7 +59,6 @@
5859
import org.apache.cloudstack.context.CallContext;
5960
import org.apache.cloudstack.framework.jobs.AsyncJob;
6061
import org.apache.cloudstack.framework.jobs.AsyncJobManager;
61-
import org.apache.log4j.Logger;
6262

6363
import com.cloud.exception.InvalidParameterValueException;
6464
import com.cloud.user.Account;
@@ -369,7 +369,7 @@ private static Long translateUuidToInternalId(String uuid, Parameter annotation)
369369
for (Class<?> entity : entities) {
370370
// For backward compatibility, we search within removed entities and let service layer deal
371371
// with removed ones, return empty response or error
372-
Object objVO = s_instance._entityMgr.findByUuid(entity, uuid);
372+
Object objVO = s_instance._entityMgr.findByUuidIncludingRemoved(entity, uuid);
373373
if (objVO == null) {
374374
continue;
375375
}

utils/src/com/cloud/utils/db/EntityManager.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,15 @@ public interface EntityManager {
4343
*/
4444
public <T> T findByUuid(Class<T> entityType, String uuid);
4545

46+
/**
47+
* Finds a unique entity by uuid string, including those removed entries
48+
* @param <T> entity class
49+
* @param entityType type of entity you're looking for.
50+
* @param uuid the unique id
51+
* @return T if found, null if not.
52+
*/
53+
public <T> T findByUuidIncludingRemoved(Class<T> entityType, String uuid);
54+
4655
/**
4756
* Finds an entity by external id which is always String
4857
* @param <T> entity class

0 commit comments

Comments
 (0)