Address review comments (#338)

This adds the missing commit to the fix #335 from the upstream PR:
apache/cloudstack#7977

(cherry picked from commit b5f77f9c3b53af7e8b05730da9807a2c9eb017a5)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
Nicolas Vazquez 2023-10-12 05:49:27 -03:00 committed by Rohit Yadav
parent 84fee7b896
commit 3e2717424d
1 changed files with 5 additions and 6 deletions

View File

@ -1190,13 +1190,12 @@ public class ResourceLimitManagerImpl extends ManagerBase implements ResourceLim
GlobalLock lock = GlobalLock.getInternLock("ResourceCheckTask");
try {
if (lock.lock(30)) {
ManagementServerHostVO msHost = managementServerHostDao.findOneByLongestRuntime();
if (msHost == null || (msHost.getMsid() != ManagementServerNode.getManagementServerId())) {
s_logger.debug("Skipping the resource counters recalculation task on this management server");
lock.unlock();
return;
}
try {
ManagementServerHostVO msHost = managementServerHostDao.findOneByLongestRuntime();
if (msHost == null || (msHost.getMsid() != ManagementServerNode.getManagementServerId())) {
s_logger.trace("Skipping the resource counters recalculation task on this management server");
return;
}
runResourceCheckTaskInternal();
} finally {
lock.unlock();