Permalink
Browse files

Persistence implementation added to VMMReaper

  • Loading branch information...
1 parent 61e88ae commit 401d7d1b455ffd3b2595cb55438f3f08203a8b17 @carlasouza carlasouza committed Jul 28, 2011
Showing with 20 additions and 2 deletions.
  1. +20 −2 service/service/java/source/src/org/globus/workspace/service/impls/VMMReaper.java
View
22 service/service/java/source/src/org/globus/workspace/service/impls/VMMReaper.java
@@ -21,10 +21,13 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.globus.workspace.Lager;
+import org.globus.workspace.persistence.PersistenceAdapter;
import org.globus.workspace.scheduler.defaults.ResourcepoolEntry;
import org.globus.workspace.service.InstanceResource;
import org.globus.workspace.service.WorkspaceHome;
+import org.globus.workspace.service.binding.vm.VirtualMachine;
import org.globus.workspace.service.impls.async.*;
+import org.globus.workspace.WorkspaceConstants;
import org.globus.workspace.xen.xenssh.Query;
import org.nimbustools.api.services.rm.ManageException;
@@ -53,13 +56,14 @@
protected final ExecutorService executor;
protected final WorkspaceHome home;
protected final Lager lager;
-
+ protected final PersistenceAdapter persistence;
// -------------------------------------------------------------------------
// CONSTRUCTORS
// -------------------------------------------------------------------------
public VMMReaper(ExecutorService executorService,
+ PersistenceAdapter persistenceImpl,
WorkspaceHome whome,
Lager lagerImpl) {
@@ -68,6 +72,12 @@ public VMMReaper(ExecutorService executorService,
}
this.executor = executorService;
+ if (persistenceImpl == null) {
+ throw new IllegalArgumentException(
+ "persistenceImpl may not be null");
+ }
+ this.persistence = persistenceImpl;
+
if (whome == null) {
throw new IllegalArgumentException("whome may not be null");
}
@@ -118,10 +128,13 @@ protected void reaperVMM() throws ManageException {
// These are the libvirt guest states
// 1 = running; 2 = idle; 3 = paused; 4 = shutdown; 5 = shut off; 6 = crashed; 7 = dying
+
VMMRequest req = reqFactory.query();
//set context
+ VirtualMachine m = new VirtualMachine();
+
String state = null;
- try{
+ try {
// state = req.execute();
req.execute();
} catch (Exception e) {
@@ -139,6 +152,11 @@ protected void reaperVMM() throws ManageException {
//29 = CORRUPTED_GENERIC
for (InstanceResource r: ires) {
Integer state = r.getState();
+
+
+ this.persistence.setState(r.getID(),
+ WorkspaceConstants.STATE_CORRUPTED_GENERIC,
+ null);
}
//TODO compare states with isInconsistent()

0 comments on commit 401d7d1

Please sign in to comment.