use of org.ovirt.engine.core.common.businessentities.storage.CinderDisk in project ovirt-engine by oVirt.
the class AddCinderDiskCommand method createCinderDisk.
private CinderDisk createCinderDisk() {
final CinderDisk cinderDisk = new CinderDisk();
cinderDisk.setDiskAlias(getDiskAlias());
cinderDisk.setSize(getParameters().getDiskInfo().getSize());
cinderDisk.setDiskAlias(getParameters().getDiskInfo().getDiskAlias());
cinderDisk.setDiskDescription(getParameters().getDiskInfo().getDiskDescription());
cinderDisk.setShareable(getParameters().getDiskInfo().isShareable());
cinderDisk.setStorageIds(new ArrayList<>(Arrays.asList(getParameters().getStorageDomainId())));
cinderDisk.setSize(getParameters().getDiskInfo().getSize());
cinderDisk.setVolumeType(VolumeType.Unassigned);
cinderDisk.setVolumeFormat(VolumeFormat.RAW);
cinderDisk.setCreationDate(new Date());
cinderDisk.setLastModified(new Date());
cinderDisk.setActive(true);
cinderDisk.setImageStatus(ImageStatus.LOCKED);
cinderDisk.setVmSnapshotId(getParameters().getVmSnapshotId());
cinderDisk.setCinderVolumeType(getParameters().getDiskInfo().getCinderVolumeType());
cinderDisk.setQuotaId(getParameters().getQuotaId());
if (getVm() != null) {
cinderDisk.setDiskVmElements(Collections.singletonList(getDiskVmElement()));
}
return cinderDisk;
}
use of org.ovirt.engine.core.common.businessentities.storage.CinderDisk in project ovirt-engine by oVirt.
the class AddCinderDiskCommand method executeCommand.
@Override
public void executeCommand() {
CinderDisk cinderDisk = createCinderDisk();
String volumeId = getCinderBroker().createDisk(cinderDisk);
Guid volumeGuid = Guid.createGuidFromString(volumeId);
cinderDisk.setId(volumeGuid);
cinderDisk.setImageId(volumeGuid);
getDiskVmElement().getId().setDeviceId(volumeGuid);
cinderDisk.setVolumeClassification(VolumeClassification.Volume);
addCinderDiskToDB(cinderDisk);
getParameters().setDiskInfo(cinderDisk);
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 RemoveCinderVolumeParentCommand method performNextOperation.
@Override
public boolean performNextOperation(int completedChildCount) {
CinderDisk cinderVolume = getParameters().getChildCommandsParameters().get(completedChildCount - 1).getRemovedVolume();
removeDiskFromDbCallBack(cinderVolume);
if (getParameters().getChildCommandsParameters().size() == completedChildCount) {
return false;
}
getParameters().setRemovedVolumeIndex(completedChildCount);
removeCinderVolume(completedChildCount);
return true;
}
use of org.ovirt.engine.core.common.businessentities.storage.CinderDisk in project ovirt-engine by oVirt.
the class RestoreAllCinderSnapshotsCommand method removeRedundantVolumesForOrphanedDisks.
private void removeRedundantVolumesForOrphanedDisks() {
List<CinderDisk> cinderVolumesToRemove = getParameters().getCinderVolumesToRemove();
for (CinderDisk cinderVolume : cinderVolumesToRemove) {
imageStorageDomainMapDao.remove(cinderVolume.getImageId());
imageDao.remove(cinderVolume.getImageId());
}
}
use of org.ovirt.engine.core.common.businessentities.storage.CinderDisk in project ovirt-engine by oVirt.
the class RestoreFromCinderSnapshotCommand method removeCinderVolume.
private void removeCinderVolume() {
CinderDisk cinderSnapshotToRemove = (CinderDisk) diskImageDao.getSnapshotById(getParameters().getImageId());
// Update the volume with active=false, so removeDiskFromDb will not set active volume on the first volume.
cinderSnapshotToRemove.setActive(false);
imageDao.update(cinderSnapshotToRemove.getImage());
removeDescendentSnapshots(cinderSnapshotToRemove);
removeCinderVolume(0);
}
Aggregations