use of org.ovirt.engine.core.common.action.ActionReturnValue in project ovirt-engine by oVirt.
the class ProcessOvfUpdateForStorageDomainCommand method createOvfStoreDisks.
public boolean createOvfStoreDisks(int missingDiskCount) {
boolean allOvfStoreDisksCreated = true;
for (int i = 0; i < missingDiskCount; i++) {
CreateOvfVolumeForStorageDomainCommandParameters parameters = createCreateOvfVolumeForStorageDomainParams();
ActionReturnValue returnValue = runInternalAction(ActionType.CreateOvfVolumeForStorageDomain, parameters, getContext().clone().withoutLock());
if (!returnValue.getSucceeded()) {
allOvfStoreDisksCreated = false;
}
}
return allOvfStoreDisksCreated;
}
use of org.ovirt.engine.core.common.action.ActionReturnValue in project ovirt-engine by oVirt.
the class GlusterStorageSyncCommand method executeCommand.
@Override
protected void executeCommand() {
// Get list of running VMs that have disks on storage domain
List<VM> vms = runInternalQuery(QueryType.GetVmsByStorageDomain, new IdQueryParameters(getStorageDomain().getId())).getReturnValue();
// Snapshot the VMs
Map<Guid, Guid> vmIdSnapshotIdMap = new HashMap<>();
for (VM vm : vms) {
try {
Future<ActionReturnValue> future = commandCoordinatorUtil.executeAsyncCommand(ActionType.CreateSnapshotForVm, getCreateSnapshotParameters(vm), cloneContextAndDetachFromParent());
vmIdSnapshotIdMap.put(vm.getId(), future.get().getActionReturnValue());
} catch (InterruptedException | ExecutionException e) {
log.error("Error creating VM snapshot for VM with id '{}', name '{}' for DR sync", vm.getId(), vm.getName(), e.getMessage());
log.debug("Exception", e);
endWithFailure();
getParameters().setTaskGroupSuccess(false);
}
}
getParameters().setVmIdSnapshotIds(vmIdSnapshotIdMap);
getParameters().setNextStep(DRStep.GEO_REP);
persistCommandIfNeeded();
setSucceeded(true);
}
use of org.ovirt.engine.core.common.action.ActionReturnValue in project ovirt-engine by oVirt.
the class LiveMigrateDiskCommand method removeImage.
private void removeImage(Guid storageDomainId, Guid imageGroupId, Guid imageId, AuditLogType failureAuditLog) {
RemoveImageParameters removeImageParams = new RemoveImageParameters(imageId);
removeImageParams.setStorageDomainId(storageDomainId);
removeImageParams.setParentCommand(ActionType.RemoveImage);
removeImageParams.setDbOperationScope(ImageDbOperationScope.NONE);
removeImageParams.setShouldLockImage(false);
ActionReturnValue returnValue = runInternalAction(ActionType.RemoveImage, removeImageParams, cloneContextAndDetachFromParent());
if (returnValue.getSucceeded()) {
startPollingAsyncTasks(returnValue.getInternalVdsmTaskIdList());
} else {
addCustomValue("DiskAlias", baseDiskDao.get(imageGroupId).getDiskAlias());
addCustomValue("StorageDomainName", storageDomainStaticDao.get(storageDomainId).getName());
addCustomValue("UserName", getUserName());
auditLogDirector.log(this, failureAuditLog);
}
}
use of org.ovirt.engine.core.common.action.ActionReturnValue in project ovirt-engine by oVirt.
the class UpdateOvfStoreForStorageDomainCommand method executeCommand.
@Override
protected void executeCommand() {
Guid storageDomainId = getStorageDomainId();
ProcessOvfUpdateParameters parameters = new ProcessOvfUpdateParameters(getStoragePoolId(), getStorageDomainId());
ActionReturnValue actionReturnValue = runInternalAction(ActionType.ProcessOvfUpdateForStoragePool, parameters, getContext());
Set<Guid> proccessedDomains = actionReturnValue.getActionReturnValue();
if (!actionReturnValue.getSucceeded()) {
propagateFailure(actionReturnValue);
return;
}
if (proccessedDomains != null && proccessedDomains.contains(storageDomainId)) {
actionReturnValue = runInternalActionWithTasksContext(ActionType.ProcessOvfUpdateForStorageDomain, createProcessOvfUpdateForDomainParams());
if (!actionReturnValue.getSucceeded()) {
propagateFailure(actionReturnValue);
return;
}
} else {
addCustomValue("StorageDomainName", getStorageDomain().getName());
auditLogDirector.log(this, AuditLogType.OVF_STORES_UPDATE_IGNORED);
}
setSucceeded(true);
}
use of org.ovirt.engine.core.common.action.ActionReturnValue in project ovirt-engine by oVirt.
the class GlusterStorageGeoRepSyncInternalCommand method executeCommand.
@Override
protected void executeCommand() {
if (getSession().getStatus() != GeoRepSessionStatus.ACTIVE) {
// Start geo-replication
Future<ActionReturnValue> geoRepCmd = commandCoordinatorUtil.executeAsyncCommand(ActionType.StartGlusterVolumeGeoRep, new GlusterVolumeGeoRepSessionParameters(getSession().getMasterVolumeId(), getSession().getId()), cloneContext());
ActionReturnValue result;
try {
result = geoRepCmd.get();
if (!result.getSucceeded()) {
propagateFailure(result);
return;
}
} catch (InterruptedException | ExecutionException e) {
log.error("Exception", e);
return;
}
}
// checkpoint the replication session
GlusterVolumeGeoRepSessionConfigParameters configParams = new GlusterVolumeGeoRepSessionConfigParameters(getSession().getMasterVolumeId(), getSession().getId(), GlusterConstants.GEOREP_CHECKPOINT_OPTION, GlusterConstants.GEOREP_CHECKPOINT_VALUE);
ActionReturnValue result = runInternalAction(ActionType.SetGeoRepConfig, configParams);
if (!result.getSucceeded()) {
propagateFailure(result);
return;
}
setSucceeded(true);
}
Aggregations