Repository: cloudstack Updated Branches: refs/heads/master d2d448c40 -> 3014fd008
BUG-ID: CS-27662: ListTags API is ignoring the resourceID and displaying all the tags of all resources. Reviewed-by: Frank Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/3014fd00 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/3014fd00 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/3014fd00 Branch: refs/heads/master Commit: 3014fd00895a8467e627b09845fb5de4fdc373b5 Parents: d2d448c Author: Min Chen <min.c...@citrix.com> Authored: Mon Nov 17 15:04:03 2014 -0800 Committer: Min Chen <min.c...@citrix.com> Committed: Thu Nov 20 09:31:29 2014 -0800 ---------------------------------------------------------------------- server/src/com/cloud/api/query/QueryManagerImpl.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3014fd00/server/src/com/cloud/api/query/QueryManagerImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/api/query/QueryManagerImpl.java b/server/src/com/cloud/api/query/QueryManagerImpl.java index 824bb9b..418b81c 100644 --- a/server/src/com/cloud/api/query/QueryManagerImpl.java +++ b/server/src/com/cloud/api/query/QueryManagerImpl.java @@ -653,9 +653,8 @@ public class QueryManagerImpl extends ManagerBase implements QueryService { sb.and("value", sb.entity().getValue(), SearchCriteria.Op.EQ); if (resourceId != null) { - sb.and().op("resourceId", sb.entity().getResourceId(), SearchCriteria.Op.EQ); - sb.or("resourceUuid", sb.entity().getResourceUuid(), SearchCriteria.Op.EQ); - sb.cp(); + sb.and("resourceId", sb.entity().getResourceId(), SearchCriteria.Op.EQ); + sb.and("resourceUuid", sb.entity().getResourceUuid(), SearchCriteria.Op.EQ); } sb.and("resourceType", sb.entity().getResourceType(), SearchCriteria.Op.EQ); @@ -675,8 +674,13 @@ public class QueryManagerImpl extends ManagerBase implements QueryService { } if (resourceId != null) { - sc.setParameters("resourceId", resourceId); - sc.setParameters("resourceUuid", resourceId); + try { + long rid = Long.parseLong(resourceId); + sc.setParameters("resourceId", rid); + } catch (NumberFormatException ex) { + // internal id instead of resource id is passed + sc.setParameters("resourceUuid", resourceId); + } } if (resourceType != null) {