use of org.ovirt.engine.core.common.vdscommands.DestroyImageVDSCommandParameters 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.vdscommands.DestroyImageVDSCommandParameters in project ovirt-engine by oVirt.
the class RestoreFromSnapshotCommand method performImageVdsmOperation.
@Override
protected boolean performImageVdsmOperation() {
VDSReturnValue vdsReturnValue = null;
try {
Guid storagePoolId = getDiskImage().getStoragePoolId() != null ? getDiskImage().getStoragePoolId() : Guid.Empty;
Guid storageDomainId = getDiskImage().getStorageIds() != null && !getDiskImage().getStorageIds().isEmpty() ? getDiskImage().getStorageIds().get(0) : Guid.Empty;
Guid imageGroupId = getDiskImage().getId() != null ? getDiskImage().getId() : Guid.Empty;
Guid taskId = persistAsyncTaskPlaceHolder(ActionType.RestoreAllSnapshots);
vdsReturnValue = runVdsCommand(VDSCommandType.DestroyImage, postDeleteActionHandler.fixParameters(new DestroyImageVDSCommandParameters(storagePoolId, storageDomainId, imageGroupId, _imagesToDelete, getDiskImage().isWipeAfterDelete(), storageDomainDao.get(storageDomainId).getDiscardAfterDelete(), true)));
if (vdsReturnValue.getSucceeded()) {
getReturnValue().getInternalVdsmTaskIdList().add(createTask(taskId, vdsReturnValue.getCreationInfo(), ActionType.RestoreAllSnapshots, VdcObjectType.Storage, storageDomainId));
}
}// Don't throw an exception when cannot destroy image in the VDSM.
catch (EngineException e) {
// Set fault for parent command RestoreAllSnapshotCommand to use, if decided to fail the command.
getReturnValue().setFault(new EngineFault(e, e.getVdsError().getCode()));
log.info("Image '{}' not exist in Irs", getDiskImage().getImageId());
}
return vdsReturnValue != null ? vdsReturnValue.getSucceeded() : false;
}
Aggregations