Permalink
Browse files

Move customization task file transfer from propagate to start

This allows to customize virtual machines started without propagation,
for instance file:/// images.

Closes #107.
  • Loading branch information...
1 parent 3df1322 commit 19a86588eab68a8ecd31dc910db51a7c90b0921d @priteau priteau committed Jul 18, 2012
@@ -16,15 +16,12 @@
package org.globus.workspace.xen.xenssh;
-import org.globus.workspace.PathConfigs;
import org.globus.workspace.WorkspaceException;
import org.globus.workspace.cmdutils.SSHUtil;
import org.globus.workspace.persistence.WorkspaceDatabaseException;
-import org.globus.workspace.service.binding.vm.FileCopyNeed;
import org.globus.workspace.service.binding.vm.VirtualMachine;
import org.globus.workspace.service.impls.site.PropagationAdapter;
import org.globus.workspace.xen.XenTask;
-import org.globus.workspace.xen.XenUtil;
import java.util.ArrayList;
@@ -58,39 +55,12 @@ protected void init() throws WorkspaceException {
protected Exception preExecute(boolean fake) {
- final boolean eventLog = this.ctx.lager().eventLog;
final boolean traceLog = this.ctx.lager().traceLog;
if (traceLog) {
logger.trace("Beginning propagate pre-execute");
}
- // init would have thrown exception if null
- final VirtualMachine vm = this.ctx.getVm();
-
- final FileCopyNeed[] needs = vm.getFileCopyNeeds();
- if (needs == null || needs.length == 0) {
- if (traceLog) {
- logger.debug("FileCopy push: nothing to do");
- }
- return null;
- }
-
- final PathConfigs paths = this.ctx.getLocator().getPathConfigs();
- final String backendDirectory = paths.getBackendTempDirPath();
- final String localDirectory = paths.getLocalTempDirPath();
-
- try {
- XenUtil.doFilePushRemoteTarget(vm,
- localDirectory,
- backendDirectory,
- fake,
- eventLog,
- traceLog);
- } catch (Exception e) {
- return e;
- }
-
return _preExecute(fake,
this.ctx.getLocator().getPropagationAdapter());
}
@@ -16,6 +16,7 @@
package org.globus.workspace.xen.xenssh;
+import org.globus.workspace.PathConfigs;
import org.globus.workspace.WorkspaceException;
import org.globus.workspace.persistence.WorkspaceDatabaseException;
import org.globus.workspace.cmdutils.SSHUtil;
@@ -46,9 +47,31 @@ protected void init() throws WorkspaceException {
protected Exception preExecute(boolean fake) {
+ final boolean eventLog = this.ctx.lager().eventLog;
+ final boolean traceLog = this.ctx.lager().traceLog;
+
+ if (traceLog) {
+ logger.trace("Beginning start pre-execute");
+ }
+
final VirtualMachine vm = this.ctx.getVm();
final FileCopyNeed[] needs = vm.getFileCopyNeeds();
+ final PathConfigs paths = this.ctx.getLocator().getPathConfigs();
+ final String backendDirectory = paths.getBackendTempDirPath();
+ final String localDirectory = paths.getLocalTempDirPath();
+
+ try {
+ XenUtil.doFilePushRemoteTarget(vm,
+ localDirectory,
+ backendDirectory,
+ fake,
+ eventLog,
+ traceLog);
+ } catch (Exception e) {
+ return e;
+ }
+
// todo: do not like this concept (waiting for ORM overhaul)
final int vmid = vm.getID().intValue();
for (int i = 0; i < needs.length; i++) {

0 comments on commit 19a8658

Please sign in to comment.