use of org.onap.aai.domain.yang.Volume in project so by onap.
the class HeatBridgeImpl method createVolume.
protected void createVolume(Resource r) {
org.openstack4j.model.storage.block.Volume osVolume = osClient.getVolumeById(r.getPhysicalResourceId());
List<? extends VolumeAttachment> attachments = osVolume.getAttachments();
if (attachments != null) {
Optional<? extends VolumeAttachment> vserver = attachments.stream().findFirst();
if (vserver.isPresent()) {
Volume volume = new Volume();
volume.setVolumeId(r.getPhysicalResourceId());
AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(cloudOwner, cloudRegionId).tenant(tenantId).vserver(vserver.get().getServerId()).volume(r.getPhysicalResourceId()));
transaction.createIfNotExists(uri, Optional.of(volume));
} else {
logger.warn("Volume {} contains no attachments in openstack. Unable to determine which vserver volume belongs too.", r.getPhysicalResourceId());
}
} else {
logger.warn("Volume {} contains no attachments in openstack. Unable to determine which vserver volume belongs too.", r.getPhysicalResourceId());
}
}
Aggregations