You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by li...@apache.org on 2014/05/02 14:39:41 UTC
[12/13] git commit: updated refs/heads/multiple-disk-ova to 3532ffe
CLOUDSTACK-4757. List templates - Add filter parent template id
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/a6fd25ac
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/a6fd25ac
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/a6fd25ac
Branch: refs/heads/multiple-disk-ova
Commit: a6fd25ac3f6a4c382a9954360dd3afcdd27e1878
Parents: 6a38441
Author: Likitha Shetty <li...@citrix.com>
Authored: Wed Apr 30 11:46:13 2014 +0530
Committer: Likitha Shetty <li...@citrix.com>
Committed: Fri May 2 17:52:20 2014 +0530
----------------------------------------------------------------------
api/src/org/apache/cloudstack/api/ApiConstants.java | 1 +
.../api/command/user/template/ListTemplatesCmd.java | 7 +++++++
server/src/com/cloud/api/query/QueryManagerImpl.java | 11 ++++++++---
3 files changed, 16 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a6fd25ac/api/src/org/apache/cloudstack/api/ApiConstants.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/ApiConstants.java b/api/src/org/apache/cloudstack/api/ApiConstants.java
index 7ece5d9..eb4ab12 100755
--- a/api/src/org/apache/cloudstack/api/ApiConstants.java
+++ b/api/src/org/apache/cloudstack/api/ApiConstants.java
@@ -177,6 +177,7 @@ public class ApiConstants {
public static final String OS_NAME_FOR_HYPERVISOR = "osnameforhypervisor";
public static final String PARAMS = "params";
public static final String PARENT_DOMAIN_ID = "parentdomainid";
+ public static final String PARENT_TEMPLATE_ID = "parenttemplateid";
public static final String PASSWORD = "password";
public static final String NEW_PASSWORD = "new_password";
public static final String PASSWORD_ENABLED = "passwordenabled";
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a6fd25ac/api/src/org/apache/cloudstack/api/command/user/template/ListTemplatesCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/template/ListTemplatesCmd.java b/api/src/org/apache/cloudstack/api/command/user/template/ListTemplatesCmd.java
index 7a2a158..d257f60 100644
--- a/api/src/org/apache/cloudstack/api/command/user/template/ListTemplatesCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/template/ListTemplatesCmd.java
@@ -71,6 +71,9 @@ public class ListTemplatesCmd extends BaseListTaggedResourcesCmd {
@Parameter(name=ApiConstants.SHOW_REMOVED, type=CommandType.BOOLEAN, description="show removed templates as well")
private Boolean showRemoved;
+ @Parameter(name = ApiConstants.PARENT_TEMPLATE_ID, type = CommandType.UUID, entityType = TemplateResponse.class, description = "list datadisk templates by parent template id",
+ since = "4.4")
+ private Long parentTemplateId;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@@ -99,6 +102,10 @@ public class ListTemplatesCmd extends BaseListTaggedResourcesCmd {
return (showRemoved != null ? showRemoved : false);
}
+ public Long getParentTemplateId() {
+ return parentTemplateId;
+ }
+
public boolean listInReadyState() {
Account account = CallContext.current().getCallingAccount();
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a6fd25ac/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 8e020fc..96f759b 100644
--- a/server/src/com/cloud/api/query/QueryManagerImpl.java
+++ b/server/src/com/cloud/api/query/QueryManagerImpl.java
@@ -2812,6 +2812,7 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
Long id = cmd.getId();
Map<String, String> tags = cmd.getTags();
boolean showRemovedTmpl = cmd.getShowRemoved();
+ Long parentTemplateId = cmd.getParentTemplateId();
Account caller = CallContext.current().getCallingAccount();
// TODO: listAll flag has some conflicts with TemplateFilter parameter
@@ -2841,7 +2842,7 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
return searchForTemplatesInternalIAM(id, cmd.getTemplateName(), cmd.getKeyword(), templateFilter, false, null,
cmd.getPageSizeVal(), cmd.getStartIndex(), cmd.getZoneId(), hypervisorType, showDomr,
- cmd.listInReadyState(), permittedDomains, permittedAccounts, permittedResources, isRecursive, caller, listProjectResourcesCriteria, tags, showRemovedTmpl);
+ cmd.listInReadyState(), permittedDomains, permittedAccounts, permittedResources, isRecursive, caller, listProjectResourcesCriteria, tags, showRemovedTmpl, parentTemplateId);
}
// Temporarily disable this method which used IAM model to do template list
@@ -2850,7 +2851,7 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
Long startIndex, Long zoneId, HypervisorType hyperType, boolean showDomr, boolean onlyReady,
List<Long> permittedDomains, List<Long> permittedAccounts, List<Long> permittedResources, boolean isRecursive, Account caller,
ListProjectResourcesCriteria listProjectResourcesCriteria,
- Map<String, String> tags, boolean showRemovedTmpl) {
+ Map<String, String> tags, boolean showRemovedTmpl, Long parentTemplateId) {
// check if zone is configured, if not, just return empty list
List<HypervisorType> hypers = null;
@@ -3047,6 +3048,10 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
sc.addAnd("dataCenterId", SearchCriteria.Op.SC, zoneSc);
}
+ if (parentTemplateId != null) {
+ sc.addAnd("parentTemplateId", SearchCriteria.Op.EQ, parentTemplateId);
+ }
+
// don't return removed template, this should not be needed since we
// changed annotation for removed field in TemplateJoinVO.
// sc.addAnd("removed", SearchCriteria.Op.NULL);
@@ -3546,7 +3551,7 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
return searchForTemplatesInternalIAM(cmd.getId(), cmd.getIsoName(), cmd.getKeyword(), isoFilter, true,
cmd.isBootable(), cmd.getPageSizeVal(), cmd.getStartIndex(), cmd.getZoneId(), hypervisorType, true,
- cmd.listInReadyState(), permittedDomains, permittedAccounts, permittedResources, isRecursive, caller, listProjectResourcesCriteria, tags, showRemovedISO);
+ cmd.listInReadyState(), permittedDomains, permittedAccounts, permittedResources, isRecursive, caller, listProjectResourcesCriteria, tags, showRemovedISO, null);
}
@Override