use of com.cloud.engine.subsystem.api.storage.CopyCommandResult in project cosmic by MissionCriticalCloud.
the class AncientDataMotionStrategy method copyAsync.
@Override
public Void copyAsync(final Map<VolumeInfo, DataStore> volumeMap, final VirtualMachineTO vmTo, final Host srcHost, final Host destHost, final AsyncCompletionCallback<CopyCommandResult> callback) {
final CopyCommandResult result = new CopyCommandResult(null, null);
result.setResult("Unsupported operation requested for copying data.");
callback.complete(result);
return null;
}
use of com.cloud.engine.subsystem.api.storage.CopyCommandResult in project cosmic by MissionCriticalCloud.
the class AncientDataMotionStrategy method copyAsync.
// Note: destHost is currently only used if the copyObject method is invoked
@Override
public Void copyAsync(final DataObject srcData, final DataObject destData, final Host destHost, final AsyncCompletionCallback<CopyCommandResult> callback) {
Answer answer = null;
String errMsg = null;
try {
s_logger.debug("copyAsync inspecting src type " + srcData.getType().toString() + " copyAsync inspecting dest type " + destData.getType().toString());
if (srcData.getType() == DataObjectType.SNAPSHOT && destData.getType() == DataObjectType.VOLUME) {
answer = copyVolumeFromSnapshot(srcData, destData);
} else if (srcData.getType() == DataObjectType.SNAPSHOT && destData.getType() == DataObjectType.TEMPLATE) {
answer = createTemplateFromSnapshot(srcData, destData);
} else if (srcData.getType() == DataObjectType.TEMPLATE && destData.getType() == DataObjectType.VOLUME) {
answer = cloneVolume(srcData, destData);
} else if (destData.getType() == DataObjectType.VOLUME && srcData.getType() == DataObjectType.VOLUME && srcData.getDataStore().getRole() == DataStoreRole.Primary && destData.getDataStore().getRole() == DataStoreRole.Primary) {
if (srcData.getId() == destData.getId()) {
// The volume has to be migrated across storage pools.
answer = migrateVolumeToPool(srcData, destData);
} else {
answer = copyVolumeBetweenPools(srcData, destData);
}
} else if (srcData.getType() == DataObjectType.SNAPSHOT && destData.getType() == DataObjectType.SNAPSHOT) {
answer = copySnapshot(srcData, destData);
} else {
answer = copyObject(srcData, destData, destHost);
}
if (answer != null && !answer.getResult()) {
errMsg = answer.getDetails();
}
} catch (final Exception e) {
s_logger.debug("copy failed", e);
errMsg = e.toString();
}
final CopyCommandResult result = new CopyCommandResult(null, answer);
result.setResult(errMsg);
callback.complete(result);
return null;
}
Aggregations