Permalink
Browse files

added EC2 support to describe SI, cancel SI and describe spot price h…

…istory
  • Loading branch information...
1 parent 2bd7363 commit 7afec3e5815f7ffee155ae5bfce49b271599b52d @pauloricardomg pauloricardomg committed Aug 7, 2010
@@ -19,6 +19,9 @@
<constructor-arg ref="nimbus-elastic.rm.reboot" />
<constructor-arg ref="nimbus-elastic.rm.describe" />
<constructor-arg ref="nimbus-elastic.rm.requestSI" />
+ <constructor-arg ref="nimbus-elastic.rm.cancelSI" />
+ <constructor-arg ref="nimbus-elastic.rm.describeI" />
+ <constructor-arg ref="nimbus-elastic.rm.spHistory" />
<constructor-arg ref="nimbus-elastic.rm.containerInterface" />
<constructor-arg ref="nimbus-elastic.rm.modulelocator" />
@@ -38,20 +41,6 @@
</bean>
- <bean id="nimbus-elastic.rm.requestSI"
- class="org.nimbustools.messaging.gt4_0_elastic.v2008_05_05.rm.defaults.DefaultRequestSI">
-
- <constructor-arg ref="nimbus-elastic.general.ra" />
- <constructor-arg ref="nimbus-elastic.general.networks" />
- <constructor-arg ref="nimbus-elastic.rm.idmappings" />
- <constructor-arg ref="nimbus-elastic.rm.describe" />
- <constructor-arg ref="nimbus-elastic.rm.containerInterface" />
- <constructor-arg ref="nimbus-elastic.security.sshkeys" />
- <constructor-arg ref="nimbus-elastic.image.repository" />
- <constructor-arg ref="nimbus-elastic.rm.modulelocator" />
-
- </bean>
-
<bean id="nimbus-elastic.rm.terminate"
class="org.nimbustools.messaging.gt4_0_elastic.v2008_05_05.rm.defaults.DefaultTerminate">
@@ -91,6 +80,40 @@
</bean>
+ <!-- ************ Spot Instances *********** -->
+
+ <bean id="nimbus-elastic.rm.requestSI"
+ class="org.nimbustools.messaging.gt4_0_elastic.v2008_05_05.rm.defaults.DefaultRequestSI">
+
+ <constructor-arg ref="nimbus-elastic.general.ra" />
+ <constructor-arg ref="nimbus-elastic.general.networks" />
+ <constructor-arg ref="nimbus-elastic.image.repository" />
+ <constructor-arg ref="nimbus-elastic.rm.idmappings" />
+ <constructor-arg ref="nimbus-elastic.rm.describe" />
+ <constructor-arg ref="nimbus-elastic.rm.describeSI" />
+ <constructor-arg ref="nimbus-elastic.rm.cancelSI" />
+ <constructor-arg ref="nimbus-elastic.rm.containerInterface" />
+ <constructor-arg ref="nimbus-elastic.security.sshkeys" />
+ <constructor-arg ref="nimbus-elastic.rm.modulelocator" />
+
+ </bean>
+
+ <bean id="nimbus-elastic.rm.cancelSI"
+ class="org.nimbustools.messaging.gt4_0_elastic.v2008_05_05.rm.defaults.DefaultCancelSI" />
+
+ <bean id="nimbus-elastic.rm.describeSI"
+ class="org.nimbustools.messaging.gt4_0_elastic.v2008_05_05.rm.defaults.DefaultDescribeSI">
+
+ <constructor-arg ref="nimbus-elastic.rm.idmappings" />
+ <constructor-arg ref="nimbus-elastic.rm.describe" />
+ <constructor-arg ref="nimbus-elastic.general.ra" />
+ </bean>
+
+ <bean id="nimbus-elastic.rm.spHistory"
+ class="org.nimbustools.messaging.gt4_0_elastic.v2008_05_05.rm.defaults.DefaultDescribeSpotPriceHistory">
+
+ <constructor-arg ref="nimbus-elastic.general.ra" />
+ </bean>
<!-- ************ ServiceGeneral *********** -->
@@ -61,4 +61,12 @@ public RequestSpotInstancesResponseType requestSpotInstances(
public CancelSpotInstanceRequestsResponseType cancelSpotInstanceRequests(
CancelSpotInstanceRequestsType cancelSpotInstancesMsg)
throws RemoteException;
+
+ public DescribeSpotInstanceRequestsResponseType describeSpotInstanceRequests(
+ DescribeSpotInstanceRequestsType describeSpotInstancesMsg)
+ throws RemoteException;
+
+ public DescribeSpotPriceHistoryResponseType describeSpotPriceHistoryResponseType(
+ DescribeSpotPriceHistoryType describeSpotPriceHistoryType)
+ throws RemoteException;
}
@@ -25,8 +25,6 @@
import org.nimbustools.api.repr.CreateRequest;
import org.nimbustools.api.repr.CreateResult;
import org.nimbustools.api.repr.ReprFactory;
-import org.nimbustools.api.repr.SpotCreateRequest;
-import org.nimbustools.api.repr.SpotRequestInfo;
import org.nimbustools.api.repr.vm.VM;
import org.nimbustools.api.services.metadata.MetadataServer;
import org.nimbustools.api.services.rm.ManageException;
@@ -64,8 +62,12 @@
protected final Reboot reboot;
protected final Describe describe;
protected final ContainerInterface container;
+
protected final RequestSI reqSI;
-
+ protected final CancelSI cancelSI;
+ protected final DescribeSI describeSI;
+ protected final DescribeSpotPriceHistory priceHistory;
+
// -------------------------------------------------------------------------
// CONSTRUCTORS
@@ -76,6 +78,9 @@ public ServiceRMImpl(Run runImpl,
Reboot rebootImpl,
Describe describeImpl,
RequestSI reqSIImpl,
+ CancelSI cancelSIImpl,
+ DescribeSI describeSIImpl,
+ DescribeSpotPriceHistory priceHistoryImpl,
ContainerInterface containerImpl,
ModuleLocator locator) throws Exception {
@@ -104,10 +109,25 @@ public ServiceRMImpl(Run runImpl,
}
this.reqSI = reqSIImpl;
+ if (cancelSIImpl == null) {
+ throw new IllegalArgumentException("reqSIImpl may not be null");
+ }
+ this.cancelSI = cancelSIImpl;
+
+ if (describeSIImpl == null) {
+ throw new IllegalArgumentException("reqSIImpl may not be null");
+ }
+ this.describeSI = describeSIImpl;
+
if (containerImpl == null) {
throw new IllegalArgumentException("containerImpl may not be null");
}
- this.container = containerImpl;
+ this.container = containerImpl;
+
+ if (priceHistoryImpl == null) {
+ throw new IllegalArgumentException("priceHistoryImpl may not be null");
+ }
+ this.priceHistory = priceHistoryImpl;
if (locator == null) {
throw new IllegalArgumentException("locator may not be null");
@@ -233,29 +253,36 @@ public RequestSpotInstancesResponseType requestSpotInstances(
final Caller caller = this.container.getCaller();
- final SpotRequestInfo result;
- try {
- SpotCreateRequest creq =
- this.reqSI.translateReqSpotInstances(req, caller);
- AddCustomizations.addAll((_CreateRequest)creq,
- this.repr, this.mdServer);
- result = this.manager.requestSpotInstances(creq, caller);
+ return this.reqSI.requestSpotInstances(req, caller, this.manager);
+ }
+
+ public CancelSpotInstanceRequestsResponseType cancelSpotInstanceRequests(
+ CancelSpotInstanceRequestsType req)
+ throws RemoteException {
- } catch (Exception e) {
- throw new RemoteException(e.getMessage(), e);
+ if (req == null) {
+ throw new RemoteException("CancelSpotInstanceRequestsType request is missing");
}
+ final Caller caller = this.container.getCaller();
+ return this.cancelSI.cancelSIRequests(req, caller, this.manager);
+ }
- try {
- return this.reqSI.translateSpotInfo(result, caller);
- } catch (Exception e) {
- final String err = "Problem translating valid request spot instances " +
- "result into elastic protocol. Backout required. " +
- " Error: " + e.getMessage();
- logger.error(err, e);
- //this.terminate.backOutCreateResult(result, caller, this.manager);
- // gets caught by Throwable hook:
- throw new RuntimeException(err, e);
- }
-
+ public DescribeSpotInstanceRequestsResponseType describeSpotInstanceRequests(
+ DescribeSpotInstanceRequestsType req)
+ throws RemoteException {
+ if (req == null) {
+ throw new RemoteException("CancelSpotInstanceRequestsType request is missing");
+ }
+ final Caller caller = this.container.getCaller();
+ return this.describeSI.describeSIRequests(req, caller, manager);
}
+
+ public DescribeSpotPriceHistoryResponseType describeSpotPriceHistoryResponseType(
+ DescribeSpotPriceHistoryType req)
+ throws RemoteException {
+ if (req == null) {
+ throw new RemoteException("CancelSpotInstanceRequestsType request is missing");
+ }
+ return this.priceHistory.describeSpotPriceHistory(req, manager);
+ }
}
@@ -61,14 +61,26 @@ public DescribeInstancesResponseType describeInstances(
public RequestSpotInstancesResponseType requestSpotInstances(
RequestSpotInstancesType requestSpotInstancesMsg)
throws RemoteException {
- throw new RemoteException(UNIMPLEMENTED + "requestSpotInstances");
+ throw new RemoteException(UNIMPLEMENTED + "requestSpotInstances");
}
public CancelSpotInstanceRequestsResponseType cancelSpotInstanceRequests(
CancelSpotInstanceRequestsType cancelSpotInstancesMsg)
throws RemoteException {
throw new RemoteException(UNIMPLEMENTED + "cancelSpotInstanceRequests");
}
+
+ public DescribeSpotInstanceRequestsResponseType describeSpotInstanceRequests(
+ DescribeSpotInstanceRequestsType describeSpotInstancesMsg)
+ throws RemoteException {
+ throw new RemoteException(UNIMPLEMENTED + "describeSpotInstanceRequests");
+ }
+
+ public DescribeSpotPriceHistoryResponseType describeSpotPriceHistoryResponseType(
+ DescribeSpotPriceHistoryType describeSpotPriceHistoryType)
+ throws RemoteException {
+ throw new RemoteException(UNIMPLEMENTED + "describeSpotPriceHistoryResponseType");
+ }
// -------------------------------------------------------------------------
// IMAGE RELATED
@@ -107,7 +107,10 @@ http://cxf.apache.org/schemas/jaxrs.xsd">
<constructor-arg ref="nimbus-query.rm.terminate" />
<constructor-arg ref="nimbus-query.rm.reboot" />
<constructor-arg ref="nimbus-query.rm.describe" />
- <constructor-arg ref="nimbus-query.rm.requestSI" />
+ <constructor-arg ref="nimbus-query.rm.requestSI" />
+ <constructor-arg ref="nimbus-query.rm.cancelSI" />
+ <constructor-arg ref="nimbus-query.rm.describeI" />
+ <constructor-arg ref="nimbus-query.rm.spHistory" />
<constructor-arg ref="nimbus-query.rm.containerInterface" />
<constructor-arg ref="nimbus-query.rm.modulelocator" />
@@ -127,21 +130,6 @@ http://cxf.apache.org/schemas/jaxrs.xsd">
</bean>
- <bean id="nimbus-query.rm.requestSI"
- class="org.nimbustools.messaging.gt4_0_elastic.v2008_05_05.rm.defaults.DefaultRequestSI">
-
- <constructor-arg ref="nimbus-query.general.ra" />
- <constructor-arg ref="nimbus-query.general.networks" />
- <constructor-arg ref="nimbus-query.rm.idmappings" />
- <constructor-arg ref="nimbus-query.rm.describe" />
- <constructor-arg ref="nimbus-query.rm.containerInterface" />
- <constructor-arg ref="nimbus-query.security.sshkeys" />
- <constructor-arg ref="nimbus-query.image.repository" />
- <constructor-arg ref="nimbus-query.rm.modulelocator" />
-
- </bean>
-
-
<bean id="nimbus-query.rm.terminate"
class="org.nimbustools.messaging.gt4_0_elastic.v2008_05_05.rm.defaults.DefaultTerminate">
@@ -182,6 +170,40 @@ http://cxf.apache.org/schemas/jaxrs.xsd">
</bean>
+ <!-- ************ Spot Instances *********** -->
+
+ <bean id="nimbus-query.rm.requestSI"
+ class="org.nimbustools.messaging.gt4_0_elastic.v2008_05_05.rm.defaults.DefaultRequestSI">
+
+ <constructor-arg ref="nimbus-query.general.ra" />
+ <constructor-arg ref="nimbus-query.general.networks" />
+ <constructor-arg ref="nimbus-query.image.repository" />
+ <constructor-arg ref="nimbus-query.rm.idmappings" />
+ <constructor-arg ref="nimbus-query.rm.describe" />
+ <constructor-arg ref="nimbus-query.rm.describeSI" />
+ <constructor-arg ref="nimbus-query.rm.cancelSI" />
+ <constructor-arg ref="nimbus-query.rm.containerInterface" />
+ <constructor-arg ref="nimbus-query.security.sshkeys" />
+ <constructor-arg ref="nimbus-query.rm.modulelocator" />
+
+ </bean>
+
+ <bean id="nimbus-query.rm.cancelSI"
+ class="org.nimbustools.messaging.gt4_0_elastic.v2008_05_05.rm.defaults.DefaultCancelSI" />
+
+ <bean id="nimbus-query.rm.describeSI"
+ class="org.nimbustools.messaging.gt4_0_elastic.v2008_05_05.rm.defaults.DefaultDescribeSI">
+
+ <constructor-arg ref="nimbus-query.rm.idmappings" />
+ <constructor-arg ref="nimbus-query.rm.describe" />
+ <constructor-arg ref="nimbus-query.general.ra" />
+ </bean>
+
+ <bean id="nimbus-query.rm.spHistory"
+ class="org.nimbustools.messaging.gt4_0_elastic.v2008_05_05.rm.defaults.DefaultDescribeSpotPriceHistory">
+
+ <constructor-arg ref="nimbus-query.general.ra" />
+ </bean>
<!-- ************ ServiceGeneral *********** -->

0 comments on commit 7afec3e

Please sign in to comment.