Search in sources :

Example 1 with BaseImagesCommand

use of org.ovirt.engine.core.bll.storage.disk.image.BaseImagesCommand in project ovirt-engine by oVirt.

the class CloneSingleCinderDiskCommandCallback method childCommandsExecutionEnded.

@Override
protected void childCommandsExecutionEnded(CommandBase<?> command, boolean anyFailed, List<Guid> childCmdIds, CommandExecutionStatus status, int completedChildren) {
    BaseImagesCommand<ImagesContainterParametersBase> cloneCinderDiskCommand = (BaseImagesCommand<ImagesContainterParametersBase>) command;
    ImagesContainterParametersBase parameters = cloneCinderDiskCommand.getParameters();
    ImageStatus imageStatus = cloneCinderDiskCommand.getCinderBroker().getDiskStatus(parameters.getDestinationImageId());
    DiskImage disk = (CinderDisk) diskDao.get(parameters.getContainerId());
    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) ImagesContainterParametersBase(org.ovirt.engine.core.common.action.ImagesContainterParametersBase) BaseImagesCommand(org.ovirt.engine.core.bll.storage.disk.image.BaseImagesCommand) CinderDisk(org.ovirt.engine.core.common.businessentities.storage.CinderDisk) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage)

Aggregations

BaseImagesCommand (org.ovirt.engine.core.bll.storage.disk.image.BaseImagesCommand)1 ImagesContainterParametersBase (org.ovirt.engine.core.common.action.ImagesContainterParametersBase)1 CinderDisk (org.ovirt.engine.core.common.businessentities.storage.CinderDisk)1 DiskImage (org.ovirt.engine.core.common.businessentities.storage.DiskImage)1 ImageStatus (org.ovirt.engine.core.common.businessentities.storage.ImageStatus)1