Merge pull request #826 from kansal/CLOUDSTACK-8853

Fixed: Error given when creating VPN user in one network if VR for another network is stopped.

Problem: Adding a VPN user to an IP on an isolated network fails with an exception if the end-user has two isolated networks and one of them is not in use (i.e. VR is stopped).

Fix: Presently in the code, all the VR which are not in Running state are forced to throw error. Added a check for the Stopped and Stopping state routers. Configurations will be applied to them when they get restarted.

* pr/826:
  Fixed Coverity Issue: Unintentional Integer FLow
  Fixed: Error given when creating VPN user in one network if VR for another network is stopped

Signed-off-by: Will Stevens <williamstevens@gmail.com>
This commit is contained in:
Will Stevens 2016-04-26 13:10:30 -04:00
commit 5c1ad900a2
2 changed files with 6 additions and 2 deletions

View File

@ -115,7 +115,7 @@ public class ImageStoreUploadMonitorImpl extends ManagerBase implements ImageSto
public boolean configure(String name, Map<String, Object> params) throws ConfigurationException { public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
_executor = Executors.newScheduledThreadPool(1, new NamedThreadFactory("Upload-Monitor")); _executor = Executors.newScheduledThreadPool(1, new NamedThreadFactory("Upload-Monitor"));
_monitoringInterval = UploadMonitoringInterval.value(); _monitoringInterval = UploadMonitoringInterval.value();
_uploadOperationTimeout = UploadOperationTimeout.value() * 60 * 1000; _uploadOperationTimeout = UploadOperationTimeout.value() * 60 * 1000L;
_nodeId = ManagementServerNode.getManagementServerId(); _nodeId = ManagementServerNode.getManagementServerId();
return true; return true;
} }

View File

@ -278,7 +278,11 @@ public class BasicNetworkTopology implements NetworkTopology {
boolean agentResults = true; boolean agentResults = true;
for (final DomainRouterVO router : routers) { for (final DomainRouterVO router : routers) {
if (router.getState() != State.Running) { if(router.getState() == State.Stopped || router.getState() == State.Stopping){
s_logger.info("The router " + router.getInstanceName()+ " is in the " + router.getState() + " state. So not applying the VPN rules. Will be applied once the router gets restarted.");
continue;
}
else if (router.getState() != State.Running) {
s_logger.warn("Failed to add/remove VPN users: router not in running state"); s_logger.warn("Failed to add/remove VPN users: router not in running state");
throw new ResourceUnavailableException("Unable to assign ip addresses, domR is not in right state " + router.getState(), DataCenter.class, throw new ResourceUnavailableException("Unable to assign ip addresses, domR is not in right state " + router.getState(), DataCenter.class,
network.getDataCenterId()); network.getDataCenterId());