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/master to 790a02f
Date Mon, 29 Jul 2013 06:41:15 GMT
Updated Branches:
  refs/heads/master 57d96308c -> 790a02f93


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

Conflicts:

	api/src/org/apache/cloudstack/api/response/ServiceOfferingResponse.java


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

Branch: refs/heads/master
Commit: 790a02f936c6ff8dc974c8c9234cc1251460ab09
Parents: 57d9630
Author: Prachi Damle <prachi@cloud.com>
Authored: Sun Jul 28 22:44:00 2013 -0700
Committer: Prachi Damle <prachi@cloud.com>
Committed: Sun Jul 28 22:44:00 2013 -0700

----------------------------------------------------------------------
 .../api/response/ServiceOfferingResponse.java           | 12 ++++++++++++
 server/src/com/cloud/api/ApiDBUtils.java                |  9 +++++++++
 .../cloud/api/query/dao/ServiceOfferingJoinDaoImpl.java |  4 ++++
 3 files changed, 25 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/790a02f9/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 41a9b79..5c5b369 100644
--- a/api/src/org/apache/cloudstack/api/response/ServiceOfferingResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/ServiceOfferingResponse.java
@@ -18,8 +18,12 @@ package org.apache.cloudstack.api.response;
 
 import java.util.Date;
 
+
 import com.google.gson.annotations.SerializedName;
 
+import java.util.Map;
+
+
 import org.apache.cloudstack.api.ApiConstants;
 import org.apache.cloudstack.api.BaseResponse;
 import org.apache.cloudstack.api.EntityReference;
@@ -101,6 +105,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;
     }
@@ -275,4 +283,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/790a02f9/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 21fcb0c..5be8b15 100755
--- a/server/src/com/cloud/api/ApiDBUtils.java
+++ b/server/src/com/cloud/api/ApiDBUtils.java
@@ -223,6 +223,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;
@@ -404,6 +405,7 @@ public class ApiDBUtils {
     static AffinityGroupJoinDao _affinityGroupJoinDao;
     static GlobalLoadBalancingRulesService _gslbService;
     static NetworkACLDao _networkACLDao;
+    static ServiceOfferingDetailsDao _serviceOfferingDetailsDao;
 
     @Inject private ManagementServer ms;
     @Inject public AsyncJobManager asyncMgr;
@@ -513,6 +515,7 @@ public class ApiDBUtils {
     @Inject private AffinityGroupJoinDao affinityGroupJoinDao;
     @Inject private GlobalLoadBalancingRulesService gslbService;
     @Inject private NetworkACLDao networkACLDao;
+    @Inject private ServiceOfferingDetailsDao serviceOfferingDetailsDao;
 
     @PostConstruct
     void init() {
@@ -622,6 +625,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;
     }
 
     // ///////////////////////////////////////////////////////////
@@ -1684,4 +1688,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/790a02f9/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