use of org.ovirt.engine.core.common.businessentities.storage.CinderDisk in project ovirt-engine by oVirt.
the class RemoveAllVmCinderDisksCommand method getCinderDisksToBeRemoved.
private List<CinderDisk> getCinderDisksToBeRemoved() {
List<CinderDisk> imageDisks = getParameters().cinderDisks;
List<CinderDisk> cinderDisks = new ArrayList<>();
if (imageDisks == null) {
cinderDisks = DisksFilter.filterCinderDisks(diskDao.getAllForVm(getVmId()));
} else {
for (DiskImage diskImage : imageDisks) {
cinderDisks.add((CinderDisk) diskImage);
}
}
return cinderDisks;
}
use of org.ovirt.engine.core.common.businessentities.storage.CinderDisk in project ovirt-engine by oVirt.
the class RemoveAllVmCinderDisksCommand method executeVmCommand.
@Override
protected void executeVmCommand() {
Collection<CinderDisk> failedRemoving = new LinkedList<>();
for (final CinderDisk cinderDisk : getCinderDisksToBeRemoved()) {
if (Boolean.TRUE.equals(cinderDisk.getActive())) {
ActionReturnValue actionReturnValuernValue = removeCinderDisk(cinderDisk);
if (actionReturnValuernValue == null || !actionReturnValuernValue.getSucceeded()) {
failedRemoving.add(cinderDisk);
logRemoveCinderDiskError(cinderDisk, actionReturnValuernValue);
}
}
}
setActionReturnValue(failedRemoving);
persistCommand(getParameters().getParentCommand(), true);
setSucceeded(true);
}
use of org.ovirt.engine.core.common.businessentities.storage.CinderDisk in project ovirt-engine by oVirt.
the class RemoveCinderDiskVolumeCommand method endWithFailure.
@Override
protected void endWithFailure() {
super.endWithFailure();
CinderDisk cinderVolume = getParameters().getRemovedVolume();
log.error("Could not remove Cinder volume id '{}' of disk id '{}'.", cinderVolume.getImageId(), cinderVolume.getId());
}
use of org.ovirt.engine.core.common.businessentities.storage.CinderDisk in project ovirt-engine by oVirt.
the class RemoveCinderDiskVolumeCommand method executeCommand.
@Override
public void executeCommand() {
CinderDisk volumeToDelete = getParameters().getRemovedVolume();
if (!deleteVolumeFromCinder(volumeToDelete)) {
setCommandStatus(CommandStatus.FAILED);
}
persistCommand(getParameters().getParentCommand(), true);
setSucceeded(true);
}
use of org.ovirt.engine.core.common.businessentities.storage.CinderDisk in project ovirt-engine by oVirt.
the class UpdateVmDiskCommand method extendCinderDiskSize.
private void extendCinderDiskSize() {
lockImageInDb();
CinderDisk newCinderDisk = (CinderDisk) getNewDisk();
Future<ActionReturnValue> future = commandCoordinatorUtil.executeAsyncCommand(ActionType.ExtendCinderDisk, buildExtendCinderDiskParameters(newCinderDisk), cloneContextAndDetachFromParent());
addCustomValue("NewSize", String.valueOf(getNewDiskSizeInGB()));
try {
setReturnValue(future.get());
setSucceeded(getReturnValue().getSucceeded());
} catch (InterruptedException | ExecutionException e) {
log.error("Error extending Cinder disk '{}': {}", getNewDisk().getDiskAlias(), e.getMessage());
log.debug("Exception", e);
}
}
Aggregations