use of org.ovirt.engine.core.compat.Guid in project ovirt-engine by oVirt.
the class GlusterStorageSyncCommand method removeDRSnapshots.
private void removeDRSnapshots() {
for (Map.Entry<Guid, Guid> entry : getParameters().getVmIdSnapshotIds().entrySet()) {
RemoveSnapshotParameters removeSnapshotParameters = new RemoveSnapshotParameters(entry.getValue(), entry.getKey());
removeSnapshotParameters.setParentCommand(getActionType());
removeSnapshotParameters.setEndProcedure(EndProcedure.COMMAND_MANAGED);
removeSnapshotParameters.setParentParameters(getParameters());
removeSnapshotParameters.setNeedsLocking(false);
commandCoordinatorUtil.executeAsyncCommand(ActionType.RemoveSnapshot, removeSnapshotParameters, cloneContextAndDetachFromParent());
}
}
use of org.ovirt.engine.core.compat.Guid 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.compat.Guid in project ovirt-engine by oVirt.
the class GetEntitiesWithLeaseByStorageIdQuery method executeQueryCommand.
@Override
protected void executeQueryCommand() {
Guid domainId = getParameters().getId();
List<VmBase> entities = new ArrayList<>();
entities.addAll(vmStaticDao.getAllWithLeaseOnStorageDomain(domainId));
entities.addAll(vmTemplateDao.getAllWithLeaseOnStorageDomain(domainId));
getQueryReturnValue().setReturnValue(entities);
}
use of org.ovirt.engine.core.compat.Guid in project ovirt-engine by oVirt.
the class VmLeaseCommandBase method executeCommand.
@Override
protected void executeCommand() {
Guid taskId = persistAsyncTaskPlaceHolder(getParameters().getParentCommand());
VmLeaseVDSParameters params = new VmLeaseVDSParameters(getParameters().getStoragePoolId(), getParameters().getStorageDomainId(), getParameters().getVmId());
VDSReturnValue returnValue = runVdsCommand(getLeaseAction(), params);
if (returnValue.getSucceeded()) {
getTaskIdList().add(createTask(taskId, returnValue.getCreationInfo(), getParameters().getParentCommand(), VdcObjectType.Storage, getParameters().getStorageDomainId()));
}
setSucceeded(returnValue.getSucceeded());
}
use of org.ovirt.engine.core.compat.Guid 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);
}
Aggregations