From 4c163bfab0fa9af877f496ccc492db98d9addb94 Mon Sep 17 00:00:00 2001 From: prachi Date: Mon, 7 May 2012 16:06:17 -0700 Subject: [PATCH] CS-14687: When a valid instance id that does not belong to the current user is passed to ec2-stop-instances,ec2-start-instances,ec2-terminate-instances, api does not return anythin Changes: Throw error if LookUpInstances fails to list the Vm by id. --- awsapi/src/com/cloud/bridge/service/core/ec2/EC2Engine.java | 5 +++++ 1 file changed, 5 insertions(+) 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 f187efa7820..cf2639c1f5f 100644 --- a/awsapi/src/com/cloud/bridge/service/core/ec2/EC2Engine.java +++ b/awsapi/src/com/cloud/bridge/service/core/ec2/EC2Engine.java @@ -1795,6 +1795,11 @@ public class EC2Engine { } instances.addInstance(ec2Vm); } + }else{ + if(instanceId != null){ + //no such instance found + throw new EC2ServiceException(ServerError.InternalError, "Instance:" + instanceId + " not found"); + } } return instances; }