Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Add ability to specify multiple allowed CPU architectures #15

Closed
wants to merge 1 commit into from

2 participants

@oldpatricka
Collaborator

This patch allows Nimbus administrators to specify multiple permitted CPU architectures in vmm.conf. You can now do this in the same way you can request multiple vmm versions, with a comma separated list.

Comments welcome.

@labisso
Collaborator

Merged in e33acdb

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 7, 2010
  1. @oldpatricka
This page is out of date. Refresh to see the latest.
View
4 messaging/gt4.0/java/msgbridge/src/org/nimbustools/messaging/gt4_0/factory/FactoryResource.java
@@ -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);
}
View
2  service-api/java/source/src/org/nimbustools/api/_repr/_Advertised.java
@@ -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);
View
13 service-api/java/source/src/org/nimbustools/api/defaults/repr/DefaultAdvertised.java
@@ -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 + '\'' +
View
2  service-api/java/source/src/org/nimbustools/api/repr/Advertised.java
@@ -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();
View
2  service/service/java/source/etc/workspace-service/other/main.xml
@@ -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}" />
View
4 service/service/java/source/src/org/globus/workspace/creation/defaults/DefaultCreation.java
@@ -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(
View
2  service/service/java/source/src/org/globus/workspace/service/binding/GlobalPolicies.java
@@ -24,7 +24,7 @@
public int getTerminationOffsetSeconds();
- public String getCpuArchitectureName();
+ public String[] getCpuArchitectureNames();
public String[] getVmmVersions();
View
32 service/service/java/source/src/org/globus/workspace/service/binding/authorization/DefaultAuthorize.java
@@ -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 + "'");
}
}
View
10 service/service/java/source/src/org/globus/workspace/service/binding/defaults/DefaultGlobalPolicies.java
@@ -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() {
Something went wrong with that request. Please try again.