Search in sources :

Example 6 with AddDiskParameters

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;
}
Also used : QuotaStorageConsumptionParameter(org.ovirt.engine.core.bll.quota.QuotaStorageConsumptionParameter) ArrayList(java.util.ArrayList) QuotaConsumptionParameter(org.ovirt.engine.core.bll.quota.QuotaConsumptionParameter) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage) AddDiskParameters(org.ovirt.engine.core.common.action.AddDiskParameters)

Example 7 with AddDiskParameters

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;
}
Also used : AddDiskParameters(org.ovirt.engine.core.common.action.AddDiskParameters)

Example 8 with AddDiskParameters

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;
        }
    }
}
Also used : ImageStatus(org.ovirt.engine.core.common.businessentities.storage.ImageStatus) Guid(org.ovirt.engine.core.compat.Guid) CinderDisk(org.ovirt.engine.core.common.businessentities.storage.CinderDisk) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage) AddDiskParameters(org.ovirt.engine.core.common.action.AddDiskParameters)

Example 9 with AddDiskParameters

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;
}
Also used : DiskVmElement(org.ovirt.engine.core.common.businessentities.storage.DiskVmElement) AddDiskParameters(org.ovirt.engine.core.common.action.AddDiskParameters)

Example 10 with AddDiskParameters

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);
}
Also used : DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage) AddDiskParameters(org.ovirt.engine.core.common.action.AddDiskParameters)

Aggregations

AddDiskParameters (org.ovirt.engine.core.common.action.AddDiskParameters)17 DiskImage (org.ovirt.engine.core.common.businessentities.storage.DiskImage)6 Guid (org.ovirt.engine.core.compat.Guid)6 DiskVmElement (org.ovirt.engine.core.common.businessentities.storage.DiskVmElement)3 ArrayList (java.util.ArrayList)2 Disk (org.ovirt.engine.api.model.Disk)1 QuotaConsumptionParameter (org.ovirt.engine.core.bll.quota.QuotaConsumptionParameter)1 QuotaStorageConsumptionParameter (org.ovirt.engine.core.bll.quota.QuotaStorageConsumptionParameter)1 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)1 RegisterDiskParameters (org.ovirt.engine.core.common.action.RegisterDiskParameters)1 TransferDiskImageParameters (org.ovirt.engine.core.common.action.TransferDiskImageParameters)1 StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)1 CinderDisk (org.ovirt.engine.core.common.businessentities.storage.CinderDisk)1 Disk (org.ovirt.engine.core.common.businessentities.storage.Disk)1 ImageStatus (org.ovirt.engine.core.common.businessentities.storage.ImageStatus)1 GetUnregisteredDiskQueryParameters (org.ovirt.engine.core.common.queries.GetUnregisteredDiskQueryParameters)1 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)1 IFrontendActionAsyncCallback (org.ovirt.engine.ui.uicompat.IFrontendActionAsyncCallback)1