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/01/21 10:30:15 UTC
git commit: updated refs/heads/master to 226b749
Updated Branches:
refs/heads/master 0846bfe1f -> 226b74913
CLOUDSTACK-5915. [AWSAPI] Instance launch is inconsistent if there are deleted service offerings
Use CS API listServiceOfferingsCmd to retrieve appropriate service offerings
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/226b7491
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/226b7491
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/226b7491
Branch: refs/heads/master
Commit: 226b74913134af6e541001159519cc2fcfc1ec21
Parents: 0846bfe
Author: Likitha Shetty <li...@citrix.com>
Authored: Tue Jan 21 14:35:48 2014 +0530
Committer: Likitha Shetty <li...@citrix.com>
Committed: Tue Jan 21 14:52:38 2014 +0530
----------------------------------------------------------------------
.../src/com/cloud/bridge/service/core/ec2/EC2Engine.java | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/226b7491/awsapi/src/com/cloud/bridge/service/core/ec2/EC2Engine.java
----------------------------------------------------------------------
diff --git a/awsapi/src/com/cloud/bridge/service/core/ec2/EC2Engine.java b/awsapi/src/com/cloud/bridge/service/core/ec2/EC2Engine.java
index 60f974a..ef7539f 100644
--- a/awsapi/src/com/cloud/bridge/service/core/ec2/EC2Engine.java
+++ b/awsapi/src/com/cloud/bridge/service/core/ec2/EC2Engine.java
@@ -66,6 +66,7 @@ import com.cloud.stack.models.CloudStackPasswordData;
import com.cloud.stack.models.CloudStackResourceLimit;
import com.cloud.stack.models.CloudStackResourceTag;
import com.cloud.stack.models.CloudStackSecurityGroup;
+import com.cloud.stack.models.CloudStackServiceOffering;
import com.cloud.stack.models.CloudStackSnapshot;
import com.cloud.stack.models.CloudStackTemplate;
import com.cloud.stack.models.CloudStackTemplatePermission;
@@ -1414,7 +1415,7 @@ public class EC2Engine extends ManagerBase {
if (request.getInstanceType() != null) {
instanceType = request.getInstanceType();
}
- CloudStackServiceOfferingVO svcOffering = getCSServiceOfferingId(instanceType);
+ CloudStackServiceOffering svcOffering = getCSServiceOfferingId(instanceType);
if (svcOffering == null) {
logger.info("No ServiceOffering found to be defined by name, please contact the administrator " + instanceType);
throw new Exception("instanceType not found");
@@ -1609,7 +1610,7 @@ public class EC2Engine extends ManagerBase {
if (request.getInstanceType() != null) {
String instanceType = request.getInstanceType();
- CloudStackServiceOfferingVO svcOffering = getCSServiceOfferingId(instanceType);
+ CloudStackServiceOffering svcOffering = getCSServiceOfferingId(instanceType);
if (svcOffering == null)
throw new Exception("instanceType not found");
CloudStackUserVm userVm = getApi().changeServiceForVirtualMachine(instanceId, svcOffering.getId());
@@ -1783,11 +1784,12 @@ public class EC2Engine extends ManagerBase {
*
*/
- private CloudStackServiceOfferingVO getCSServiceOfferingId(String instanceType) throws Exception {
+ private CloudStackServiceOffering getCSServiceOfferingId(String instanceType) throws Exception {
try {
if (instanceType == null)
instanceType = "m1.small"; // default value
- return scvoDao.getSvcOfferingByName(instanceType);
+ List<CloudStackServiceOffering> serviceOfferings = getApi().listServiceOfferings(null, null, false, null, instanceType, null, null);
+ return serviceOfferings.get(0);
} catch (Exception e) {
logger.error("Error while retrieving ServiceOffering information by name - ", e);
throw new Exception("No ServiceOffering found to be defined by name");