From b0e06981c16a6341d10cc9b946bec5ae1ad484cb Mon Sep 17 00:00:00 2001 From: Sateesh Chodapuneedi Date: Wed, 14 Aug 2013 12:47:58 +0530 Subject: [PATCH] CLOUDSTACK-4326 Adding VMware DC to legacy zone should not be allowed by API Signed-off-by: Sateesh Chodapuneedi --- .../hypervisor/vmware/manager/VmwareManagerImpl.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java index 1be105fccf8..f20b257392f 100755 --- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java +++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java @@ -1162,9 +1162,15 @@ public class VmwareManagerImpl extends ManagerBase implements VmwareManager, Vmw // Check if zone with specified id exists DataCenterVO zone = _dcDao.findById(zoneId); if (zone == null) { - InvalidParameterValueException ex = new InvalidParameterValueException( - "Can't find zone by the id specified."); - throw ex; + throw new InvalidParameterValueException("Can't find zone by the id specified."); + } + // Check if zone is legacy zone + if (isLegacyZone(zoneId)) { + throw new InvalidParameterValueException("The specified zone is legacy zone. Adding VMware datacenter to legacy zone is not supported."); + } else { + if (s_logger.isTraceEnabled()) { + s_logger.trace("The specified zone is not legacy zone."); + } } }