mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-04 20:29:27 +01:00
Merge pull request #1841 from sateesh-chodapuneedi/pr-cloudstack-9684
CLOUDSTACK-9684 Invalid zone id error while listing vmware zone
This commit is contained in:
commit
321712bcaf
@ -1133,8 +1133,8 @@ public class VmwareManagerImpl extends ManagerBase implements VmwareManager, Vmw
|
|||||||
@Override
|
@Override
|
||||||
public boolean removeVmwareDatacenter(RemoveVmwareDcCmd cmd) throws ResourceInUseException {
|
public boolean removeVmwareDatacenter(RemoveVmwareDcCmd cmd) throws ResourceInUseException {
|
||||||
Long zoneId = cmd.getZoneId();
|
Long zoneId = cmd.getZoneId();
|
||||||
// Validate zone
|
// Validate Id of zone
|
||||||
validateZone(zoneId);
|
doesZoneExist(zoneId);
|
||||||
// Zone validation to check if the zone already has resources.
|
// Zone validation to check if the zone already has resources.
|
||||||
// Association of VMware DC to zone is not allowed if zone already has resources added.
|
// Association of VMware DC to zone is not allowed if zone already has resources added.
|
||||||
validateZoneWithResources(zoneId, "remove VMware datacenter to zone");
|
validateZoneWithResources(zoneId, "remove VMware datacenter to zone");
|
||||||
@ -1202,10 +1202,7 @@ public class VmwareManagerImpl extends ManagerBase implements VmwareManager, Vmw
|
|||||||
|
|
||||||
private void validateZone(Long zoneId) throws InvalidParameterValueException {
|
private void validateZone(Long zoneId) throws InvalidParameterValueException {
|
||||||
// Check if zone with specified id exists
|
// Check if zone with specified id exists
|
||||||
DataCenterVO zone = _dcDao.findById(zoneId);
|
doesZoneExist(zoneId);
|
||||||
if (zone == null) {
|
|
||||||
throw new InvalidParameterValueException("Can't find zone by the id specified.");
|
|
||||||
}
|
|
||||||
// Check if zone is legacy zone
|
// Check if zone is legacy zone
|
||||||
if (isLegacyZone(zoneId)) {
|
if (isLegacyZone(zoneId)) {
|
||||||
throw new InvalidParameterValueException("The specified zone is legacy zone. Adding VMware datacenter to legacy zone is not supported.");
|
throw new InvalidParameterValueException("The specified zone is legacy zone. Adding VMware datacenter to legacy zone is not supported.");
|
||||||
@ -1248,7 +1245,7 @@ public class VmwareManagerImpl extends ManagerBase implements VmwareManager, Vmw
|
|||||||
long vmwareDcId;
|
long vmwareDcId;
|
||||||
|
|
||||||
// Validate if zone id parameter passed to API is valid
|
// Validate if zone id parameter passed to API is valid
|
||||||
validateZone(zoneId);
|
doesZoneExist(zoneId);
|
||||||
|
|
||||||
// Check if zone is associated with VMware DC
|
// Check if zone is associated with VMware DC
|
||||||
vmwareDcZoneMap = _vmwareDcZoneMapDao.findByZoneId(zoneId);
|
vmwareDcZoneMap = _vmwareDcZoneMapDao.findByZoneId(zoneId);
|
||||||
@ -1265,6 +1262,17 @@ public class VmwareManagerImpl extends ManagerBase implements VmwareManager, Vmw
|
|||||||
return vmwareDcList;
|
return vmwareDcList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void doesZoneExist(Long zoneId) throws InvalidParameterValueException {
|
||||||
|
// Check if zone with specified id exists
|
||||||
|
DataCenterVO zone = _dcDao.findById(zoneId);
|
||||||
|
if (zone == null) {
|
||||||
|
throw new InvalidParameterValueException("Can't find zone by the id specified.");
|
||||||
|
}
|
||||||
|
if (s_logger.isTraceEnabled()) {
|
||||||
|
s_logger.trace("Zone with id:[" + zoneId + "] exists.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasNexusVSM(Long clusterId) {
|
public boolean hasNexusVSM(Long clusterId) {
|
||||||
ClusterVSMMapVO vsmMapVo = null;
|
ClusterVSMMapVO vsmMapVo = null;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user