use of org.ovirt.engine.core.common.businessentities.storage.CinderDisk in project ovirt-engine by oVirt.
the class ExtendCinderDiskCommand method executeCommand.
@Override
public void executeCommand() {
CinderDisk cinderDisk = (CinderDisk) getNewDisk();
getCinderBroker().extendDisk(cinderDisk, (int) getNewDiskSizeInGB());
persistCommand(getParameters().getParentCommand(), true);
getReturnValue().setActionReturnValue(cinderDisk.getId());
setSucceeded(true);
}
use of org.ovirt.engine.core.common.businessentities.storage.CinderDisk in project ovirt-engine by oVirt.
the class GetUnregisteredCinderDiskByIdAndStorageDomainIdQuery method executeQueryCommand.
@Override
protected void executeQueryCommand() {
Disk diskFromDao = diskDao.get(getParameters().getEntityId());
if (diskFromDao != null) {
log.info("The disk already exist in the DB, hence, should not be fetched from Cinder. ID: '{}', Alias: '{}'", diskFromDao.getId(), diskFromDao.getDiskAlias());
getQueryReturnValue().setReturnValue(null);
return;
}
String volumeId = getParameters().getEntityId().toString();
Volume volume = getVolumeProviderProxy().getVolumeById(volumeId);
if (volume == null) {
log.info("The volume doesn't exist in Cinder. ID: '{}'", volumeId);
getQueryReturnValue().setReturnValue(null);
return;
}
Guid storageDomainId = getParameters().getId();
CinderDisk unregisteredDisk = CinderBroker.volumeToCinderDisk(volume, storageDomainId);
getQueryReturnValue().setReturnValue(unregisteredDisk);
}
use of org.ovirt.engine.core.common.businessentities.storage.CinderDisk in project ovirt-engine by oVirt.
the class GetUnregisteredCinderDisksByStorageDomainIdQuery method executeQueryCommand.
@Override
protected void executeQueryCommand() {
final List<Volume> allVolumes = getVolumeProviderProxy().getVolumes();
final List<Disk> registeredDisks = diskDao.getAllFromDisksByDiskStorageType(DiskStorageType.CINDER, getUserID(), getParameters().isFiltered());
Set<String> registeredIDs = registeredDisks.stream().map(d -> d.getId().toString()).collect(Collectors.toSet());
List<Volume> unregisteredVolumes = allVolumes.stream().filter(v -> !registeredIDs.contains(v.getId())).collect(Collectors.toList());
Guid storageDomainId = getParameters().getId();
List<CinderDisk> unregisteredDisks = CinderBroker.volumesToCinderDisks(unregisteredVolumes, storageDomainId);
getQueryReturnValue().setReturnValue(unregisteredDisks);
}
use of org.ovirt.engine.core.common.businessentities.storage.CinderDisk in project ovirt-engine by oVirt.
the class RemoveAllCinderSnapshotDisksCommand method executeVmCommand.
@Override
protected void executeVmCommand() {
List<CinderDisk> cinderDisks = getParameters().getCinderDisks();
for (final CinderDisk cinderDisk : cinderDisks) {
Future<ActionReturnValue> future = commandCoordinatorUtil.executeAsyncCommand(ActionType.RemoveCinderSnapshotDisk, getCinderDiskSnapshotParameter(cinderDisk), cloneContextAndDetachFromParent());
try {
ActionReturnValue actionReturnValue = future.get();
if (!actionReturnValue.getSucceeded()) {
log.error("Error removing snapshot for Cinder disk '{}'", cinderDisk.getDiskAlias());
}
} catch (InterruptedException | ExecutionException e) {
log.error("Error removing snapshot for Cinder disk '{}': {}", cinderDisk.getDiskAlias(), e.getMessage());
}
}
setSucceeded(true);
}
use of org.ovirt.engine.core.common.businessentities.storage.CinderDisk in project ovirt-engine by oVirt.
the class RemoveCinderDiskCommand method endWithFailure.
@Override
protected void endWithFailure() {
freeVmSnapshotsWithWait();
int removedVolumeIndex = getParameters().getRemovedVolumeIndex();
final CinderDisk cinderVolume = getParameters().getChildCommandsParameters().get(removedVolumeIndex).getRemovedVolume();
imageDao.updateStatusOfImagesByImageGroupId(getDisk().getId(), ImageStatus.ILLEGAL);
addCustomValue("imageId", cinderVolume.getImageId().toString());
auditLogDirector.log(this, AuditLogType.USER_FINISHED_FAILED_REMOVE_CINDER_DISK);
setSucceeded(true);
}
Aggregations