You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by "weizhouapache (via GitHub)" <gi...@apache.org> on 2023/09/18 13:08:53 UTC

[GitHub] [cloudstack] weizhouapache commented on a diff in pull request #7915: ldap trust map cleanup on domain delete

weizhouapache commented on code in PR #7915:
URL: https://github.com/apache/cloudstack/pull/7915#discussion_r1328698199


##########
server/src/main/java/com/cloud/user/DomainManagerImpl.java:
##########
@@ -344,56 +345,67 @@ public boolean deleteDomain(long domainId, Boolean cleanup) {
 
     @Override
     public boolean deleteDomain(DomainVO domain, Boolean cleanup) {
-        GlobalLock lock = getGlobalLock("AccountCleanup");
+        GlobalLock lock = getGlobalLock();
+        if (lock == null) return false;
+
+        try {
+            // mark domain as inactive
+            s_logger.debug("Marking domain id=" + domain.getId() + " as " + Domain.State.Inactive + " before actually deleting it");
+            domain.setState(Domain.State.Inactive);
+            _domainDao.update(domain.getId(), domain);
+
+            return cleanDomain(domain, cleanup);
+        }
+        finally {
+            lock.unlock();
+        }
+    }
+
+    @Nullable

Review Comment:
   do we need this annotation ?
   ```
   import org.jetbrains.annotations.Nullable;
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org