cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From prachida...@apache.org
Subject git commit: updated refs/heads/4.2 to 027d487
Date Mon, 29 Jul 2013 05:36:24 GMT
Updated Branches:
  refs/heads/4.2 6f9c26ea4 -> 027d4873b


CLOUDSTACK-3343 UI/API should also return the mode(Strict/Preferred) when listing the ServiceOffering
that uses ImplicitDedicationPlanner

Changes:
- API is fixed to return the service_offering details


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

Branch: refs/heads/4.2
Commit: 027d4873b490ba852014f017ca8d08607be863b6
Parents: 6f9c26e
Author: Prachi Damle <prachi@cloud.com>
Authored: Sun Jul 28 22:09:54 2013 -0700
Committer: Prachi Damle <prachi@cloud.com>
Committed: Sun Jul 28 22:10:37 2013 -0700

----------------------------------------------------------------------
 .../cloudstack/api/response/ServiceOfferingResponse.java | 11 +++++++++--
 server/src/com/cloud/api/ApiDBUtils.java                 |  9 +++++++++
 .../cloud/api/query/dao/ServiceOfferingJoinDaoImpl.java  |  4 ++++
 3 files changed, 22 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/027d4873/api/src/org/apache/cloudstack/api/response/ServiceOfferingResponse.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/response/ServiceOfferingResponse.java b/api/src/org/apache/cloudstack/api/response/ServiceOfferingResponse.java
index 288f76b..02fa7ce 100644
--- a/api/src/org/apache/cloudstack/api/response/ServiceOfferingResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/ServiceOfferingResponse.java
@@ -17,8 +17,7 @@
 package org.apache.cloudstack.api.response;
 
 import java.util.Date;
-
-import javax.persistence.Column;
+import java.util.Map;
 
 import org.apache.cloudstack.api.ApiConstants;
 import org.apache.cloudstack.api.BaseResponse;
@@ -102,6 +101,10 @@ public class ServiceOfferingResponse extends BaseResponse {
     @SerializedName(ApiConstants.DEPLOYMENT_PLANNER) @Param(description="deployment strategy
used to deploy VM.")
     private String deploymentPlanner;
 
+    @SerializedName(ApiConstants.SERVICE_OFFERING_DETAILS)
+    @Param(description = "additional key/value details tied with this service offering",
since = "4.2.0")
+    private Map<String, String> details;
+
     public String getId() {
         return id;
     }
@@ -276,4 +279,8 @@ public class ServiceOfferingResponse extends BaseResponse {
     public void setIopsWriteRate(Long iopsWriteRate) {
         this.iopsWriteRate = iopsWriteRate;
     }
+
+    public void setDetails(Map<String, String> details) {
+        this.details = details;
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/027d4873/server/src/com/cloud/api/ApiDBUtils.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/ApiDBUtils.java b/server/src/com/cloud/api/ApiDBUtils.java
index b3dbe8d..35e89f9 100755
--- a/server/src/com/cloud/api/ApiDBUtils.java
+++ b/server/src/com/cloud/api/ApiDBUtils.java
@@ -222,6 +222,7 @@ import com.cloud.server.StatsCollector;
 import com.cloud.server.TaggedResourceService;
 import com.cloud.service.ServiceOfferingVO;
 import com.cloud.service.dao.ServiceOfferingDao;
+import com.cloud.service.dao.ServiceOfferingDetailsDao;
 import com.cloud.storage.DiskOfferingVO;
 import com.cloud.storage.GuestOS;
 import com.cloud.storage.GuestOSCategoryVO;
@@ -403,6 +404,7 @@ public class ApiDBUtils {
     static AffinityGroupJoinDao _affinityGroupJoinDao;
     static GlobalLoadBalancingRulesService _gslbService;
     static NetworkACLDao _networkACLDao;
+    static ServiceOfferingDetailsDao _serviceOfferingDetailsDao;
 
     @Inject private ManagementServer ms;
     @Inject public AsyncJobManager asyncMgr;
@@ -512,6 +514,7 @@ public class ApiDBUtils {
     @Inject private AffinityGroupJoinDao affinityGroupJoinDao;
     @Inject private GlobalLoadBalancingRulesService gslbService;
     @Inject private NetworkACLDao networkACLDao;
+    @Inject private ServiceOfferingDetailsDao serviceOfferingDetailsDao;
 
     @PostConstruct
     void init() {
@@ -621,6 +624,7 @@ public class ApiDBUtils {
         // Note: stats collector should already have been initialized by this time, otherwise
a null instance is returned
         _statsCollector = StatsCollector.getInstance();
         _networkACLDao = networkACLDao;
+        _serviceOfferingDetailsDao = serviceOfferingDetailsDao;
     }
 
     // ///////////////////////////////////////////////////////////
@@ -1682,4 +1686,9 @@ public class ApiDBUtils {
         String providerDnsName = _configDao.getValue(Config.CloudDnsName.key());
         return providerDnsName;
     }
+    
+    public static Map<String, String> getServiceOfferingDetails(long serviceOfferingId)
{
+        Map<String, String> details = _serviceOfferingDetailsDao.findDetails(serviceOfferingId);
+        return details.isEmpty() ? null : details;
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/027d4873/server/src/com/cloud/api/query/dao/ServiceOfferingJoinDaoImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/query/dao/ServiceOfferingJoinDaoImpl.java b/server/src/com/cloud/api/query/dao/ServiceOfferingJoinDaoImpl.java
index 6f6e277..945e67b 100644
--- a/server/src/com/cloud/api/query/dao/ServiceOfferingJoinDaoImpl.java
+++ b/server/src/com/cloud/api/query/dao/ServiceOfferingJoinDaoImpl.java
@@ -17,15 +17,18 @@
 package com.cloud.api.query.dao;
 
 import java.util.List;
+import java.util.Map;
 
 import javax.ejb.Local;
 
 import org.apache.log4j.Logger;
 
+import com.cloud.api.ApiDBUtils;
 import com.cloud.api.query.vo.ServiceOfferingJoinVO;
 import org.apache.cloudstack.api.response.ServiceOfferingResponse;
 
 import com.cloud.offering.ServiceOffering;
+import com.cloud.offering.NetworkOffering.Detail;
 import com.cloud.utils.db.GenericDaoBase;
 import com.cloud.utils.db.SearchBuilder;
 import com.cloud.utils.db.SearchCriteria;
@@ -79,6 +82,7 @@ public class ServiceOfferingJoinDaoImpl extends GenericDaoBase<ServiceOfferingJo
         offeringResponse.setBytesWriteRate(offering.getBytesWriteRate());
         offeringResponse.setIopsReadRate(offering.getIopsReadRate());
         offeringResponse.setIopsWriteRate(offering.getIopsWriteRate());
+        offeringResponse.setDetails(ApiDBUtils.getServiceOfferingDetails(offering.getId()));
         offeringResponse.setObjectName("serviceoffering");
 
         return offeringResponse;


Mime
View raw message