private void verifyCopyCmdAnswer(CopyCmdAnswer copyCmdAnswer, DataObject dataObject) { if (copyCmdAnswer == null) { throw new CloudRuntimeException("Unable to create a volume from a " + dataObject.getType().toString().toLowerCase() + " (copyCmdAnswer == null)"); } if (copyCmdAnswer.getResult()) { return; } String details = copyCmdAnswer.getDetails(); if (StringUtils.isEmpty(details)) { throw new CloudRuntimeException("Unable to create a volume from a " + dataObject.getType().toString().toLowerCase() + " (no error details specified)"); } throw new CloudRuntimeException(details); }
if (copyCmdAnswer == null || !copyCmdAnswer.getResult()) { if (copyCmdAnswer != null && !StringUtils.isEmpty(copyCmdAnswer.getDetails())) { throw new CloudRuntimeException(copyCmdAnswer.getDetails());
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); }
if (needCacheStorage && copyCmdAnswer != null && copyCmdAnswer.getResult()) { cacheMgr.deleteCacheObject(cacheData);
if (!copyCmdAnswer.getResult()) { errMsg = copyCmdAnswer.getDetails();
if (copyCmdAnswer == null || !copyCmdAnswer.getResult()) { if (copyCmdAnswer != null && !StringUtils.isEmpty(copyCmdAnswer.getDetails())) { throw new CloudRuntimeException(copyCmdAnswer.getDetails());