use of org.ovirt.engine.core.common.asynctasks.AsyncTaskCreationInfo in project ovirt-engine by oVirt.
the class CreateImageVDSCommand method executeIrsBrokerCommand.
@Override
protected void executeIrsBrokerCommand() {
storageDomainHelper.checkNumberOfLVsForBlockDomain(getParameters().getStorageDomainId());
setReturnValue(Guid.Empty);
log.info("-- executeIrsBrokerCommand: calling 'createVolume' with two new parameters: description and UUID");
// NOTE: The 'uuidReturn' variable will contain the taskID and not the
// created image id!
String imageInitSize = null;
if (getParameters().getImageInitialSizeInBytes() != 0) {
imageInitSize = Long.valueOf(getParameters().getImageInitialSizeInBytes()).toString();
}
String diskType = FeatureSupported.isContentTypeSupported(getParameters().getPoolCompatibilityVersion()) ? getParameters().getDiskContentType().getStorageValue() : DiskContentType.LEGACY_DISK_TYPE;
uuidReturn = getIrsProxy().createVolume(getParameters().getStorageDomainId().toString(), getParameters().getStoragePoolId().toString(), getParameters().getImageGroupId().toString(), Long.valueOf(getParameters().getImageSizeInBytes()).toString(), getParameters().getVolumeFormat().getValue(), getParameters().getImageType().getValue(), diskType, getParameters().getNewImageID().toString(), getParameters().getNewImageDescription(), Guid.Empty.toString(), Guid.Empty.toString(), imageInitSize);
proceedProxyReturnValue();
Guid taskID = new Guid(uuidReturn.uuid);
createdImageId = getParameters().getNewImageID().toString();
setReturnValue(new Guid(createdImageId));
getVDSReturnValue().setCreationInfo(new AsyncTaskCreationInfo(taskID, AsyncTaskType.createVolume, getParameters().getStoragePoolId()));
}
use of org.ovirt.engine.core.common.asynctasks.AsyncTaskCreationInfo in project ovirt-engine by oVirt.
the class DestroyImageVDSCommand method executeIrsBrokerCommand.
@Override
protected void executeIrsBrokerCommand() {
DestroyImageVDSCommandParameters params = getParameters();
int imageListSize = params.getImageList().size();
String[] volUUID = new String[imageListSize];
int i = 0;
for (Guid tempGuid : params.getImageList()) {
volUUID[i++] = tempGuid.toString();
}
uuidReturn = deleteVolume(params.getStorageDomainId().toString(), params.getStoragePoolId().toString(), params.getImageGroupId().toString(), volUUID, String.valueOf(params.getPostZero()), params.isDiscard(), String.valueOf(params.getForce()));
proceedProxyReturnValue();
Guid taskID = new Guid(uuidReturn.uuid);
getVDSReturnValue().setCreationInfo(new AsyncTaskCreationInfo(taskID, AsyncTaskType.deleteVolume, getParameters().getStoragePoolId()));
}
use of org.ovirt.engine.core.common.asynctasks.AsyncTaskCreationInfo in project ovirt-engine by oVirt.
the class RemoveVmLeaseVDSCommand method executeIrsBrokerCommand.
@Override
protected void executeIrsBrokerCommand() {
returnValue = getIrsProxy().removeVmLease(getParameters().getLeaseId().toString(), getParameters().getStorageDomainId().toString());
proceedProxyReturnValue();
Guid taskID = new Guid(returnValue.getTaskId());
getVDSReturnValue().setCreationInfo(new AsyncTaskCreationInfo(taskID, AsyncTaskType.removeVmLease, getParameters().getStoragePoolId()));
}
use of org.ovirt.engine.core.common.asynctasks.AsyncTaskCreationInfo in project ovirt-engine by oVirt.
the class HSMGetAllTasksInfoVDSCommand method parseTaskInfoList.
protected ArrayList<AsyncTaskCreationInfo> parseTaskInfoList(Map<String, Map<String, String>> taskInfoList) {
try {
ArrayList<AsyncTaskCreationInfo> result = new ArrayList<>(taskInfoList.size());
for (Map.Entry<String, Map<String, String>> entry : taskInfoList.entrySet()) {
Guid taskID = new Guid(entry.getKey());
Map<String, String> taskInfo = entry.getValue();
AsyncTaskCreationInfo task = parseTaskInfo(taskInfo, taskID);
if (task != null) {
result.add(task);
}
}
return result;
} catch (RuntimeException exp) {
log.error("Could not parse task info list: '{}'", taskInfoList);
throw exp;
}
}
use of org.ovirt.engine.core.common.asynctasks.AsyncTaskCreationInfo in project ovirt-engine by oVirt.
the class HSMGetAllTasksInfoVDSCommand method parseTaskInfo.
protected AsyncTaskCreationInfo parseTaskInfo(Map<String, String> taskInfo, Guid taskID) {
try {
String deTaskType = taskInfo.get(VERB_KEY);
AsyncTaskType taskType;
try {
taskType = AsyncTaskType.valueOf(deTaskType);
} catch (Exception e) {
taskType = AsyncTaskType.unknown;
log.warn("The task type in the vdsm response is '{}' and does not " + " appear in the AsyncTaskType enum", deTaskType);
}
AsyncTaskCreationInfo tempVar = new AsyncTaskCreationInfo();
tempVar.setVdsmTaskId(taskID);
tempVar.setTaskType(taskType);
AsyncTaskCreationInfo task = tempVar;
return task;
} catch (RuntimeException e) {
log.error("Could not parse single task info: '{}' (possibly specific task should not be monitored): {}", taskInfo, e.getMessage());
log.debug("Exception", e);
return null;
}
}
Aggregations