From 22232f2baf6c0291eabf82da4318ffee6001e593 Mon Sep 17 00:00:00 2001 From: Alena Prokharchyk Date: Fri, 21 Jun 2013 15:21:51 -0700 Subject: [PATCH] CLOUDSTACK-2698: always generate new id when create VirtualRouter. Don't try to re-use the id of the VR that failed to deploy and was expunged as a result of this failure --- .../network/lb/InternalLoadBalancerVMManagerImpl.java | 11 +++++------ .../router/VirtualNetworkApplianceManagerImpl.java | 11 +++++------ 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/plugins/network-elements/internal-loadbalancer/src/org/apache/cloudstack/network/lb/InternalLoadBalancerVMManagerImpl.java b/plugins/network-elements/internal-loadbalancer/src/org/apache/cloudstack/network/lb/InternalLoadBalancerVMManagerImpl.java index 2bdb28fd956..c633d57d978 100644 --- a/plugins/network-elements/internal-loadbalancer/src/org/apache/cloudstack/network/lb/InternalLoadBalancerVMManagerImpl.java +++ b/plugins/network-elements/internal-loadbalancer/src/org/apache/cloudstack/network/lb/InternalLoadBalancerVMManagerImpl.java @@ -752,10 +752,7 @@ public class InternalLoadBalancerVMManagerImpl extends ManagerBase implements InsufficientAddressCapacityException, InsufficientServerCapacityException, InsufficientCapacityException, StorageUnavailableException, ResourceUnavailableException { - long id = _internalLbVmDao.getNextInSequence(Long.class, "id"); - if (s_logger.isDebugEnabled()) { - s_logger.debug("Creating the internal lb vm " + id + " in datacenter " + dest.getDataCenter()); - } + ServiceOfferingVO routerOffering = _serviceOfferingDao.findById(svcOffId); @@ -769,8 +766,10 @@ public class InternalLoadBalancerVMManagerImpl extends ManagerBase implements for (Iterator iter = hypervisors.iterator(); iter.hasNext();) { HypervisorType hType = iter.next(); try { - s_logger.debug("Allocating the Internal lb with the hypervisor type " + hType); - String templateName = null; + long id = _internalLbVmDao.getNextInSequence(Long.class, "id"); + if (s_logger.isDebugEnabled()) { + s_logger.debug("Creating the internal lb vm " + id + " in datacenter " + dest.getDataCenter() + " with hypervisor type " + hType); + } String templateName = null; switch (hType) { case XenServer: templateName = _configServer.getConfigValue(Config.RouterTemplateXen.key(), Config.ConfigurationParameterScope.zone.toString(), dest.getDataCenter().getId()); diff --git a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java index 3489dbfb34c..fbb8cf28b63 100755 --- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java +++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java @@ -1585,11 +1585,6 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements V Long vpcId, List> networks, boolean startRouter, List supportedHypervisors) throws ConcurrentOperationException, InsufficientAddressCapacityException, InsufficientServerCapacityException, InsufficientCapacityException, StorageUnavailableException, ResourceUnavailableException { - - long id = _routerDao.getNextInSequence(Long.class, "id"); - if (s_logger.isDebugEnabled()) { - s_logger.debug("Creating the router " + id + " in datacenter " + dest.getDataCenter()); - } ServiceOfferingVO routerOffering = _serviceOfferingDao.findById(svcOffId); @@ -1603,7 +1598,11 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements V for (Iterator iter = hypervisors.iterator(); iter.hasNext();) { HypervisorType hType = iter.next(); try { - s_logger.debug("Allocating the domR with the hypervisor type " + hType); + long id = _routerDao.getNextInSequence(Long.class, "id"); + if (s_logger.isDebugEnabled()) { + s_logger.debug("Allocating the VR i="+ id + " in datacenter " + dest.getDataCenter() + "with the hypervisor type " + hType); + } + String templateName = null; switch (hType) { case XenServer: