tomicooler commented on a change in pull request #3938:
URL: https://github.com/apache/hadoop/pull/3938#discussion_r796379325



##########
File path: 
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/RMAppManager.java
##########
@@ -469,26 +481,61 @@ private RMAppImpl createAndPopulateNewRMApp(
             submissionContext.getQueue() : placementContext.getFullQueuePath();
 
         String appName = submissionContext.getApplicationName();
-        CSQueue csqueue = ((CapacityScheduler) scheduler).getQueue(queueName);
+
+        CapacityScheduler cs = (CapacityScheduler) scheduler;
+        CapacitySchedulerConfiguration csConf = cs.getConfiguration();
+
+        CSQueue csqueue = cs.getQueue(queueName);
+        PrivilegedEntity privilegedEntity = getPrivilegedEntity(queueName);
 
         if (csqueue == null && placementContext != null) {
-          //could be an auto created queue through queue mapping. Validate
-          // parent queue exists and has valid acls
-          String parentQueueName = placementContext.getParentQueue();
-          csqueue = ((CapacityScheduler) scheduler).getQueue(parentQueueName);
+          List<Permission> permissions = new ArrayList<>();
+
+          final QueuePath parentCandidate = new 
QueuePath(placementContext.getParentQueue());
+          AutoCreatedQueueTemplate aqc = new AutoCreatedQueueTemplate(csConf, 
parentCandidate);
+
+          CSQueue parentQueue = cs.getQueue(parentCandidate.getFullPath());
+          if (parentQueue == null) {
+            final QueuePath parent = new 
QueuePath(parentCandidate.getParent());
+            parentQueue = cs.getQueue(parent.getFullPath());
+            if (parentQueue == null) {
+              throw RPCUtil.getRemoteException(new AccessControlException(
+                  "Access denied for invalid queue " + 
submissionContext.getQueue() +
+                      " parent is not found " + parent.getFullPath() +
+                      " user " + user + " applicationId " + applicationId));
+            }
+

Review comment:
       Thanks that's good point I will check that.
   
   I broke one unit test with ambiguous leaf queues which I "fixed" but I found 
a separate Jira ticket for that: 
https://issues.apache.org/jira/browse/YARN-10787.
   
   Is it possible to submit an application to dynamic queues without a 
placement context? Because I implemented this dynamic ACL logic only when there 
is a placement context available.




-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to