use of org.ovirt.engine.core.common.businessentities.storage.CinderDisk in project ovirt-engine by oVirt.
the class VmModelBehaviorBase method initStorageDomainsForCinderDisks.
private void initStorageDomainsForCinderDisks(List<DiskModel> cinderDisks, Collection<StorageDomain> cinderStorageDomains) {
for (DiskModel diskModel : cinderDisks) {
CinderDisk cinderDisk = (CinderDisk) diskModel.getDisk();
diskModel.getStorageDomain().setItems(Linq.filterStorageDomainById(cinderStorageDomains, cinderDisk.getStorageIds().get(0)));
diskModel.getStorageDomain().setIsChangeable(false);
diskModel.getDiskProfile().setIsChangeable(false);
diskModel.getDiskProfile().setChangeProhibitionReason(ConstantsManager.getInstance().getConstants().notSupportedForCinderDisks());
}
}
use of org.ovirt.engine.core.common.businessentities.storage.CinderDisk in project ovirt-engine by oVirt.
the class AbstractDiskModel method flush.
public void flush() {
switch(getDiskStorageType().getEntity()) {
case LUN:
LunDisk lunDisk = getLunDisk();
DiskInterface diskInterface = getDiskInterface().getSelectedItem();
if (DiskInterface.VirtIO_SCSI.equals(diskInterface)) {
lunDisk.setSgio(!getIsScsiPassthrough().getEntity() ? null : getIsSgIoUnfiltered().getEntity() ? ScsiGenericIO.UNFILTERED : ScsiGenericIO.FILTERED);
if (!getIsFloating()) {
getDiskVmElement().setUsingScsiReservation(getIsUsingScsiReservation().getEntity());
}
} else {
getIsScsiPassthrough().setEntity(false);
lunDisk.setSgio(null);
if (!getIsFloating()) {
getDiskVmElement().setUsingScsiReservation(false);
}
}
setDisk(lunDisk);
break;
case CINDER:
CinderDisk cinderDisk = getCinderDisk();
updateQuota(cinderDisk);
updateDiskSize(cinderDisk);
setDisk(cinderDisk);
break;
case IMAGE:
DiskImage diskImage = getDiskImage();
// For a long time it was possible to delete all disk profiles
if (getDiskProfile().getSelectedItem() != null) {
diskImage.setDiskProfileId(getDiskProfile().getSelectedItem().getId());
}
updateQuota(diskImage);
updateDiskSize(diskImage);
setDisk(diskImage);
break;
}
getDisk().setDiskAlias(getAlias().getEntity());
getDisk().setDiskDescription(getDescription().getEntity());
getDisk().setWipeAfterDelete(getIsWipeAfterDelete().getEntity());
getDisk().setShareable(getIsShareable().getEntity());
getDisk().setPlugged(getIsPlugged().getEntity());
getDisk().setPropagateErrors(PropagateErrors.Off);
if (getVm() != null) {
getDiskVmElement().setReadOnly(getIsReadOnly().getIsAvailable() ? getIsReadOnly().getEntity() : false);
getDiskVmElement().setBoot(getIsBootable().getEntity());
getDiskVmElement().setDiskInterface(getDiskInterface().getSelectedItem());
getDiskVmElement().setPassDiscard(getPassDiscard().getEntity());
}
}
use of org.ovirt.engine.core.common.businessentities.storage.CinderDisk in project ovirt-engine by oVirt.
the class EditDiskModel method initialize.
@Override
public void initialize() {
super.initialize();
setDiskVmElement(getDisk().getDiskVmElementForVm(getVm().getId()));
disableNonChangeableEntities();
getAlias().setEntity(getDisk().getDiskAlias());
getDescription().setEntity(getDisk().getDiskDescription());
getIsShareable().setEntity(getDisk().isShareable());
getIsWipeAfterDelete().setEntity(getDisk().isWipeAfterDelete());
getIsScsiPassthrough().setEntity(getDisk().isScsiPassthrough());
getIsSgIoUnfiltered().setEntity(getDisk().getSgio() == ScsiGenericIO.UNFILTERED);
getIsReadOnly().setEntity(getDiskVmElement().isReadOnly());
getIsBootable().setEntity(getDiskVmElement().isBoot());
getPassDiscard().setEntity(getDiskVmElement().isPassDiscard());
switch(getDisk().getDiskStorageType()) {
case IMAGE:
DiskImage diskImage = (DiskImage) getDisk();
getDiskStorageType().setEntity(DiskStorageType.IMAGE);
getSize().setEntity((int) diskImage.getSizeInGigabytes());
getVolumeType().setSelectedItem(diskImage.getVolumeType());
boolean isExtendImageSizeEnabled = getVm() != null && !diskImage.isDiskSnapshot() && ActionUtils.canExecute(Arrays.asList(getVm()), VM.class, ActionType.ExtendImageSize);
getSizeExtend().setIsChangeable(isExtendImageSizeEnabled);
break;
case LUN:
LunDisk lunDisk = (LunDisk) getDisk();
getDiskStorageType().setEntity(DiskStorageType.LUN);
getStorageType().setIsAvailable(false);
getSize().setEntity(lunDisk.getLun().getDeviceSize());
getSizeExtend().setIsAvailable(false);
getIsUsingScsiReservation().setEntity(getDiskVmElement().isUsingScsiReservation());
break;
case CINDER:
CinderDisk cinderDisk = (CinderDisk) getDisk();
getDiskStorageType().setEntity(DiskStorageType.CINDER);
getSize().setEntity((int) cinderDisk.getSizeInGigabytes());
getSizeExtend().setIsChangeable(true);
break;
}
updateReadOnlyChangeability();
updatePassDiscardChangeability();
updateWipeAfterDeleteChangeability();
}
use of org.ovirt.engine.core.common.businessentities.storage.CinderDisk in project ovirt-engine by oVirt.
the class VmHandler method filterImageDisksForVM.
/**
* Filters the vm image disks/disk devices.<BR/>
* note: luns will be filtered, only active image disks will be return.
*/
public void filterImageDisksForVM(VM vm) {
List<DiskImage> filteredDisks = DisksFilter.filterImageDisks(vm.getDiskMap().values(), ONLY_ACTIVE);
List<CinderDisk> filteredCinderDisks = DisksFilter.filterCinderDisks(vm.getDiskMap().values());
filteredDisks.addAll(filteredCinderDisks);
@SuppressWarnings("unchecked") Collection<? extends Disk> vmDisksToRemove = CollectionUtils.subtract(vm.getDiskMap().values(), filteredDisks);
vm.clearDisks();
updateDisksForVm(vm, filteredDisks);
for (Disk diskToRemove : vmDisksToRemove) {
vm.getManagedVmDeviceMap().remove(diskToRemove.getId());
}
}
use of org.ovirt.engine.core.common.businessentities.storage.CinderDisk in project ovirt-engine by oVirt.
the class RemoveVmCommand method removeCinderDisks.
/**
* The following method will perform a removing of all cinder disks from vm. These is only DB operation
*/
private Collection<CinderDisk> removeCinderDisks() {
Collection<CinderDisk> failedRemoveCinderDisks = null;
if (getParameters().isRemoveDisks()) {
List<CinderDisk> cinderDisks = getCinderDisks();
if (cinderDisks.isEmpty()) {
return Collections.emptyList();
}
RemoveAllVmCinderDisksParameters param = new RemoveAllVmCinderDisksParameters(getVmId(), cinderDisks);
param.setEndProcedure(EndProcedure.COMMAND_MANAGED);
Future<ActionReturnValue> future = commandCoordinatorUtil.executeAsyncCommand(ActionType.RemoveAllVmCinderDisks, withRootCommandInfo(param), cloneContextAndDetachFromParent());
try {
failedRemoveCinderDisks = future.get().getActionReturnValue();
} catch (InterruptedException | ExecutionException e) {
failedRemoveCinderDisks = cinderDisks;
log.error("Exception", e);
}
}
return failedRemoveCinderDisks;
}
Aggregations