VPC: CS-16179 - only offerings in Enabled state can be used for VPC creation

Reviewed-by: Frank Zhang
This commit is contained in:
Alena Prokharchyk 2012-08-27 11:04:10 -07:00
parent 8d7eff42f9
commit 0b01c00185
1 changed files with 3 additions and 2 deletions

View File

@ -524,10 +524,11 @@ public class VpcManagerImpl implements VpcManager, Manager{
// Validate vpc offering
VpcOfferingVO vpcOff = _vpcOffDao.findById(vpcOffId);
if (vpcOff == null) {
if (vpcOff == null || vpcOff.getState() != State.Enabled) {
List<IdentityProxy> idList = new ArrayList<IdentityProxy>();
idList.add(new IdentityProxy("vpc_offerings", vpcOffId, "vpcOfferingId"));
throw new InvalidParameterValueException("Unable to find vpc offering by specified id", idList);
throw new InvalidParameterValueException("Unable to find vpc offering in " + State.Enabled +
" state by specified id", idList);
}
//Validate zone