You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by al...@apache.org on 2013/07/03 00:33:59 UTC

git commit: updated refs/heads/master-6-17-stable to b2d6c08

Updated Branches:
  refs/heads/master-6-17-stable a35ae3ca6 -> b2d6c0828


CLOUDSTACK-3207: added resourceLimit/resourceCount to the Project API response


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/b2d6c082
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/b2d6c082
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/b2d6c082

Branch: refs/heads/master-6-17-stable
Commit: b2d6c082838aa8e67003377855946a8c91094c35
Parents: a35ae3c
Author: Alena Prokharchyk <al...@citrix.com>
Authored: Tue Jul 2 14:29:36 2013 -0700
Committer: Alena Prokharchyk <al...@citrix.com>
Committed: Tue Jul 2 15:25:12 2013 -0700

----------------------------------------------------------------------
 .../api/response/AccountResponse.java           |  63 +++--
 .../api/response/ProjectResponse.java           | 268 ++++++++++++++++++-
 .../response/ResourceLimitAndCountResponse.java |  90 +++++++
 .../com/cloud/api/query/dao/AccountJoinDao.java |   6 +-
 .../cloud/api/query/dao/AccountJoinDaoImpl.java | 134 +++++-----
 .../cloud/api/query/dao/ProjectJoinDaoImpl.java |  14 +-
 .../com/cloud/api/query/vo/ProjectJoinVO.java   |   8 +-
 setup/db/db/schema-410to420.sql                 |  42 +++
 8 files changed, 539 insertions(+), 86 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b2d6c082/api/src/org/apache/cloudstack/api/response/AccountResponse.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/response/AccountResponse.java b/api/src/org/apache/cloudstack/api/response/AccountResponse.java
index 1e59822..0d4f239 100644
--- a/api/src/org/apache/cloudstack/api/response/AccountResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/AccountResponse.java
@@ -29,7 +29,7 @@ import com.google.gson.annotations.SerializedName;
 
 @SuppressWarnings("unused")
 @EntityReference(value = Account.class)
-public class AccountResponse extends BaseResponse {
+public class AccountResponse extends BaseResponse implements ResourceLimitAndCountResponse {
     @SerializedName(ApiConstants.ID) @Param(description="the id of the account")
     private String id;
 
@@ -168,7 +168,6 @@ public class AccountResponse extends BaseResponse {
     @SerializedName("secondarystorageavailable") @Param(description="the total secondary storage space (in GiB) available to be used for this account", since="4.2.0")
     private String secondaryStorageAvailable;
 
-
     @SerializedName(ApiConstants.STATE) @Param(description="the state of the account")
     private String state;
 
@@ -221,70 +220,87 @@ public class AccountResponse extends BaseResponse {
         this.bytesSent = bytesSent;
     }
 
+    @Override
     public void setVmLimit(String vmLimit) {
         this.vmLimit = vmLimit;
     }
 
+    @Override
     public void setVmTotal(Long vmTotal) {
         this.vmTotal = vmTotal;
     }
 
+    @Override
     public void setVmAvailable(String vmAvailable) {
         this.vmAvailable = vmAvailable;
     }
 
+    @Override
     public void setIpLimit(String ipLimit) {
         this.ipLimit = ipLimit;
     }
 
+    @Override
     public void setIpTotal(Long ipTotal) {
         this.ipTotal = ipTotal;
     }
 
+    @Override
     public void setIpAvailable(String ipAvailable) {
         this.ipAvailable = ipAvailable;
     }
 
+    @Override
     public void setVolumeLimit(String volumeLimit) {
         this.volumeLimit = volumeLimit;
     }
 
+    @Override
     public void setVolumeTotal(Long volumeTotal) {
         this.volumeTotal = volumeTotal;
     }
 
+    @Override
     public void setVolumeAvailable(String volumeAvailable) {
         this.volumeAvailable = volumeAvailable;
     }
 
+    @Override
     public void setSnapshotLimit(String snapshotLimit) {
         this.snapshotLimit = snapshotLimit;
     }
 
+    @Override
     public void setSnapshotTotal(Long snapshotTotal) {
         this.snapshotTotal = snapshotTotal;
     }
 
+    @Override
     public void setSnapshotAvailable(String snapshotAvailable) {
         this.snapshotAvailable = snapshotAvailable;
     }
 
+    @Override
     public void setTemplateLimit(String templateLimit) {
         this.templateLimit = templateLimit;
     }
 
+    @Override
     public void setTemplateTotal(Long templateTotal) {
         this.templateTotal = templateTotal;
     }
 
+    @Override
     public void setTemplateAvailable(String templateAvailable) {
         this.templateAvailable = templateAvailable;
     }
 
+    @Override
     public void setVmStopped(Integer vmStopped) {
         this.vmStopped = vmStopped;
     }
 
+    @Override
     public void setVmRunning(Integer vmRunning) {
         this.vmRunning = vmRunning;
     }
@@ -321,66 +337,81 @@ public class AccountResponse extends BaseResponse {
         this.projectAvailable = projectAvailable;
     }
 
+    @Override
     public void setNetworkLimit(String networkLimit) {
         this.networkLimit = networkLimit;
     }
 
+    @Override
     public void setNetworkTotal(Long networkTotal) {
         this.networkTotal = networkTotal;
     }
-
+    
+    @Override
     public void setNetworkAvailable(String networkAvailable) {
         this.networkAvailable = networkAvailable;
     }
-
+    
+    @Override
     public void setCpuLimit(String cpuLimit) {
         this.cpuLimit = cpuLimit;
     }
-
+    
+    @Override
     public void setCpuTotal(Long cpuTotal) {
         this.cpuTotal = cpuTotal;
     }
-
+    
+    @Override
     public void setCpuAvailable(String cpuAvailable) {
         this.cpuAvailable = cpuAvailable;
     }
-
+    
+    @Override
     public void setMemoryLimit(String memoryLimit) {
         this.memoryLimit = memoryLimit;
     }
-
+    
+    @Override
     public void setMemoryTotal(Long memoryTotal) {
         this.memoryTotal = memoryTotal;
     }
-
+    
+    @Override
     public void setMemoryAvailable(String memoryAvailable) {
         this.memoryAvailable = memoryAvailable;
     }
-
+    
+    @Override
     public void setPrimaryStorageLimit(String primaryStorageLimit) {
         this.primaryStorageLimit = primaryStorageLimit;
     }
-
+    
+    @Override
     public void setPrimaryStorageTotal(Long primaryStorageTotal) {
         this.primaryStorageTotal = primaryStorageTotal;
     }
-
+    
+    @Override
     public void setPrimaryStorageAvailable(String primaryStorageAvailable) {
         this.primaryStorageAvailable = primaryStorageAvailable;
     }
-
+    
+    @Override
     public void setSecondaryStorageLimit(String secondaryStorageLimit) {
         this.secondaryStorageLimit = secondaryStorageLimit;
     }
-
+    
+    @Override
     public void setSecondaryStorageTotal(Long secondaryStorageTotal) {
         this.secondaryStorageTotal = secondaryStorageTotal;
     }
-
+    
+    @Override
     public void setSecondaryStorageAvailable(String secondaryStorageAvailable) {
         this.secondaryStorageAvailable = secondaryStorageAvailable;
     }
-
+    
     public void setDefaultZone(String defaultZoneId) {
         this.defaultZoneId = defaultZoneId;
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b2d6c082/api/src/org/apache/cloudstack/api/response/ProjectResponse.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/response/ProjectResponse.java b/api/src/org/apache/cloudstack/api/response/ProjectResponse.java
index cff27e5..4fdd137 100644
--- a/api/src/org/apache/cloudstack/api/response/ProjectResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/ProjectResponse.java
@@ -29,7 +29,7 @@ import com.google.gson.annotations.SerializedName;
 
 @EntityReference(value=Project.class)
 @SuppressWarnings("unused")
-public class ProjectResponse extends BaseResponse {
+public class ProjectResponse extends BaseResponse implements ResourceLimitAndCountResponse{
 
     @SerializedName(ApiConstants.ID) @Param(description="the id of the project")
     private String id;
@@ -54,6 +54,111 @@ public class ProjectResponse extends BaseResponse {
 
     @SerializedName(ApiConstants.TAGS)  @Param(description="the list of resource tags associated with vm", responseObject = ResourceTagResponse.class)
     private List<ResourceTagResponse> tags = new ArrayList<ResourceTagResponse>();
+    
+    @SerializedName("networklimit") @Param(description="the total number of networks the project can own", since="4.2.0")
+    private String networkLimit;
+
+    @SerializedName("networktotal") @Param(description="the total number of networks owned by project", since="4.2.0")
+    private Long networkTotal;
+
+    @SerializedName("networkavailable") @Param(description="the total number of networks available to be created for this project", since="4.2.0")
+    private String networkAvailable;
+
+    @SerializedName("vpclimit") @Param(description="the total number of vpcs the project can own", since="4.2.0")
+    private String vpcLimit;
+
+    @SerializedName("vpctotal") @Param(description="the total number of vpcs owned by project", since="4.2.0")
+    private Long vpcTotal;
+
+    @SerializedName("vpcavailable") @Param(description="the total number of vpcs available to be created for this project", since="4.2.0")
+    private String vpcAvailable;
+
+    @SerializedName("cpulimit") @Param(description="the total number of cpu cores the project can own", since="4.2.0")
+    private String cpuLimit;
+
+    @SerializedName("cputotal") @Param(description="the total number of cpu cores owned by project", since="4.2.0")
+    private Long cpuTotal;
+
+    @SerializedName("cpuavailable") @Param(description="the total number of cpu cores available to be created for this project", since="4.2.0")
+    private String cpuAvailable;
+
+    @SerializedName("memorylimit") @Param(description="the total memory (in MB) the project can own", since="4.2.0")
+    private String memoryLimit;
+
+    @SerializedName("memorytotal") @Param(description="the total memory (in MB) owned by project", since="4.2.0")
+    private Long memoryTotal;
+
+    @SerializedName("memoryavailable") @Param(description="the total memory (in MB) available to be created for this project", since="4.2.0")
+    private String memoryAvailable;
+
+    @SerializedName("primarystoragelimit") @Param(description="the total primary storage space (in GiB) the project can own", since="4.2.0")
+    private String primaryStorageLimit;
+
+    @SerializedName("primarystoragetotal") @Param(description="the total primary storage space (in GiB) owned by project", since="4.2.0")
+    private Long primaryStorageTotal;
+
+    @SerializedName("primarystorageavailable") @Param(description="the total primary storage space (in GiB) available to be used for this project", since="4.2.0")
+    private String primaryStorageAvailable;
+
+    @SerializedName("secondarystoragelimit") @Param(description="the total secondary storage space (in GiB) the project can own", since="4.2.0")
+    private String secondaryStorageLimit;
+
+    @SerializedName("secondarystoragetotal") @Param(description="the total secondary storage space (in GiB) owned by project", since="4.2.0")
+    private Long secondaryStorageTotal;
+
+    @SerializedName("secondarystorageavailable") @Param(description="the total secondary storage space (in GiB) available to be used for this project", since="4.2.0")
+    private String secondaryStorageAvailable;
+    
+    @SerializedName(ApiConstants.VM_LIMIT) @Param(description="the total number of virtual machines that can be deployed by this project", since="4.2.0")
+    private String vmLimit;
+
+    @SerializedName(ApiConstants.VM_TOTAL) @Param(description="the total number of virtual machines deployed by this project", since="4.2.0")
+    private Long vmTotal;
+
+    @SerializedName(ApiConstants.VM_AVAILABLE) @Param(description="the total number of virtual machines available for this project to acquire", since="4.2.0")
+    private String vmAvailable;
+
+    @SerializedName(ApiConstants.IP_LIMIT) @Param(description="the total number of public ip addresses this project can acquire", since="4.2.0")
+    private String ipLimit;
+
+    @SerializedName(ApiConstants.IP_TOTAL) @Param(description="the total number of public ip addresses allocated for this project", since="4.2.0")
+    private Long ipTotal;
+
+    @SerializedName(ApiConstants.IP_AVAILABLE) @Param(description="the total number of public ip addresses available for this project to acquire", since="4.2.0")
+    private String ipAvailable;
+
+    @SerializedName("volumelimit") @Param(description="the total volume which can be used by this project", since="4.2.0")
+    private String volumeLimit;
+
+    @SerializedName("volumetotal") @Param(description="the total volume being used by this project", since="4.2.0")
+    private Long volumeTotal;
+
+    @SerializedName("volumeavailable") @Param(description="the total volume available for this project", since="4.2.0")
+    private String volumeAvailable;
+
+    @SerializedName("snapshotlimit") @Param(description="the total number of snapshots which can be stored by this project", since="4.2.0")
+    private String snapshotLimit;
+
+    @SerializedName("snapshottotal") @Param(description="the total number of snapshots stored by this project", since="4.2.0")
+    private Long snapshotTotal;
+
+    @SerializedName("snapshotavailable") @Param(description="the total number of snapshots available for this project", since="4.2.0")
+    private String snapshotAvailable;
+
+    @SerializedName("templatelimit") @Param(description="the total number of templates which can be created by this project", since="4.2.0")
+    private String templateLimit;
+
+    @SerializedName("templatetotal") @Param(description="the total number of templates which have been created by this project", since="4.2.0")
+    private Long templateTotal;
+
+    @SerializedName("templateavailable") @Param(description="the total number of templates available to be created by this project", since="4.2.0")
+    private String templateAvailable;
+
+    @SerializedName("vmstopped") @Param(description="the total number of virtual machines stopped for this project", since="4.2.0")
+    private Integer vmStopped;
+
+    @SerializedName("vmrunning") @Param(description="the total number of virtual machines running for this project", since="4.2.0")
+    private Integer vmRunning;
 
 
     public void setId(String id) {
@@ -91,4 +196,165 @@ public class ProjectResponse extends BaseResponse {
     public void addTag(ResourceTagResponse tag){
         this.tags.add(tag);
     }
+    
+    @Override
+    public void setVmLimit(String vmLimit) {
+        this.vmLimit = vmLimit;
+    }
+
+    @Override
+    public void setVmTotal(Long vmTotal) {
+        this.vmTotal = vmTotal;
+    }
+
+    @Override
+    public void setVmAvailable(String vmAvailable) {
+        this.vmAvailable = vmAvailable;
+    }
+
+    @Override
+    public void setIpLimit(String ipLimit) {
+        this.ipLimit = ipLimit;
+    }
+
+    @Override
+    public void setIpTotal(Long ipTotal) {
+        this.ipTotal = ipTotal;
+    }
+
+    @Override
+    public void setIpAvailable(String ipAvailable) {
+        this.ipAvailable = ipAvailable;
+    }
+
+    @Override
+    public void setVolumeLimit(String volumeLimit) {
+        this.volumeLimit = volumeLimit;
+    }
+
+    @Override
+    public void setVolumeTotal(Long volumeTotal) {
+        this.volumeTotal = volumeTotal;
+    }
+
+    @Override
+    public void setVolumeAvailable(String volumeAvailable) {
+        this.volumeAvailable = volumeAvailable;
+    }
+
+    @Override
+    public void setSnapshotLimit(String snapshotLimit) {
+        this.snapshotLimit = snapshotLimit;
+    }
+
+    @Override
+    public void setSnapshotTotal(Long snapshotTotal) {
+        this.snapshotTotal = snapshotTotal;
+    }
+
+    @Override
+    public void setSnapshotAvailable(String snapshotAvailable) {
+        this.snapshotAvailable = snapshotAvailable;
+    }
+
+    @Override
+    public void setTemplateLimit(String templateLimit) {
+        this.templateLimit = templateLimit;
+    }
+
+    @Override
+    public void setTemplateTotal(Long templateTotal) {
+        this.templateTotal = templateTotal;
+    }
+
+    @Override
+    public void setTemplateAvailable(String templateAvailable) {
+        this.templateAvailable = templateAvailable;
+    }
+
+    @Override
+    public void setVmStopped(Integer vmStopped) {
+        this.vmStopped = vmStopped;
+    }
+
+    @Override
+    public void setVmRunning(Integer vmRunning) {
+        this.vmRunning = vmRunning;
+    }
+    
+    @Override
+    public void setNetworkLimit(String networkLimit) {
+        this.networkLimit = networkLimit;
+    }
+
+    @Override
+    public void setNetworkTotal(Long networkTotal) {
+        this.networkTotal = networkTotal;
+    }
+    
+    @Override
+    public void setNetworkAvailable(String networkAvailable) {
+        this.networkAvailable = networkAvailable;
+    }
+    
+    @Override
+    public void setCpuLimit(String cpuLimit) {
+        this.cpuLimit = cpuLimit;
+    }
+    
+    @Override
+    public void setCpuTotal(Long cpuTotal) {
+        this.cpuTotal = cpuTotal;
+    }
+    
+    @Override
+    public void setCpuAvailable(String cpuAvailable) {
+        this.cpuAvailable = cpuAvailable;
+    }
+    
+    @Override
+    public void setMemoryLimit(String memoryLimit) {
+        this.memoryLimit = memoryLimit;
+    }
+    
+    @Override
+    public void setMemoryTotal(Long memoryTotal) {
+        this.memoryTotal = memoryTotal;
+    }
+    
+    @Override
+    public void setMemoryAvailable(String memoryAvailable) {
+        this.memoryAvailable = memoryAvailable;
+    }
+    
+    @Override
+    public void setPrimaryStorageLimit(String primaryStorageLimit) {
+        this.primaryStorageLimit = primaryStorageLimit;
+    }
+    
+    @Override
+    public void setPrimaryStorageTotal(Long primaryStorageTotal) {
+        this.primaryStorageTotal = primaryStorageTotal;
+    }
+    
+    @Override
+    public void setPrimaryStorageAvailable(String primaryStorageAvailable) {
+        this.primaryStorageAvailable = primaryStorageAvailable;
+    }
+    
+    @Override
+    public void setSecondaryStorageLimit(String secondaryStorageLimit) {
+        this.secondaryStorageLimit = secondaryStorageLimit;
+    }
+    
+    @Override
+    public void setSecondaryStorageTotal(Long secondaryStorageTotal) {
+        this.secondaryStorageTotal = secondaryStorageTotal;
+    }
+    
+    @Override
+    public void setSecondaryStorageAvailable(String secondaryStorageAvailable) {
+        this.secondaryStorageAvailable = secondaryStorageAvailable;
+    }
+    
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b2d6c082/api/src/org/apache/cloudstack/api/response/ResourceLimitAndCountResponse.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/response/ResourceLimitAndCountResponse.java b/api/src/org/apache/cloudstack/api/response/ResourceLimitAndCountResponse.java
new file mode 100644
index 0000000..57aabdd
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/response/ResourceLimitAndCountResponse.java
@@ -0,0 +1,90 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+
+/**This interface is implemented by AccountResponse and ProjectResponse as both of them
+have limits and resource count **/
+
+package org.apache.cloudstack.api.response;
+
+public interface ResourceLimitAndCountResponse {
+    
+    public void setNetworkLimit(String networkLimit);
+
+    public void setNetworkTotal(Long networkTotal);
+
+    public void setNetworkAvailable(String networkAvailable);
+
+    public void setCpuLimit(String cpuLimit);
+
+    public void setCpuTotal(Long cpuTotal);
+
+    public void setCpuAvailable(String cpuAvailable);
+
+    public void setMemoryLimit(String memoryLimit);
+
+    public void setMemoryTotal(Long memoryTotal);
+
+    public void setMemoryAvailable(String memoryAvailable);
+
+    public void setPrimaryStorageLimit(String primaryStorageLimit);
+
+    public void setPrimaryStorageTotal(Long primaryStorageTotal);
+
+    public void setPrimaryStorageAvailable(String primaryStorageAvailable) ;
+
+    public void setSecondaryStorageLimit(String secondaryStorageLimit);
+    
+    public void setSecondaryStorageTotal(Long secondaryStorageTotal);
+
+    public void setSecondaryStorageAvailable(String secondaryStorageAvailable);
+    
+    public void setVmLimit(String vmLimit);
+
+    public void setVmTotal(Long vmTotal);
+
+    public void setVmAvailable(String vmAvailable);
+
+    public void setIpLimit(String ipLimit);
+
+    public void setIpTotal(Long ipTotal);
+
+    public void setIpAvailable(String ipAvailable);
+
+    public void setVolumeLimit(String volumeLimit);
+
+    public void setVolumeTotal(Long volumeTotal);
+
+    public void setVolumeAvailable(String volumeAvailable);
+
+    public void setSnapshotLimit(String snapshotLimit);
+
+    public void setSnapshotTotal(Long snapshotTotal);
+
+    public void setSnapshotAvailable(String snapshotAvailable);
+
+    public void setTemplateLimit(String templateLimit);
+
+    public void setTemplateTotal(Long templateTotal);
+
+    public void setTemplateAvailable(String templateAvailable);
+
+    public void setVmStopped(Integer vmStopped);
+
+    public void setVmRunning(Integer vmRunning);
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b2d6c082/server/src/com/cloud/api/query/dao/AccountJoinDao.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/query/dao/AccountJoinDao.java b/server/src/com/cloud/api/query/dao/AccountJoinDao.java
index 5485f09..01d37a6 100644
--- a/server/src/com/cloud/api/query/dao/AccountJoinDao.java
+++ b/server/src/com/cloud/api/query/dao/AccountJoinDao.java
@@ -16,9 +16,9 @@
 // under the License.
 package com.cloud.api.query.dao;
 
-import java.util.List;
-
 import org.apache.cloudstack.api.response.AccountResponse;
+import org.apache.cloudstack.api.response.ResourceLimitAndCountResponse;
+
 import com.cloud.api.query.vo.AccountJoinVO;
 import com.cloud.user.Account;
 import com.cloud.utils.db.GenericDao;
@@ -29,4 +29,6 @@ public interface AccountJoinDao extends GenericDao<AccountJoinVO, Long> {
 
     AccountJoinVO newAccountView(Account vol);
 
+    void setResourceLimits(AccountJoinVO account, boolean accountIsAdmin, ResourceLimitAndCountResponse response);
+
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b2d6c082/server/src/com/cloud/api/query/dao/AccountJoinDaoImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/query/dao/AccountJoinDaoImpl.java b/server/src/com/cloud/api/query/dao/AccountJoinDaoImpl.java
index 528bdac..d83e60a 100644
--- a/server/src/com/cloud/api/query/dao/AccountJoinDaoImpl.java
+++ b/server/src/com/cloud/api/query/dao/AccountJoinDaoImpl.java
@@ -21,6 +21,7 @@ import java.util.List;
 import javax.ejb.Local;
 
 import org.apache.cloudstack.api.response.AccountResponse;
+import org.apache.cloudstack.api.response.ResourceLimitAndCountResponse;
 import org.apache.cloudstack.api.response.UserResponse;
 import org.apache.log4j.Logger;
 import org.springframework.stereotype.Component;
@@ -51,11 +52,8 @@ public class AccountJoinDaoImpl extends GenericDaoBase<AccountJoinVO, Long> impl
         this._count = "select count(distinct id) from account_view WHERE ";
     }
 
-
-
     @Override
     public AccountResponse newAccountResponse(AccountJoinVO account) {
-        boolean accountIsAdmin = (account.getType() == Account.ACCOUNT_TYPE_ADMIN);
         AccountResponse accountResponse = new AccountResponse();
         accountResponse.setId(account.getUuid());
         accountResponse.setName(account.getAccountName());
@@ -71,15 +69,47 @@ public class AccountJoinDaoImpl extends GenericDaoBase<AccountJoinVO, Long> impl
         accountResponse.setBytesReceived(account.getBytesReceived());
         accountResponse.setBytesSent(account.getBytesSent());
 
-        // Get resource limits and counts
+        boolean accountIsAdmin = (account.getType() == Account.ACCOUNT_TYPE_ADMIN);
+        setResourceLimits(account, accountIsAdmin, accountResponse);
+        
+        //get resource limits for projects
+        long projectLimit = ApiDBUtils.findCorrectResourceLimit(account.getProjectLimit(), account.getType(), ResourceType.project);
+        String projectLimitDisplay = (accountIsAdmin || projectLimit == -1) ? "Unlimited" : String.valueOf(projectLimit);
+        long projectTotal = (account.getProjectTotal() == null) ? 0 : account.getProjectTotal();
+        String projectAvail = (accountIsAdmin || projectLimit == -1) ? "Unlimited" : String.valueOf(projectLimit - projectTotal);
+        accountResponse.setProjectLimit(projectLimitDisplay);
+        accountResponse.setProjectTotal(projectTotal);
+        accountResponse.setProjectAvailable(projectAvail);
+
+        // set async job
+        if (account.getJobId() != null) {
+            accountResponse.setJobId(account.getJobUuid());
+            accountResponse.setJobStatus(account.getJobStatus());
+        }
+        
+        // adding all the users for an account as part of the response obj
+        List<UserAccountJoinVO> usersForAccount = ApiDBUtils.findUserViewByAccountId(account.getId());
+        List<UserResponse> userResponses = ViewResponseHelper.createUserResponse(usersForAccount.toArray(new UserAccountJoinVO[usersForAccount.size()]));
+        accountResponse.setUsers(userResponses);
+
+        // set details
+        accountResponse.setDetails(ApiDBUtils.getAccountDetails(account.getId()));
+        accountResponse.setObjectName("account");
+        
+        return accountResponse;
+    }
 
+
+    @Override
+    public void setResourceLimits(AccountJoinVO account, boolean accountIsAdmin, ResourceLimitAndCountResponse response) {
+        // Get resource limits and counts
         long vmLimit = ApiDBUtils.findCorrectResourceLimit(account.getVmLimit(), account.getType(), ResourceType.user_vm);
         String vmLimitDisplay = (accountIsAdmin || vmLimit == -1) ? "Unlimited" : String.valueOf(vmLimit);
         long vmTotal = (account.getVmTotal() == null) ? 0 : account.getVmTotal();
         String vmAvail = (accountIsAdmin || vmLimit == -1) ? "Unlimited" : String.valueOf(vmLimit - vmTotal);
-        accountResponse.setVmLimit(vmLimitDisplay);
-        accountResponse.setVmTotal(vmTotal);
-        accountResponse.setVmAvailable(vmAvail);
+        response.setVmLimit(vmLimitDisplay);
+        response.setVmTotal(vmTotal);
+        response.setVmAvailable(vmAvail);
 
         long ipLimit = ApiDBUtils.findCorrectResourceLimit(account.getIpLimit(), account.getType(), ResourceType.public_ip);
         String ipLimitDisplay = (accountIsAdmin || ipLimit == -1) ? "Unlimited" : String.valueOf(ipLimit);
@@ -97,117 +127,91 @@ public class AccountJoinDaoImpl extends GenericDaoBase<AccountJoinVO, Long> impl
 
         String ipAvail = ((accountIsAdmin || ipLimit == -1) && unlimited) ? "Unlimited" : String.valueOf(ips);
 
-        accountResponse.setIpLimit(ipLimitDisplay);
-        accountResponse.setIpTotal(ipTotal);
-        accountResponse.setIpAvailable(ipAvail);
+        response.setIpLimit(ipLimitDisplay);
+        response.setIpTotal(ipTotal);
+        response.setIpAvailable(ipAvail);
 
         long volumeLimit = ApiDBUtils.findCorrectResourceLimit(account.getVolumeLimit(), account.getType(), ResourceType.volume);
         String volumeLimitDisplay = (accountIsAdmin || volumeLimit == -1) ? "Unlimited" : String.valueOf(volumeLimit);
         long volumeTotal = (account.getVolumeTotal() == 0) ? 0 : account.getVolumeTotal();
         String volumeAvail = (accountIsAdmin || volumeLimit == -1) ? "Unlimited" : String.valueOf(volumeLimit - volumeTotal);
-        accountResponse.setVolumeLimit(volumeLimitDisplay);
-        accountResponse.setVolumeTotal(volumeTotal);
-        accountResponse.setVolumeAvailable(volumeAvail);
+        response.setVolumeLimit(volumeLimitDisplay);
+        response.setVolumeTotal(volumeTotal);
+        response.setVolumeAvailable(volumeAvail);
 
         long snapshotLimit = ApiDBUtils.findCorrectResourceLimit(account.getSnapshotLimit(), account.getType(), ResourceType.snapshot);
         String snapshotLimitDisplay = (accountIsAdmin || snapshotLimit == -1) ? "Unlimited" : String.valueOf(snapshotLimit);
         long snapshotTotal = (account.getSnapshotTotal() == null) ? 0 : account.getSnapshotTotal();
         String snapshotAvail = (accountIsAdmin || snapshotLimit == -1) ? "Unlimited" : String.valueOf(snapshotLimit - snapshotTotal);
-        accountResponse.setSnapshotLimit(snapshotLimitDisplay);
-        accountResponse.setSnapshotTotal(snapshotTotal);
-        accountResponse.setSnapshotAvailable(snapshotAvail);
+        response.setSnapshotLimit(snapshotLimitDisplay);
+        response.setSnapshotTotal(snapshotTotal);
+        response.setSnapshotAvailable(snapshotAvail);
 
         Long templateLimit = ApiDBUtils.findCorrectResourceLimit(account.getTemplateLimit(), account.getType(), ResourceType.template);
         String templateLimitDisplay = (accountIsAdmin || templateLimit == -1) ? "Unlimited" : String.valueOf(templateLimit);
         Long templateTotal = (account.getTemplateTotal() == null) ? 0 : account.getTemplateTotal();
         String templateAvail = (accountIsAdmin || templateLimit == -1) ? "Unlimited" : String.valueOf(templateLimit - templateTotal);
-        accountResponse.setTemplateLimit(templateLimitDisplay);
-        accountResponse.setTemplateTotal(templateTotal);
-        accountResponse.setTemplateAvailable(templateAvail);
+        response.setTemplateLimit(templateLimitDisplay);
+        response.setTemplateTotal(templateTotal);
+        response.setTemplateAvailable(templateAvail);
 
         // Get stopped and running VMs
-        accountResponse.setVmStopped(account.getVmStopped());
-        accountResponse.setVmRunning(account.getVmRunning());
-
-
-        //get resource limits for projects
-        long projectLimit = ApiDBUtils.findCorrectResourceLimit(account.getProjectLimit(), account.getType(), ResourceType.project);
-        String projectLimitDisplay = (accountIsAdmin || projectLimit == -1) ? "Unlimited" : String.valueOf(projectLimit);
-        long projectTotal = (account.getProjectTotal() == null) ? 0 : account.getProjectTotal();
-        String projectAvail = (accountIsAdmin || projectLimit == -1) ? "Unlimited" : String.valueOf(projectLimit - projectTotal);
-        accountResponse.setProjectLimit(projectLimitDisplay);
-        accountResponse.setProjectTotal(projectTotal);
-        accountResponse.setProjectAvailable(projectAvail);
+        response.setVmStopped(account.getVmStopped());
+        response.setVmRunning(account.getVmRunning());
 
         //get resource limits for networks
         long networkLimit = ApiDBUtils.findCorrectResourceLimit(account.getNetworkLimit(), account.getType(), ResourceType.network);
         String networkLimitDisplay = (accountIsAdmin || networkLimit == -1) ? "Unlimited" : String.valueOf(networkLimit);
         long networkTotal = (account.getNetworkTotal() == null) ? 0 : account.getNetworkTotal();
         String networkAvail = (accountIsAdmin || networkLimit == -1) ? "Unlimited" : String.valueOf(networkLimit - networkTotal);
-        accountResponse.setNetworkLimit(networkLimitDisplay);
-        accountResponse.setNetworkTotal(networkTotal);
-        accountResponse.setNetworkAvailable(networkAvail);
+        response.setNetworkLimit(networkLimitDisplay);
+        response.setNetworkTotal(networkTotal);
+        response.setNetworkAvailable(networkAvail);
 
         //get resource limits for vpcs
         long vpcLimit = ApiDBUtils.findCorrectResourceLimit(account.getVpcLimit(), account.getType(), ResourceType.vpc);
         String vpcLimitDisplay = (accountIsAdmin || vpcLimit == -1) ? "Unlimited" : String.valueOf(vpcLimit);
         long vpcTotal = (account.getVpcTotal() == null) ? 0 : account.getVpcTotal();
         String vpcAvail = (accountIsAdmin || vpcLimit == -1) ? "Unlimited" : String.valueOf(vpcLimit - vpcTotal);
-        accountResponse.setNetworkLimit(vpcLimitDisplay);
-        accountResponse.setNetworkTotal(vpcTotal);
-        accountResponse.setNetworkAvailable(vpcAvail);
+        response.setNetworkLimit(vpcLimitDisplay);
+        response.setNetworkTotal(vpcTotal);
+        response.setNetworkAvailable(vpcAvail);
 
         //get resource limits for cpu cores
         long cpuLimit = ApiDBUtils.findCorrectResourceLimit(account.getCpuLimit(), account.getType(), ResourceType.cpu);
         String cpuLimitDisplay = (accountIsAdmin || cpuLimit == -1) ? "Unlimited" : String.valueOf(cpuLimit);
         long cpuTotal = (account.getCpuTotal() == null) ? 0 : account.getCpuTotal();
         String cpuAvail = (accountIsAdmin || cpuLimit == -1) ? "Unlimited" : String.valueOf(cpuLimit - cpuTotal);
-        accountResponse.setCpuLimit(cpuLimitDisplay);
-        accountResponse.setCpuTotal(cpuTotal);
-        accountResponse.setCpuAvailable(cpuAvail);
+        response.setCpuLimit(cpuLimitDisplay);
+        response.setCpuTotal(cpuTotal);
+        response.setCpuAvailable(cpuAvail);
 
         //get resource limits for memory
         long memoryLimit = ApiDBUtils.findCorrectResourceLimit(account.getMemoryLimit(), account.getType(), ResourceType.memory);
         String memoryLimitDisplay = (accountIsAdmin || memoryLimit == -1) ? "Unlimited" : String.valueOf(memoryLimit);
         long memoryTotal = (account.getMemoryTotal() == null) ? 0 : account.getMemoryTotal();
         String memoryAvail = (accountIsAdmin || memoryLimit == -1) ? "Unlimited" : String.valueOf(memoryLimit - memoryTotal);
-        accountResponse.setMemoryLimit(memoryLimitDisplay);
-        accountResponse.setMemoryTotal(memoryTotal);
-        accountResponse.setMemoryAvailable(memoryAvail);
+        response.setMemoryLimit(memoryLimitDisplay);
+        response.setMemoryTotal(memoryTotal);
+        response.setMemoryAvailable(memoryAvail);
 
       //get resource limits for primary storage space and convert it from Bytes to GiB
         long primaryStorageLimit = ApiDBUtils.findCorrectResourceLimit(account.getPrimaryStorageLimit(), account.getType(), ResourceType.primary_storage);
         String primaryStorageLimitDisplay = (accountIsAdmin || primaryStorageLimit == -1) ? "Unlimited" : String.valueOf(primaryStorageLimit / ResourceType.bytesToGiB);
         long primaryStorageTotal = (account.getPrimaryStorageTotal() == null) ? 0 : (account.getPrimaryStorageTotal() / ResourceType.bytesToGiB);
         String primaryStorageAvail = (accountIsAdmin || primaryStorageLimit == -1) ? "Unlimited" : String.valueOf((primaryStorageLimit / ResourceType.bytesToGiB) - primaryStorageTotal);
-        accountResponse.setPrimaryStorageLimit(primaryStorageLimitDisplay);
-        accountResponse.setPrimaryStorageTotal(primaryStorageTotal);
-        accountResponse.setPrimaryStorageAvailable(primaryStorageAvail);
+        response.setPrimaryStorageLimit(primaryStorageLimitDisplay);
+        response.setPrimaryStorageTotal(primaryStorageTotal);
+        response.setPrimaryStorageAvailable(primaryStorageAvail);
 
         //get resource limits for secondary storage space and convert it from Bytes to GiB
         long secondaryStorageLimit = ApiDBUtils.findCorrectResourceLimit(account.getSecondaryStorageLimit(), account.getType(), ResourceType.secondary_storage);
         String secondaryStorageLimitDisplay = (accountIsAdmin || secondaryStorageLimit == -1) ? "Unlimited" : String.valueOf(secondaryStorageLimit / ResourceType.bytesToGiB);
         long secondaryStorageTotal = (account.getSecondaryStorageTotal() == null) ? 0 : (account.getSecondaryStorageTotal() / ResourceType.bytesToGiB);
         String secondaryStorageAvail = (accountIsAdmin || secondaryStorageLimit == -1) ? "Unlimited" : String.valueOf((secondaryStorageLimit / ResourceType.bytesToGiB) - secondaryStorageTotal);
-        accountResponse.setSecondaryStorageLimit(secondaryStorageLimitDisplay);
-        accountResponse.setSecondaryStorageTotal(secondaryStorageTotal);
-        accountResponse.setSecondaryStorageAvailable(secondaryStorageAvail);
-
-        // adding all the users for an account as part of the response obj
-        List<UserAccountJoinVO> usersForAccount = ApiDBUtils.findUserViewByAccountId(account.getId());
-        List<UserResponse> userResponses = ViewResponseHelper.createUserResponse(usersForAccount.toArray(new UserAccountJoinVO[usersForAccount.size()]));
-        accountResponse.setUsers(userResponses);
-
-        // set details
-        accountResponse.setDetails(ApiDBUtils.getAccountDetails(account.getId()));
-        accountResponse.setObjectName("account");
-
-        // set async job
-        if (account.getJobId() != null) {
-            accountResponse.setJobId(account.getJobUuid());
-            accountResponse.setJobStatus(account.getJobStatus());
-        }
-        return accountResponse;
+        response.setSecondaryStorageLimit(secondaryStorageLimitDisplay);
+        response.setSecondaryStorageTotal(secondaryStorageTotal);
+        response.setSecondaryStorageAvailable(secondaryStorageAvail);
     }
 
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b2d6c082/server/src/com/cloud/api/query/dao/ProjectJoinDaoImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/query/dao/ProjectJoinDaoImpl.java b/server/src/com/cloud/api/query/dao/ProjectJoinDaoImpl.java
index 5b2a350..6c98f8c 100644
--- a/server/src/com/cloud/api/query/dao/ProjectJoinDaoImpl.java
+++ b/server/src/com/cloud/api/query/dao/ProjectJoinDaoImpl.java
@@ -27,10 +27,13 @@ import org.apache.log4j.Logger;
 import org.springframework.stereotype.Component;
 
 import com.cloud.api.ApiDBUtils;
+import com.cloud.api.query.vo.AccountJoinVO;
 import com.cloud.api.query.vo.ProjectJoinVO;
 import com.cloud.api.query.vo.ResourceTagJoinVO;
 import com.cloud.configuration.dao.ConfigurationDao;
 import com.cloud.projects.Project;
+import com.cloud.user.Account;
+import com.cloud.user.dao.AccountDao;
 import com.cloud.utils.db.GenericDaoBase;
 import com.cloud.utils.db.SearchBuilder;
 import com.cloud.utils.db.SearchCriteria;
@@ -42,6 +45,10 @@ public class ProjectJoinDaoImpl extends GenericDaoBase<ProjectJoinVO, Long> impl
 
     @Inject
     private ConfigurationDao  _configDao;
+    @Inject
+    private AccountJoinDao _accountJoinDao;
+    @Inject
+    private AccountDao _accountDao;
 
     private final SearchBuilder<ProjectJoinVO> prjSearch;
 
@@ -82,7 +89,12 @@ public class ProjectJoinDaoImpl extends GenericDaoBase<ProjectJoinVO, Long> impl
                 response.addTag(ApiDBUtils.newResourceTagResponse(vtag, false));
             }
         }
-
+        
+        //set resource limit/count information for the project (by getting the info of the project's account)
+        Account account = _accountDao.findById(proj.getProjectAccountId());
+        AccountJoinVO accountJn = ApiDBUtils.newAccountView(account);
+        _accountJoinDao.setResourceLimits(accountJn, false, response);
+        
         response.setObjectName("project");
         return response;
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b2d6c082/server/src/com/cloud/api/query/vo/ProjectJoinVO.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/query/vo/ProjectJoinVO.java b/server/src/com/cloud/api/query/vo/ProjectJoinVO.java
index 4bfddef..3885fa0 100644
--- a/server/src/com/cloud/api/query/vo/ProjectJoinVO.java
+++ b/server/src/com/cloud/api/query/vo/ProjectJoinVO.java
@@ -49,7 +49,6 @@ public class ProjectJoinVO extends BaseViewVO implements InternalIdentity, Ident
     @Column(name="display_text")
     String displayText;
 
-
     @Column(name="owner")
     String owner;
 
@@ -108,6 +107,10 @@ public class ProjectJoinVO extends BaseViewVO implements InternalIdentity, Ident
 
     @Column(name="tag_customer")
     private String tagCustomer;
+    
+    @Column(name="project_account_id")
+    private long projectAccountId;
+    
 
     public ProjectJoinVO() {
     }
@@ -301,4 +304,7 @@ public class ProjectJoinVO extends BaseViewVO implements InternalIdentity, Ident
         this.accountId = accountId;
     }
 
+    public long getProjectAccountId() {
+        return projectAccountId;
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b2d6c082/setup/db/db/schema-410to420.sql
----------------------------------------------------------------------
diff --git a/setup/db/db/schema-410to420.sql b/setup/db/db/schema-410to420.sql
index 8263ad2..11204c7 100644
--- a/setup/db/db/schema-410to420.sql
+++ b/setup/db/db/schema-410to420.sql
@@ -1863,3 +1863,45 @@ INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'manag
 alter table `cloud`.`network_offerings` add column egress_default_policy boolean default false;
 
 ALTER TABLE `cloud`.`vm_template` ADD COLUMN `dynamically_scalable` tinyint(1) unsigned NOT NULL DEFAULT 0  COMMENT 'true if template contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory';
+
+DROP VIEW IF EXISTS `cloud`.`project_view`;
+CREATE VIEW `cloud`.`project_view` AS
+    select 
+        projects.id,
+        projects.uuid,
+        projects.name,
+        projects.display_text,
+        projects.state,
+        projects.removed,
+        projects.created,
+        projects.project_account_id,
+        account.account_name owner,
+        pacct.account_id,
+        domain.id domain_id,
+        domain.uuid domain_uuid,
+        domain.name domain_name,
+        domain.path domain_path,
+        resource_tags.id tag_id,
+        resource_tags.uuid tag_uuid,
+        resource_tags.key tag_key,
+        resource_tags.value tag_value,
+        resource_tags.domain_id tag_domain_id,
+        resource_tags.account_id tag_account_id,
+        resource_tags.resource_id tag_resource_id,
+        resource_tags.resource_uuid tag_resource_uuid,
+        resource_tags.resource_type tag_resource_type,
+        resource_tags.customer tag_customer
+    from
+        `cloud`.`projects`
+            inner join
+        `cloud`.`domain` ON projects.domain_id = domain.id
+            inner join
+        `cloud`.`project_account` ON projects.id = project_account.project_id
+            and project_account.account_role = 'Admin'
+            inner join
+        `cloud`.`account` ON account.id = project_account.account_id
+            left join
+        `cloud`.`resource_tags` ON resource_tags.resource_id = projects.id
+            and resource_tags.resource_type = 'Project'
+            left join
+        `cloud`.`project_account` pacct ON projects.id = pacct.project_id;
\ No newline at end of file