use of org.ovirt.engine.core.common.businessentities.storage.StorageType in project ovirt-engine by oVirt.
the class ImportVmCommand method addVmExternalLuns.
protected void addVmExternalLuns() {
if (getParameters().getVm().getDiskMap() != null) {
List<LunDisk> lunDisks = DisksFilter.filterLunDisks(getParameters().getVm().getDiskMap().values());
for (LunDisk lun : lunDisks) {
StorageType storageType = StorageType.UNKNOWN;
if (lun.getLun().getLunConnections() != null && !lun.getLun().getLunConnections().isEmpty()) {
// We set the storage type based on the first connection since connections should be with the same
// storage type
storageType = lun.getLun().getLunConnections().get(0).getStorageType();
}
lunHelper.proceedDirectLUNInDb(lun.getLun(), storageType);
// Only if the LUN disk does not exists in the setup add it.
if (baseDiskDao.get(lun.getId()) == null) {
baseDiskDao.save(lun);
}
if (diskLunMapDao.get(new DiskLunMapId(lun.getId(), lun.getLun().getLUNId())) == null) {
diskLunMapDao.save(new DiskLunMap(lun.getId(), lun.getLun().getLUNId()));
}
// Add disk VM element to attach the disk to the VM.
DiskVmElement diskVmElement = lun.getDiskVmElementForVm(getVmId());
diskVmElementDao.save(diskVmElement);
getVmDeviceUtils().addDiskDevice(getVmId(), lun.getId(), diskVmElement.isPlugged(), diskVmElement.isReadOnly());
}
}
}
use of org.ovirt.engine.core.common.businessentities.storage.StorageType in project ovirt-engine by oVirt.
the class ConnectHostToStoragePoolServersCommand method connectStorageServer.
private boolean connectStorageServer(Map<StorageType, List<StorageServerConnections>> connectionsByType) {
boolean connectSucceeded = true;
for (Map.Entry<StorageType, List<StorageServerConnections>> connectionToType : connectionsByType.entrySet()) {
StorageType connectionsType = connectionToType.getKey();
List<StorageServerConnections> connections = connectionToType.getValue();
connectSucceeded = connectStorageServersByType(connectionsType, connections) && connectSucceeded;
}
if (cinderStorageHelper.isActiveCinderDomainAvailable(getStoragePool().getId())) {
connectSucceeded &= cinderStorageHelper.prepareConnectHostToStoragePoolServers(getContext(), getParameters(), null);
}
log.info("Host '{}' storage connection was {} ", getVds().getName(), connectSucceeded ? "succeeded" : "failed");
return connectSucceeded;
}
use of org.ovirt.engine.core.common.businessentities.storage.StorageType in project ovirt-engine by oVirt.
the class StorageDomainValidatorFreeSpaceTest method createParams.
@Parameterized.Parameters
public static Collection<Object[]> createParams() {
List<Object[]> params = new ArrayList<>();
for (StorageType storageType : StorageType.values()) {
if (storageType.isConcreteStorageType() && !storageType.isCinderDomain()) {
List<VolumeType> volumeTypes = storageType.isFileDomain() ? Arrays.asList(VolumeType.Preallocated, VolumeType.Sparse) : Collections.singletonList(VolumeType.Preallocated);
for (VolumeType volumeType : volumeTypes) {
for (VolumeFormat volumeFormat : new VolumeFormat[] { VolumeFormat.COW, VolumeFormat.RAW }) {
DiskImage disk = new DiskImage();
disk.setVolumeFormat(volumeFormat);
disk.setVolumeType(volumeType);
disk.getSnapshots().add(disk);
disk.setSizeInGigabytes(200);
// GB
disk.setActualSize(100);
StorageDomain sd = new StorageDomain();
sd.setStorageType(storageType);
// GB
sd.setAvailableDiskSize(107);
params.add(new Object[] { disk, sd, volumeFormat == VolumeFormat.RAW && volumeType == VolumeType.Sparse, volumeFormat == VolumeFormat.COW || volumeType == VolumeType.Sparse, volumeFormat == VolumeFormat.RAW && volumeType == VolumeType.Sparse });
}
}
}
}
return params;
}
use of org.ovirt.engine.core.common.businessentities.storage.StorageType in project ovirt-engine by oVirt.
the class AbstractDiskModel method volumeType_SelectedItemChanged.
protected void volumeType_SelectedItemChanged() {
if (getVolumeType().getSelectedItem() == null || getDataCenter().getSelectedItem() == null || getStorageDomain().getSelectedItem() == null) {
return;
}
VolumeType volumeType = getVolumeType().getSelectedItem();
StorageType storageType = getStorageDomain().getSelectedItem().getStorageType();
updateShareable(volumeType, storageType);
}
use of org.ovirt.engine.core.common.businessentities.storage.StorageType in project ovirt-engine by oVirt.
the class StorageModel method updateCurrentStorageItem.
public void updateCurrentStorageItem() {
StorageDomainType storageDomainType = getAvailableStorageDomainTypeItems().getSelectedItem();
StorageType storageType = getAvailableStorageTypeItems().getSelectedItem();
getStorageModels().stream().filter(model -> model.getType() == storageType && model.getRole() == storageDomainType).findFirst().ifPresent(this::setCurrentStorageItem);
}
Aggregations