public DownloadProgressCommand(DownloadCommand cmd, String jobId, RequestType req) { super(cmd); this.jobId = jobId; this.setRequest(req); }
public CopyCommand(final DataTO srcData, final DataTO destData, final int timeout, final boolean executeInSequence) { super(); srcTO = srcData; destTO = destData; setWait(timeout); this.executeInSequence = executeInSequence; }
public AttachAnswer(DiskTO disk) { super(null); setDisk(disk); }
protected Answer backupSnapshotForObjectStore(final CopyCommand cmd) { final DataTO destData = cmd.getDestTO(); final DataStoreTO imageStore = destData.getDataStore(); final DataTO cacheData = cmd.getCacheTO(); if (cacheData == null) { return new CopyCmdAnswer("Failed to copy to object store without cache store"); } final DataStoreTO cacheStore = cacheData.getDataStore(); ((SnapshotObjectTO)destData).setDataStore(cacheStore); final CopyCmdAnswer answer = (CopyCmdAnswer)backupSnapshot(cmd); if (!answer.getResult()) { return answer; } final SnapshotObjectTO snapshotOnCacheStore = (SnapshotObjectTO)answer.getNewData(); snapshotOnCacheStore.setDataStore(cacheStore); ((SnapshotObjectTO)destData).setDataStore(imageStore); final CopyCommand newCpyCmd = new CopyCommand(snapshotOnCacheStore, destData, cmd.getWaitInMillSeconds(), cmd.executeInSequence()); return copyToObjectStore(newCpyCmd); }
protected Answer execute(CreateObjectCommand cmd) { DataTO data = cmd.getData(); try { if (data.getObjectType() == DataObjectType.VOLUME) { return processor.createVolume(cmd); } else if (data.getObjectType() == DataObjectType.SNAPSHOT) { return processor.createSnapshot(cmd); } return new CreateObjectAnswer("not supported type"); } catch (Exception e) { s_logger.debug("Failed to create object: " + data.getObjectType() + ": " + e.toString()); return new CreateObjectAnswer(e.toString()); } }
protected Answer copyFromNfsToImage(CopyCommand cmd) { DataTO destData = cmd.getDestTO(); DataStoreTO destDataStore = destData.getDataStore(); if (destDataStore instanceof S3TO) { return copyFromNfsToS3(cmd); } else if (destDataStore instanceof SwiftTO) { return copyFromNfsToSwift(cmd); } else { return new CopyCmdAnswer("unsupported "); } }
@Override public Answer createTemplateFromSnapshot(CopyCommand cmd) { Map<String, String> details = cmd.getOptions(); if (details != null && details.get(DiskTO.IQN) != null) { // use the managed-storage approach return createTemplateFromVolumeOrSnapshot(cmd); } return new CopyCmdAnswer("operation not supported"); }
public DownloadCommand(DownloadCommand that) { super(that); hvm = that.hvm; checksum = that.checksum; id = that.id; description = that.description; auth = that.getAuth(); setSecUrl(that.getSecUrl()); maxDownloadSizeInBytes = that.getMaxDownloadSizeInBytes(); resourceType = that.resourceType; installPath = that.installPath; _store = that._store; _proxy = that._proxy; }
/** * clean up template data on staging area * @param newTemplate: The template on the secondary storage that needs to be cleaned up */ protected void cleanupStagingNfs(TemplateObjectTO newTemplate) { try { DeleteCommand deleteCommand = new DeleteCommand(newTemplate); execute(deleteCommand); } catch (Exception e) { s_logger.debug("Failed to clean up staging area:", e); } }
private void invokeCallback(String errMsg, AsyncCompletionCallback<CopyCommandResult> callback) { CopyCmdAnswer copyCmdAnswer = new CopyCmdAnswer(errMsg); CopyCommandResult result = new CopyCommandResult(null, copyCmdAnswer); result.setResult(errMsg); callback.complete(result); }
protected Answer execute(AttachCommand cmd) { DiskTO disk = cmd.getDisk(); if (disk.getType() == Volume.Type.ISO) { return processor.attachIso(cmd); } else { return processor.attachVolume(cmd); } }
protected Answer execute(DettachCommand cmd) { DiskTO disk = cmd.getDisk(); if (disk.getType() == Volume.Type.ISO) { return processor.dettachIso(cmd); } else { return processor.dettachVolume(cmd); } } }
@Override public SnapshotAndCopyAnswer snapshotAndCopy(final SnapshotAndCopyCommand cmd) { s_logger.info("'SnapshotAndCopyAnswer snapshotAndCopy(SnapshotAndCopyCommand)' not currently used for KVMStorageProcessor"); return new SnapshotAndCopyAnswer(); }
@Override public ResignatureAnswer resignature(final ResignatureCommand cmd) { s_logger.info("'ResignatureAnswer resignature(ResignatureCommand)' not currently used for KVMStorageProcessor"); return new ResignatureAnswer(); }
public int getWaitInMillSeconds() { return getWait() * 1000; }
public DettachAnswer(DiskTO disk) { super(null); setDisk(disk); }
public DownloadCommand(TemplateObjectTO template, Long maxDownloadSizeInBytes) { super(template.getName(), template.getOrigUrl(), template.getFormat(), template.getAccountId()); _store = template.getDataStore(); installPath = template.getPath(); hvm = template.isRequiresHvm(); checksum = template.getChecksum(); id = template.getId(); description = template.getDescription(); if (_store instanceof NfsTO) { setSecUrl(((NfsTO)_store).getUrl()); } this.maxDownloadSizeInBytes = maxDownloadSizeInBytes; }
public Answer execute(CreateObjectCommand cmd) { LOGGER.debug("execute: "+ cmd.getClass()); DataTO data = cmd.getData(); if (data.getObjectType() == DataObjectType.VOLUME) { return createVolume(cmd); } else if (data.getObjectType() == DataObjectType.SNAPSHOT) { return createSnapshot(cmd); } else if (data.getObjectType() == DataObjectType.TEMPLATE) { LOGGER.debug("Template object creation not supported."); } return new CreateObjectAnswer(data.getObjectType() + " object creation not supported"); } /**
/** * make sure both mounts are there, snapshot source image * copy snap to dest image, remove source snap and unmount * iSCSI? */ @Override public SnapshotAndCopyAnswer snapshotAndCopy(SnapshotAndCopyCommand cmd) { LOGGER.info("'SnapshotAndCopyAnswer snapshotAndCopy(SnapshotAndCopyCommand)' not currently used for Ovm3StorageProcessor"); return new SnapshotAndCopyAnswer("Not implemented"); }
@Override public ResignatureAnswer resignature(final ResignatureCommand cmd) { LOGGER.info("'ResignatureAnswer resignature(ResignatureCommand)' not currently used for Ovm3StorageProcessor"); return new ResignatureAnswer("Not implemented"); }