Skip to content

Commit 22232f2

Browse files
author
Alena Prokharchyk
committed
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
1 parent 8837113 commit 22232f2

2 files changed

Lines changed: 10 additions & 12 deletions

File tree

‎plugins/network-elements/internal-loadbalancer/src/org/apache/cloudstack/network/lb/InternalLoadBalancerVMManagerImpl.java‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -752,10 +752,7 @@ protected DomainRouterVO deployInternalLbVm(Account owner, DeployDestination des
752752
InsufficientAddressCapacityException, InsufficientServerCapacityException, InsufficientCapacityException,
753753
StorageUnavailableException, ResourceUnavailableException {
754754

755-
long id = _internalLbVmDao.getNextInSequence(Long.class, "id");
756-
if (s_logger.isDebugEnabled()) {
757-
s_logger.debug("Creating the internal lb vm " + id + " in datacenter " + dest.getDataCenter());
758-
}
755+
759756

760757
ServiceOfferingVO routerOffering = _serviceOfferingDao.findById(svcOffId);
761758

@@ -769,8 +766,10 @@ protected DomainRouterVO deployInternalLbVm(Account owner, DeployDestination des
769766
for (Iterator<HypervisorType> iter = hypervisors.iterator(); iter.hasNext();) {
770767
HypervisorType hType = iter.next();
771768
try {
772-
s_logger.debug("Allocating the Internal lb with the hypervisor type " + hType);
773-
String templateName = null;
769+
long id = _internalLbVmDao.getNextInSequence(Long.class, "id");
770+
if (s_logger.isDebugEnabled()) {
771+
s_logger.debug("Creating the internal lb vm " + id + " in datacenter " + dest.getDataCenter() + " with hypervisor type " + hType);
772+
} String templateName = null;
774773
switch (hType) {
775774
case XenServer:
776775
templateName = _configServer.getConfigValue(Config.RouterTemplateXen.key(), Config.ConfigurationParameterScope.zone.toString(), dest.getDataCenter().getId());

‎server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1585,11 +1585,6 @@ protected DomainRouterVO deployRouter(Account owner, DeployDestination dest, Dep
15851585
Long vpcId, List<Pair<NetworkVO, NicProfile>> networks, boolean startRouter, List<HypervisorType> supportedHypervisors) throws ConcurrentOperationException,
15861586
InsufficientAddressCapacityException, InsufficientServerCapacityException, InsufficientCapacityException,
15871587
StorageUnavailableException, ResourceUnavailableException {
1588-
1589-
long id = _routerDao.getNextInSequence(Long.class, "id");
1590-
if (s_logger.isDebugEnabled()) {
1591-
s_logger.debug("Creating the router " + id + " in datacenter " + dest.getDataCenter());
1592-
}
15931588

15941589
ServiceOfferingVO routerOffering = _serviceOfferingDao.findById(svcOffId);
15951590

@@ -1603,7 +1598,11 @@ protected DomainRouterVO deployRouter(Account owner, DeployDestination dest, Dep
16031598
for (Iterator<HypervisorType> iter = hypervisors.iterator(); iter.hasNext();) {
16041599
HypervisorType hType = iter.next();
16051600
try {
1606-
s_logger.debug("Allocating the domR with the hypervisor type " + hType);
1601+
long id = _routerDao.getNextInSequence(Long.class, "id");
1602+
if (s_logger.isDebugEnabled()) {
1603+
s_logger.debug("Allocating the VR i="+ id + " in datacenter " + dest.getDataCenter() + "with the hypervisor type " + hType);
1604+
}
1605+
16071606
String templateName = null;
16081607
switch (hType) {
16091608
case XenServer:

0 commit comments

Comments
 (0)