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
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/ff33a358 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/ff33a358 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/ff33a358 Branch: refs/heads/master-6-17-stable Commit: ff33a358358297814be1e1c026030080e2eb88da Parents: 728145f Author: Alena Prokharchyk <[email protected]> Authored: Fri Jun 21 15:21:51 2013 -0700 Committer: Alena Prokharchyk <[email protected]> Committed: Wed Jun 26 15:28:14 2013 -0700 ---------------------------------------------------------------------- .../network/lb/InternalLoadBalancerVMManagerImpl.java | 11 +++++------ .../router/VirtualNetworkApplianceManagerImpl.java | 11 +++++------ 2 files changed, 10 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ff33a358/plugins/network-elements/internal-loadbalancer/src/org/apache/cloudstack/network/lb/InternalLoadBalancerVMManagerImpl.java ---------------------------------------------------------------------- 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 2bdb28f..c633d57 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<HypervisorType> 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()); http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ff33a358/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java index 7e12ce9..d2a3c6b 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<Pair<NetworkVO, NicProfile>> networks, boolean startRouter, List<HypervisorType> 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<HypervisorType> 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:
