use of org.ovirt.engine.core.common.businessentities.storage.CinderVolumeType in project ovirt-engine by oVirt.
the class BackendOpenStackVolumeTypeResourceTest method getEntity.
@Override
protected CinderVolumeType getEntity(int index) {
CinderVolumeType cinderVolumeType = mock(CinderVolumeType.class);
when(cinderVolumeType.getId()).thenReturn(GUIDS[index].toString());
when(cinderVolumeType.getName()).thenReturn(NAMES[index]);
return cinderVolumeType;
}
use of org.ovirt.engine.core.common.businessentities.storage.CinderVolumeType in project ovirt-engine by oVirt.
the class BackendOpenStackVolumeTypesResourceTest method getEntity.
@Override
protected CinderVolumeType getEntity(int index) {
CinderVolumeType cinderVolumeType = mock(CinderVolumeType.class);
when(cinderVolumeType.getId()).thenReturn(GUIDS[index].toString());
when(cinderVolumeType.getName()).thenReturn(NAMES[index]);
return cinderVolumeType;
}
use of org.ovirt.engine.core.common.businessentities.storage.CinderVolumeType in project ovirt-engine by oVirt.
the class BackendOpenStackVolumeTypeResource method get.
@Override
public OpenStackVolumeType get() {
Guid storageDomainId = BackendOpenStackStorageProviderHelper.getStorageDomainId(this, providerId);
IdQueryParameters parameters = new IdQueryParameters(storageDomainId);
List<CinderVolumeType> volumeTypes = getBackendCollection(CinderVolumeType.class, QueryType.GetCinderVolumeTypesByStorageDomainId, parameters);
return volumeTypes.stream().filter(v -> v.getId().equals(id)).findFirst().map(v -> addLinks(populate(map(v), v))).orElseGet(this::notFound);
}
use of org.ovirt.engine.core.common.businessentities.storage.CinderVolumeType in project ovirt-engine by oVirt.
the class CinderDisksValidator method validateCinderVolumeTypesExist.
/**
* Validates that the disk's volume type exists in Cinder
* (note that this method validates only against a single disk).
*/
public ValidationResult validateCinderVolumeTypesExist() {
return validate(() -> {
final CinderDisk disk = cinderDisks.iterator().next();
OpenStackVolumeProviderProxy proxy = diskProxyMap.get(disk.getId());
List<CinderVolumeType> volumeTypes = proxy.getVolumeTypes();
boolean volumeTypeExists = volumeTypes.stream().anyMatch(v -> v.getName().equals(disk.getCinderVolumeType()));
if (!volumeTypeExists) {
return new ValidationResult(EngineMessage.CINDER_VOLUME_TYPE_NOT_EXISTS, String.format("$cinderVolumeType %s", disk.getCinderVolumeType()));
}
return ValidationResult.VALID;
});
}
use of org.ovirt.engine.core.common.businessentities.storage.CinderVolumeType in project ovirt-engine by oVirt.
the class OpenStackVolumeProviderProxy method getVolumeTypes.
public List<CinderVolumeType> getVolumeTypes() {
ArrayList<CinderVolumeType> cinderVolumeTypes = new ArrayList<>();
OpenStackRequest<VolumeTypes> listRequest = getClient(getTenantId()).volumeTypes().list();
VolumeTypes volumeTypes = listRequest.execute();
for (VolumeType volumeType : volumeTypes) {
CinderVolumeType cinderVolumeType = new CinderVolumeType(volumeType.getId(), volumeType.getName(), volumeType.getExtraSpecs());
cinderVolumeTypes.add(cinderVolumeType);
}
return cinderVolumeTypes;
}
Aggregations