From f92482fabf47db641fa87a3f6ea5c8b0ff24f1fa Mon Sep 17 00:00:00 2001 From: Kelven Yang Date: Fri, 17 Dec 2010 19:41:12 -0800 Subject: [PATCH] add clustertype and hypervisortype to ListClusterCmd API, improve addHost UI to deal with multi-hypervisor --- .../cloud/api/commands/ListClustersCmd.java | 14 +++ .../cloud/server/ManagementServerImpl.java | 10 ++ ui/jsp/pod.jsp | 47 +++++++- ui/jsp/zone.jsp | 51 +++++++-- ui/scripts/cloud.core.cluster.js | 2 + ui/scripts/cloud.core.pod.js | 105 ++++++++++++------ ui/scripts/cloud.core.zone.js | 105 ++++++++++++------ 7 files changed, 258 insertions(+), 76 deletions(-) diff --git a/api/src/com/cloud/api/commands/ListClustersCmd.java b/api/src/com/cloud/api/commands/ListClustersCmd.java index 92061e267e3..de2a2de1058 100644 --- a/api/src/com/cloud/api/commands/ListClustersCmd.java +++ b/api/src/com/cloud/api/commands/ListClustersCmd.java @@ -53,6 +53,12 @@ public class ListClustersCmd extends BaseListCmd { @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, description="lists clusters by Zone ID") private Long zoneId; + @Parameter(name=ApiConstants.HYPERVISOR, type=CommandType.STRING, description="lists clusters by hypervisor type") + private String hypervisorType; + + @Parameter(name=ApiConstants.CLUSTER_TYPE, type=CommandType.STRING, description="lists clusters by cluster type") + private String clusterType; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// @@ -73,6 +79,14 @@ public class ListClustersCmd extends BaseListCmd { public Long getZoneId() { return zoneId; } + + public String getHypervisorType() { + return hypervisorType; + } + + public String getClusterType() { + return clusterType; + } ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// diff --git a/server/src/com/cloud/server/ManagementServerImpl.java b/server/src/com/cloud/server/ManagementServerImpl.java index 62430c47647..00e68c2993f 100755 --- a/server/src/com/cloud/server/ManagementServerImpl.java +++ b/server/src/com/cloud/server/ManagementServerImpl.java @@ -1254,6 +1254,8 @@ public class ManagementServerImpl implements ManagementServer { Object name = cmd.getClusterName(); Object podId = cmd.getPodId(); Object zoneId = cmd.getZoneId(); + Object hypervisorType = cmd.getHypervisorType(); + Object clusterType = cmd.getClusterType(); if (id != null) { sc.addAnd("id", SearchCriteria.Op.EQ, id); @@ -1270,6 +1272,14 @@ public class ManagementServerImpl implements ManagementServer { if (zoneId != null) { sc.addAnd("dataCenterId", SearchCriteria.Op.EQ, zoneId); } + + if(hypervisorType != null) { + sc.addAnd("hypervisorType", SearchCriteria.Op.EQ, hypervisorType); + } + + if(clusterType != null) { + sc.addAnd("clusterType", SearchCriteria.Op.EQ, clusterType); + } return _clusterDao.search(sc, searchFilter); } diff --git a/ui/jsp/pod.jsp b/ui/jsp/pod.jsp index 2efcfda7596..977ea8b7362 100644 --- a/ui/jsp/pod.jsp +++ b/ui/jsp/pod.jsp @@ -241,27 +241,62 @@ -
  • +
  • -
  • +
  • -
  • +
  • +
  • + + + +
  • +
  • + + + +
  • +
  • + + + +
  • +
  • + + + +
  • +
  • + + + +
  • Cluster Options
  • @@ -305,7 +340,7 @@ -