use of org.ovirt.engine.core.common.action.AddDiskParameters in project ovirt-engine by oVirt.
the class TransferDiskImageCommand method getQuotaStorageConsumptionParameters.
@Override
public List<QuotaConsumptionParameter> getQuotaStorageConsumptionParameters() {
List<QuotaConsumptionParameter> list = new ArrayList<>();
if (getParameters().getAddDiskParameters() != null) {
AddDiskParameters parameters = getAddDiskParameters();
list.add(new QuotaStorageConsumptionParameter(((DiskImage) parameters.getDiskInfo()).getQuotaId(), null, QuotaConsumptionParameter.QuotaAction.CONSUME, getStorageDomainId(), (double) parameters.getDiskInfo().getSize() / SizeConverter.BYTES_IN_GB));
}
return list;
}
use of org.ovirt.engine.core.common.action.AddDiskParameters in project ovirt-engine by oVirt.
the class TransferDiskImageCommand method getAddDiskParameters.
private AddDiskParameters getAddDiskParameters() {
AddDiskParameters diskParameters = getParameters().getAddDiskParameters();
diskParameters.setParentCommand(getActionType());
diskParameters.setParentParameters(getParameters());
diskParameters.setShouldRemainIllegalOnFailedExecution(true);
diskParameters.setSkipDomainCheck(true);
return diskParameters;
}
use of org.ovirt.engine.core.common.action.AddDiskParameters in project ovirt-engine by oVirt.
the class AddCinderDiskCommandCallback method childCommandsExecutionEnded.
@Override
protected void childCommandsExecutionEnded(CommandBase<?> command, boolean anyFailed, List<Guid> childCmdIds, CommandExecutionStatus status, int completedChildren) {
AddCinderDiskCommand<AddDiskParameters> addCinderDiskCommand = (AddCinderDiskCommand<AddDiskParameters>) command;
Guid diskId = getDiskId(addCinderDiskCommand);
ImageStatus imageStatus = addCinderDiskCommand.getCinderBroker().getDiskStatus(diskId);
DiskImage disk = (CinderDisk) diskDao.get(diskId);
if (imageStatus != null && imageStatus != disk.getImageStatus()) {
switch(imageStatus) {
case OK:
setCommandEndStatus(command, false, status, childCmdIds);
break;
case ILLEGAL:
setCommandEndStatus(command, true, status, childCmdIds);
break;
}
}
}
use of org.ovirt.engine.core.common.action.AddDiskParameters in project ovirt-engine by oVirt.
the class AddDiskCommand method buildAddCinderDiskParameters.
private ActionParametersBase buildAddCinderDiskParameters() {
AddDiskParameters parameters = new AddDiskParameters(new DiskVmElement(null, getVmId()), getParameters().getDiskInfo());
parameters.setPlugDiskToVm(getParameters().getPlugDiskToVm());
parameters.setStorageDomainId(getParameters().getStorageDomainId());
parameters.setQuotaId(getQuotaId());
parameters.setEndProcedure(EndProcedure.COMMAND_MANAGED);
if (getVm() != null) {
parameters.setVmSnapshotId(snapshotDao.getId(getVmId(), SnapshotType.ACTIVE));
parameters.setDiskVmElement(getParameters().getDiskVmElement());
}
return parameters;
}
use of org.ovirt.engine.core.common.action.AddDiskParameters in project ovirt-engine by oVirt.
the class AddDiskCommandTest method initializeCommand.
private void initializeCommand(Guid storageId, VolumeType volumeType) {
AddDiskParameters parameters = command.getParameters();
DiskImage disk = new DiskImage();
disk.setVolumeType(volumeType);
parameters.setDiskInfo(disk);
command.getParameters().setStorageDomainId(storageId);
}
Aggregations