Search in sources :

Example 1 with ImageStatus

use of org.ovirt.engine.core.common.businessentities.storage.ImageStatus in project ovirt-engine by oVirt.

the class RemoveCinderSnapshotCommandCallback method childCommandsExecutionEnded.

@Override
protected void childCommandsExecutionEnded(CommandBase<?> command, boolean anyFailed, List<Guid> childCmdIds, CommandExecutionStatus status, int completedChildren) {
    RemoveCinderSnapshotDiskCommand<ImagesContainterParametersBase> removeCinderSnapshotDiskCommand = (RemoveCinderSnapshotDiskCommand<ImagesContainterParametersBase>) command;
    ImagesContainterParametersBase parameters = removeCinderSnapshotDiskCommand.getParameters();
    Guid diskId = parameters.getDestinationImageId();
    if (!removeCinderSnapshotDiskCommand.getCinderBroker().isSnapshotExist(diskId)) {
        // Cinder snapshot has been deleted successfully
        setCommandEndStatus(command, false, status, childCmdIds);
        return;
    }
    ImageStatus imageStatus = removeCinderSnapshotDiskCommand.getCinderBroker().getSnapshotStatus(diskId);
    DiskImage disk = diskImageDao.getSnapshotById(diskId);
    if (imageStatus != null && imageStatus != disk.getImageStatus()) {
        switch(imageStatus) {
            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) Guid(org.ovirt.engine.core.compat.Guid) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage)

Example 2 with ImageStatus

use of org.ovirt.engine.core.common.businessentities.storage.ImageStatus 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)

Example 3 with ImageStatus

use of org.ovirt.engine.core.common.businessentities.storage.ImageStatus in project ovirt-engine by oVirt.

the class CreateCinderSnapshotCommandCallback method childCommandsExecutionEnded.

@Override
protected void childCommandsExecutionEnded(CommandBase<?> command, boolean anyFailed, List<Guid> childCmdIds, CommandExecutionStatus status, int completedChildren) {
    CreateCinderSnapshotCommand<CreateCinderSnapshotParameters> createCinderSnapshotCommand = (CreateCinderSnapshotCommand<CreateCinderSnapshotParameters>) command;
    CreateCinderSnapshotParameters parameters = createCinderSnapshotCommand.getParameters();
    Guid diskId = parameters.getDestinationImageId();
    ImageStatus imageStatus;
    if (parameters.getSnapshotType().equals(Snapshot.SnapshotType.STATELESS)) {
        imageStatus = createCinderSnapshotCommand.getCinderBroker().getDiskStatus(diskId);
    } else {
        imageStatus = createCinderSnapshotCommand.getCinderBroker().getSnapshotStatus(diskId);
    }
    DiskImage disk = diskImageDao.getSnapshotById(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 : CreateCinderSnapshotParameters(org.ovirt.engine.core.common.action.CreateCinderSnapshotParameters) ImageStatus(org.ovirt.engine.core.common.businessentities.storage.ImageStatus) Guid(org.ovirt.engine.core.compat.Guid) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage)

Example 4 with ImageStatus

use of org.ovirt.engine.core.common.businessentities.storage.ImageStatus 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 5 with ImageStatus

use of org.ovirt.engine.core.common.businessentities.storage.ImageStatus in project ovirt-engine by oVirt.

the class ExtendCinderDiskCommandCallback method childCommandsExecutionEnded.

@Override
protected void childCommandsExecutionEnded(CommandBase<?> command, boolean anyFailed, List<Guid> childCmdIds, CommandExecutionStatus status, int completedChildren) {
    ExtendCinderDiskCommand<VmDiskOperationParameterBase> extendCinderDiskCommand = (ExtendCinderDiskCommand<VmDiskOperationParameterBase>) command;
    ImageStatus imageStatus = extendCinderDiskCommand.getCinderBroker().getDiskStatus(getDiskId(extendCinderDiskCommand));
    if (imageStatus != null && imageStatus != getDisk(extendCinderDiskCommand).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) VmDiskOperationParameterBase(org.ovirt.engine.core.common.action.VmDiskOperationParameterBase)

Aggregations

ImageStatus (org.ovirt.engine.core.common.businessentities.storage.ImageStatus)8 DiskImage (org.ovirt.engine.core.common.businessentities.storage.DiskImage)6 CinderDisk (org.ovirt.engine.core.common.businessentities.storage.CinderDisk)3 Guid (org.ovirt.engine.core.compat.Guid)3 HorizontalPanel (com.google.gwt.user.client.ui.HorizontalPanel)2 Image (com.google.gwt.user.client.ui.Image)2 TreeItem (com.google.gwt.user.client.ui.TreeItem)2 ImagesContainterParametersBase (org.ovirt.engine.core.common.action.ImagesContainterParametersBase)2 DiskInterface (org.ovirt.engine.core.common.businessentities.storage.DiskInterface)2 DiskStorageType (org.ovirt.engine.core.common.businessentities.storage.DiskStorageType)2 VolumeType (org.ovirt.engine.core.common.businessentities.storage.VolumeType)2 StringValueLabel (org.ovirt.engine.ui.common.widget.label.StringValueLabel)2 DateLabel (com.google.gwt.user.client.ui.DateLabel)1 BaseImagesCommand (org.ovirt.engine.core.bll.storage.disk.image.BaseImagesCommand)1 AddDiskParameters (org.ovirt.engine.core.common.action.AddDiskParameters)1 CreateCinderSnapshotParameters (org.ovirt.engine.core.common.action.CreateCinderSnapshotParameters)1 RemoveCinderDiskVolumeParameters (org.ovirt.engine.core.common.action.RemoveCinderDiskVolumeParameters)1 VmDiskOperationParameterBase (org.ovirt.engine.core.common.action.VmDiskOperationParameterBase)1 DiskVmElement (org.ovirt.engine.core.common.businessentities.storage.DiskVmElement)1 FullDateTimeLabel (org.ovirt.engine.ui.webadmin.widget.label.FullDateTimeLabel)1