Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Allow multiple CPU architectures to be permitted

  • Loading branch information...
commit 2d493d8d0cf0c5b2a00933af192bb431ed594a83 1 parent 7010925
Patrick Armstrong oldpatricka authored
4 messaging/gt4.0/java/msgbridge/src/org/nimbustools/messaging/gt4_0/factory/FactoryResource.java
View
@@ -385,9 +385,9 @@ public void setRPs(Advertised advert) throws ResourceException {
/* CPUArchitectureName */
- if (advert.getCpuArchitectureName() != null) {
+ if (advert.getCpuArchitectureNames() != null) {
prop = new SimpleResourceProperty(Constants_GT4_0.RP_FACTORY_CPUArch);
- prop.add(advert.getCpuArchitectureName());
+ prop.add(advert.getCpuArchitectureNames());
this.propSet.add(prop);
}
2  service-api/java/source/src/org/nimbustools/api/_repr/_Advertised.java
View
@@ -22,7 +22,7 @@
public void setDefaultRunningTimeSeconds(int defaultRunningTime);
public void setMaximumRunningTimeSeconds(int maximumRunningTime);
- public void setCpuArchitectureName(String cpuArchitectureName);
+ public void setCpuArchitectureNames(String[] cpuArchitectureNames);
public void setVmmVersions(String[] vmmVersions);
public void setVmm(String vmm);
public void setNetworkNames(String[] networkNames);
13 service-api/java/source/src/org/nimbustools/api/defaults/repr/DefaultAdvertised.java
View
@@ -29,7 +29,7 @@
private int defaultRunningTimeSeconds;
private int maximumRunningTimeSeconds;
private int maximumAfterRunningTimeSeconds;
- private String cpuArchitectureName;
+ private String[] cpuArchitectureNames;
private String[] vmmVersions;
private String vmm;
private String[] networkNames;
@@ -53,8 +53,8 @@ public int getMaximumAfterRunningTimeSeconds() {
return this.maximumAfterRunningTimeSeconds;
}
- public String getCpuArchitectureName() {
- return this.cpuArchitectureName;
+ public String[] getCpuArchitectureNames() {
+ return this.cpuArchitectureNames;
}
public String[] getVmmVersions() {
@@ -94,8 +94,8 @@ public void setMaximumAfterRunningTimeSeconds(int maximumAfterRunningTime) {
this.maximumAfterRunningTimeSeconds = maximumAfterRunningTime;
}
- public void setCpuArchitectureName(String cpuArchitectureName) {
- this.cpuArchitectureName = cpuArchitectureName;
+ public void setCpuArchitectureNames(String[] cpuArchitectureNames) {
+ this.cpuArchitectureNames = cpuArchitectureNames;
}
public void setVmmVersions(String[] vmmVersions) {
@@ -129,7 +129,8 @@ public String toString() {
", maximumRunningTimeSeconds=" + maximumRunningTimeSeconds +
", maximumAfterRunningTimeSeconds=" +
maximumAfterRunningTimeSeconds +
- ", cpuArchitectureName='" + cpuArchitectureName + '\'' +
+ ", cpuArchitectureNames='" +
+ (cpuArchitectureNames == null ? null : Arrays.asList(cpuArchitectureNames)) +
", vmmVersions=" +
(vmmVersions == null ? null : Arrays.asList(vmmVersions)) +
", vmm='" + vmm + '\'' +
2  service-api/java/source/src/org/nimbustools/api/repr/Advertised.java
View
@@ -25,7 +25,7 @@
public int getDefaultRunningTimeSeconds();
public int getMaximumRunningTimeSeconds();
- public String getCpuArchitectureName();
+ public String[] getCpuArchitectureNames();
public String[] getVmmVersions();
public String getVmm();
public String[] getNetworkNames();
2  service/service/java/source/etc/workspace-service/other/main.xml
View
@@ -125,7 +125,7 @@
init-method="validate">
<!-- Property values coming via vmm.conf -->
- <property name="cpuArchitectureName"
+ <property name="cpuArchitectureNames"
value="$VMM{cpu.arch}" />
<property name="vmm"
value="$VMM{vmm.type}" />
4 service/service/java/source/src/org/globus/workspace/creation/defaults/DefaultCreation.java
View
@@ -229,8 +229,8 @@ public void setAccountingEventAdapter(AccountingEventAdapter accEvents) {
public Advertised getAdvertised() {
final _Advertised adv = this.repr._newAdvertised();
- adv.setCpuArchitectureName(
- this.globals.getCpuArchitectureName());
+ adv.setCpuArchitectureNames(
+ this.globals.getCpuArchitectureNames());
adv.setDefaultRunningTimeSeconds(
this.globals.getDefaultRunningTimeSeconds());
adv.setMaxGroupSize(
2  service/service/java/source/src/org/globus/workspace/service/binding/GlobalPolicies.java
View
@@ -24,7 +24,7 @@
public int getTerminationOffsetSeconds();
- public String getCpuArchitectureName();
+ public String[] getCpuArchitectureNames();
public String[] getVmmVersions();
32 service/service/java/source/src/org/globus/workspace/service/binding/authorization/DefaultAuthorize.java
View
@@ -29,6 +29,8 @@
import org.nimbustools.api.services.rm.ResourceRequestDeniedException;
import javax.security.auth.Subject;
+import java.util.List;
+import java.util.Arrays;
public class DefaultAuthorize implements Authorize {
@@ -264,8 +266,8 @@ protected static void authorizeDuration(VirtualMachine vm,
protected void checkArchitecture(VirtualMachine vm)
throws ResourceRequestDeniedException {
- final String fact = this.globals.getCpuArchitectureName();
- if (fact == null) {
+ final String[] allowedCPUArchitectures = this.globals.getCpuArchitectureNames();
+ if (allowedCPUArchitectures == null) {
// if policy is null, means 'any'
return; // *** EARLY RETURN ***
}
@@ -276,16 +278,32 @@ protected void checkArchitecture(VirtualMachine vm)
"no CPU architecture description (no dep)");
}
- final String arch = dep.getCPUArchitecture();
- if (arch == null) {
+ final String requestedArch = dep.getCPUArchitecture();
+ if (requestedArch == null) {
throw new ResourceRequestDeniedException(
"no CPU architecture description (no dep.arch)");
}
- if (!arch.equals(fact)) {
+ List archList = Arrays.asList(allowedCPUArchitectures);
+
+ if (!archList.contains(requestedArch)) {
+
+ StringBuilder sb = new StringBuilder();
+ boolean first = true;
+ for (int i=0; i < allowedCPUArchitectures.length ; i++) {
+ if (first) {
+ first = false;
+ }
+ else {
+ sb.append(", ");
+ }
+ sb.append(allowedCPUArchitectures[i]);
+ }
+ final String allArchitectures = sb.toString();
+
throw new ResourceRequestDeniedException(
- "incorrect CPU architecture, only '" + fact +
- "' supported, you request '" + arch + "'");
+ "incorrect CPU architecture, only '" + allArchitectures +
+ "' supported, you requested '" + requestedArch + "'");
}
}
10 service/service/java/source/src/org/globus/workspace/service/binding/defaults/DefaultGlobalPolicies.java
View
@@ -38,7 +38,7 @@
private int defaultRunningTimeSeconds;
private int maximumRunningTimeSeconds;
private int terminationOffsetSeconds;
- private String cpuArchitectureName;
+ private String[] cpuArchitectureNames;
private String[] vmmVersions;
private String vmm;
@@ -83,12 +83,12 @@ public void setTerminationOffsetSeconds(int terminationOffsetSeconds) {
this.terminationOffsetSeconds = terminationOffsetSeconds;
}
- public String getCpuArchitectureName() {
- return this.cpuArchitectureName;
+ public String[] getCpuArchitectureNames() {
+ return this.cpuArchitectureNames;
}
- public void setCpuArchitectureName(String cpuArchitectureName) {
- this.cpuArchitectureName = cpuArchitectureName;
+ public void setCpuArchitectureNames(String[] cpuArchitectureNames) {
+ this.cpuArchitectureNames = cpuArchitectureNames;
}
public String[] getVmmVersions() {
Please sign in to comment.
Something went wrong with that request. Please try again.