From 3abe056736acceefde5d59ff55df0e78aefd1913 Mon Sep 17 00:00:00 2001 From: abhishek Date: Thu, 16 Sep 2010 14:59:17 -0700 Subject: [PATCH] bug 6141: fixed the error of not providing the right error for an incorrect diskoffering status 6141: resolved fixed --- server/src/com/cloud/api/commands/CreateVolumeCmd.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/server/src/com/cloud/api/commands/CreateVolumeCmd.java b/server/src/com/cloud/api/commands/CreateVolumeCmd.java index 360c7e45087..75f76d238ec 100644 --- a/server/src/com/cloud/api/commands/CreateVolumeCmd.java +++ b/server/src/com/cloud/api/commands/CreateVolumeCmd.java @@ -117,6 +117,14 @@ public class CreateVolumeCmd extends BaseCmd { size = Long.valueOf(0); } + if(diskOfferingId != null){ + DiskOfferingVO dOffering = getManagementServer().findDiskOfferingById(diskOfferingId.longValue()); + + if(dOffering == null){ + throw new ServerApiException(BaseCmd.PARAM_ERROR,"Diskoffering id:"+diskOfferingId+" is invalid"); + } + } + boolean useSnapshot = false; if (snapshotId == null) {