|
@@ -126,6 +126,7 @@ public class AllocationFileQueueParser {
|
|
|
NodeList fields = element.getChildNodes();
|
|
|
boolean isLeaf = true;
|
|
|
boolean isReservable = false;
|
|
|
+ boolean isMaxAMShareSet = false;
|
|
|
|
|
|
for (int j = 0; j < fields.getLength(); j++) {
|
|
|
Node fieldNode = fields.item(j);
|
|
@@ -157,6 +158,7 @@ public class AllocationFileQueueParser {
|
|
|
float val = Float.parseFloat(text);
|
|
|
val = Math.min(val, 1.0f);
|
|
|
builder.queueMaxAMShares(queueName, val);
|
|
|
+ isMaxAMShareSet = true;
|
|
|
} else if (MAX_CONTAINER_ALLOCATION.equals(field.getTagName())) {
|
|
|
String text = getTrimmedTextData(field);
|
|
|
ConfigurableResource val =
|
|
@@ -220,7 +222,6 @@ public class AllocationFileQueueParser {
|
|
|
isLeaf = false;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
// if a leaf in the alloc file is marked as type='parent'
|
|
|
// then store it as a parent queue
|
|
|
if (isLeaf && !"parent".equals(element.getAttribute("type"))) {
|
|
@@ -230,10 +231,11 @@ public class AllocationFileQueueParser {
|
|
|
}
|
|
|
} else {
|
|
|
if (isReservable) {
|
|
|
- throw new AllocationConfigurationException("The configuration settings"
|
|
|
- + " for " + queueName + " are invalid. A queue element that "
|
|
|
- + "contains child queue elements or that has the type='parent' "
|
|
|
- + "attribute cannot also include a reservation element.");
|
|
|
+ throw new AllocationConfigurationException(
|
|
|
+ getErrorString(queueName, RESERVATION));
|
|
|
+ } else if (isMaxAMShareSet) {
|
|
|
+ throw new AllocationConfigurationException(
|
|
|
+ getErrorString(queueName, MAX_AMSHARE));
|
|
|
}
|
|
|
builder.configuredQueues(FSQueueType.PARENT, queueName);
|
|
|
}
|
|
@@ -253,6 +255,19 @@ public class AllocationFileQueueParser {
|
|
|
builder.getMaxQueueResources(), queueName);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * Set up the error string based on the supplied parent queueName and element.
|
|
|
+ * @param parentQueueName the parent queue name.
|
|
|
+ * @param element the element that should not be present for the parent queue.
|
|
|
+ * @return the error string.
|
|
|
+ */
|
|
|
+ private String getErrorString(String parentQueueName, String element) {
|
|
|
+ return "The configuration settings"
|
|
|
+ + " for " + parentQueueName + " are invalid. A queue element that "
|
|
|
+ + "contains child queue elements or that has the type='parent' "
|
|
|
+ + "attribute cannot also include a " + element + " element.";
|
|
|
+ }
|
|
|
+
|
|
|
private String getTrimmedTextData(Element element) {
|
|
|
return ((Text) element.getFirstChild()).getData().trim();
|
|
|
}
|