Bug CS-14448: Wrong error message on using the createVlanIpRange cmd

Description:

	Fixing two other scenarios apart from the reported one
	where we were not passing in database IDs for translation
	into uuids, in the exception.
This commit is contained in:
Vijayendra Bhamidipati 2012-04-16 15:15:36 -07:00
parent e03ed60540
commit 2ef8287287
1 changed files with 10 additions and 3 deletions

View File

@ -6241,7 +6241,9 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
public List<? extends PhysicalNetworkTrafficType> listTrafficTypes(Long physicalNetworkId) {
PhysicalNetworkVO network = _physicalNetworkDao.findById(physicalNetworkId);
if (network == null) {
throw new InvalidParameterValueException("Physical Network id=" + physicalNetworkId + "doesn't exist in the system");
InvalidParameterValueException ex = new InvalidParameterValueException("Physical Network with specified id doesn't exist in the system");
ex.addProxyObject(network, physicalNetworkId, "physicalNetworkId");
throw ex;
}
return _pNTrafficTypeDao.listBy(physicalNetworkId);
@ -6253,11 +6255,16 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
List<PhysicalNetworkVO> networkList = _physicalNetworkDao.listByZoneAndTrafficType(zoneId, trafficType);
if (networkList.isEmpty()) {
throw new InvalidParameterValueException("Unable to find the default physical network with traffic=" + trafficType + " in zone id=" + zoneId);
InvalidParameterValueException ex = new InvalidParameterValueException("Unable to find the default physical network with traffic=" + trafficType + " in the specified zone id");
// Since we don't have a DataCenterVO object at our disposal, we just set the table name that the zoneId's corresponding uuid is looked up from, manually.
ex.addProxyObject("data_center", zoneId, "zoneId");
throw ex;
}
if (networkList.size() > 1) {
throw new InvalidParameterValueException("More than one physical networks exist in zone id=" + zoneId + " with traffic type=" + trafficType);
InvalidParameterValueException ex = new InvalidParameterValueException("More than one physical networks exist in zone id=" + zoneId + " with traffic type=" + trafficType);
ex.addProxyObject("data_center", zoneId, "zoneId");
throw ex;
}
return networkList.get(0);