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 15ed9083f84..715c83eeb4d 100644 --- a/awsapi/src/com/cloud/bridge/service/core/ec2/EC2Engine.java +++ b/awsapi/src/com/cloud/bridge/service/core/ec2/EC2Engine.java @@ -1184,14 +1184,23 @@ public class EC2Engine extends ManagerBase { String snapshotId = request.getSnapshotId(); Long size = request.getSize(); String diskOfferingId = null; + String taggedDiskOffering = null; if (snapshotId == null) { List disks = getApi().listDiskOfferings(null, null, null, null); for (CloudStackDiskOffering offer : disks) { if (offer.isCustomized()) { - diskOfferingId = offer.getId(); + if (offer.getTags() == null) { + diskOfferingId = offer.getId(); + break; + } else { + taggedDiskOffering = offer.getId(); + } } } + if (diskOfferingId == null) { + diskOfferingId = taggedDiskOffering; + } if (diskOfferingId == null) throw new EC2ServiceException(ServerError.InternalError, "No Customize Disk Offering Found"); } diff --git a/awsapi/src/com/cloud/stack/models/CloudStackDiskOffering.java b/awsapi/src/com/cloud/stack/models/CloudStackDiskOffering.java index 308941c7ef6..6e1b98e871a 100644 --- a/awsapi/src/com/cloud/stack/models/CloudStackDiskOffering.java +++ b/awsapi/src/com/cloud/stack/models/CloudStackDiskOffering.java @@ -32,6 +32,8 @@ public class CloudStackDiskOffering { private String created; @SerializedName(ApiConstants.IS_CUSTOMIZED) private boolean isCustomized; + @SerializedName(ApiConstants.TAGS) + private String tags; /** * @@ -80,4 +82,11 @@ public class CloudStackDiskOffering { public boolean isCustomized() { return isCustomized; } + + /** + * @return the tags + */ + public String getTags() { + return tags; + } }