Source:
protected Answer copyFromNfsToSwift(CopyCommand cmd) { final DataTO srcData = cmd.getSrcTO(); final DataTO destData = cmd.getDestTO(); DataStoreTO srcDataStore = srcData.getDataStore(); NfsTO srcStore = (NfsTO)srcDataStore; DataStoreTO destDataStore = destData.getDataStore(); File srcFile = getFile(srcData.getPath(), srcStore.getUrl()); SwiftTO swift = (SwiftTO)destDataStore; try { String containerName = SwiftUtil.getContainerName(destData.getObjectType().toString(), destData.getId()); String swiftPath = SwiftUtil.putObject(swift, srcFile, containerName, srcFile.getName()); DataTO retObj = null; if (destData.getObjectType() == DataObjectType.TEMPLATE) { swiftUploadMetadataFile(swift, srcFile, containerName); TemplateObjectTO newTemplate = new TemplateObjectTO(); newTemplate.setPath(swiftPath); newTemplate.setSize(getVirtualSize(srcFile, getTemplateFormat(srcFile.getName()))); newTemplate.setPhysicalSize(srcFile.length()); newTemplate.setFormat(getTemplateFormat(srcFile.getName())); retObj = newTemplate; } else if (destData.getObjectType() == DataObjectType.VOLUME) { VolumeObjectTO newVol = new VolumeObjectTO(); newVol.setPath(containerName); newVol.setSize(srcFile.length()); retObj = newVol; } else if (destData.getObjectType() == DataObjectType.SNAPSHOT) { SnapshotObjectTO newSnapshot = new SnapshotObjectTO(); newSnapshot.setPath(containerName); retObj = newSnapshot; } return new CopyCmdAnswer(retObj); } catch (Exception e) { s_logger.error("failed to upload " + srcData.getPath(), e); return new CopyCmdAnswer("failed to upload " + srcData.getPath() + e.toString()); } }

Target:
protected Answer copyFromNfsToSwift(CopyCommand cmd) { final DataTO srcData = cmd.getSrcTO(); final DataTO destData = cmd.getDestTO(); DataStoreTO srcDataStore = srcData.getDataStore(); NfsTO srcStore = (NfsTO)srcDataStore; DataStoreTO destDataStore = destData.getDataStore(); File srcFile = getFile(srcData.getPath(), srcStore.getUrl()); SwiftTO swift = (SwiftTO)destDataStore; try { String containerName = SwiftUtil.getContainerName(destData.getObjectType().toString(), destData.getId()); String swiftPath = SwiftUtil.putObject(swift, srcFile, containerName, srcFile.getName()); DataTO retObj = null; if (destData.getObjectType() == DataObjectType.TEMPLATE) { swiftUploadMetadataFile(swift, srcFile, containerName); TemplateObjectTO newTemplate = new TemplateObjectTO(); newTemplate.setPath(swiftPath); newTemplate.setSize(getVirtualSize(srcFile, getTemplateFormat(srcFile.getName()))); newTemplate.setPhysicalSize(srcFile.length()); newTemplate.setFormat(getTemplateFormat(srcFile.getName())); retObj = newTemplate; } else if (destData.getObjectType() == DataObjectType.VOLUME) { VolumeObjectTO newVol = new VolumeObjectTO(); newVol.setPath(containerName); newVol.setSize(getVirtualSize(srcFile, getTemplateFormat(srcFile.getName()))); retObj = newVol; } else if (destData.getObjectType() == DataObjectType.SNAPSHOT) { SnapshotObjectTO newSnapshot = new SnapshotObjectTO(); newSnapshot.setPath(containerName); retObj = newSnapshot; } return new CopyCmdAnswer(retObj); } catch (Exception e) { s_logger.error("failed to upload " + srcData.getPath(), e); return new CopyCmdAnswer("failed to upload " + srcData.getPath() + e.toString()); } }