rhtyd closed pull request #2370: CLOUDSTACK-9595: Fix regression introduced in
#1762
URL: https://github.com/apache/cloudstack/pull/2370
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/server/src/com/cloud/network/IpAddressManagerImpl.java
b/server/src/com/cloud/network/IpAddressManagerImpl.java
index 7961d07fc6c..6af6b0340f8 100644
--- a/server/src/com/cloud/network/IpAddressManagerImpl.java
+++ b/server/src/com/cloud/network/IpAddressManagerImpl.java
@@ -291,8 +291,8 @@
SearchBuilder<IPAddressVO> AssignIpAddressSearch;
SearchBuilder<IPAddressVO> AssignIpAddressFromPodVlanSearch;
- private final Object _allocatedLock = new Object();
- private final Object _allocatingLock = new Object();
+ private static final Object allocatedLock = new Object();
+ private static final Object allocatingLock = new Object();
static Boolean rulesContinueOnErrFlag = true;
@@ -835,7 +835,7 @@ public IPAddressVO doInTransaction(TransactionStatus
status) throws Insufficient
@DB
@Override
public void markPublicIpAsAllocated(final IPAddressVO addr) {
- synchronized (_allocatedLock) {
+ synchronized (allocatedLock) {
Transaction.execute(new TransactionCallbackNoReturn() {
@Override
public void doInTransactionWithoutResult(TransactionStatus
status) {
@@ -858,6 +858,8 @@ public void doInTransactionWithoutResult(TransactionStatus
status) {
_resourceLimitMgr.incrementResourceCount(owner.getId(), ResourceType.public_ip);
}
}
+ } else {
+ s_logger.error("Failed to mark public IP as
allocated with id=" + addr.getId() + " address=" + addr.getAddress());
}
}
}
@@ -868,14 +870,18 @@ public void
doInTransactionWithoutResult(TransactionStatus status) {
@DB
private void markPublicIpAsAllocating(final IPAddressVO addr) {
- synchronized (_allocatingLock) {
+ synchronized (allocatingLock) {
Transaction.execute(new TransactionCallbackNoReturn() {
@Override
public void doInTransactionWithoutResult(TransactionStatus
status) {
if (_ipAddressDao.lockRow(addr.getId(), true) != null) {
addr.setState(IpAddress.State.Allocating);
- _ipAddressDao.update(addr.getId(), addr);
+ if (!_ipAddressDao.update(addr.getId(), addr)) {
+ s_logger.error("Failed to update public IP as
allocating with id=" + addr.getId() + " and address=" + addr.getAddress());
+ }
+ } else {
+ s_logger.error("Failed to lock row to mark public IP
as allocating with id=" + addr.getId() + " and address=" + addr.getAddress());
}
}
});
@@ -936,8 +942,8 @@ public PublicIp assignDedicateIpAddress(Account owner,
final Long guestNtwkId, f
displayIp = vpc.isDisplay();
}
- return fetchNewPublicIp(dcId, null, null, owner,
VlanType.VirtualNetwork, guestNtwkId, isSourceNat, false, null, false, vpcId,
displayIp);
-
+ ip = fetchNewPublicIp(dcId, null, null, owner,
VlanType.VirtualNetwork, guestNtwkId, isSourceNat, true, null, false, vpcId,
displayIp);
+ return ip;
} finally {
if (owner != null) {
if (s_logger.isDebugEnabled()) {
diff --git a/test/integration/smoke/test_vpc_vpn.py
b/test/integration/smoke/test_vpc_vpn.py
index ddf76930050..df60686f229 100644
--- a/test/integration/smoke/test_vpc_vpn.py
+++ b/test/integration/smoke/test_vpc_vpn.py
@@ -390,6 +390,7 @@ def test_01_vpc_remote_access_vpn(self):
finally:
self.logger.debug("Acquired public ip address: OK")
+ vpn = None
try:
vpn = Vpn.create(self.apiclient,
publicipid=ip.id,
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services