if (traceLog) {
logger.trace("Beginning start 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("customization file 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.doFilePushLocalTarget(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++) {
try {
needs[i].setOnImage(true);
this.ctx.getLocator().getPersistenceAdapter().
setFileCopyOnImage(vmid, needs[i]);