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;
}
}
}
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;
}
}
}
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;
}
}
}
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;
}
}
}
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;
}
}
}
Aggregations