OpenStack4j review
Shmulik Willinger
Leading Architects and Engineers Group | Active R&D Leader | Hands-on AI-Driven engineer
Openstack provides the foundation for the NFV (Network Functions Virtualization) architecture in the area of orchestrating and managing VNF (Virtual Network Functions) and NFV (Network Functions Virtualization) and as such, it is widely used in the telecommunications industry.
In order to work with the OpenStack controller we can use Horizon, which is the openstack dashboard (Client service on port 5000), or to use the controller CLI. Another option is to use a 3rd party library like Apache jclouds or openstack4j.
Openstack4J is an open source java library which allows provisioning and control of the OpenStack system. The project divided into different APIs – one for each Openstack service, but the package jar contains them all.
Openstack4j is sponsored by Rackspace company, and it being used by private people and by big companies like IBM, Oracle and SAP (according to their site).
The graph below presents the number of commits to the project:
Openstack4J is easy to use, and has lots of documentation and troubleshooting that can be found on the net, BUT in terms of deeper technological work with openstack API – openstack4j does not provide so much, and can causes us to make workarounds (In the best case) or to find different solutions.
Some of the cases I encountered, where Openstack4J has problems or don't support at all:
1. By default, OpenStack4j uses Jersey2 in order to connect with Openstack, and we can change the connector to another one like Resteasy, Apache HttpClient, OKHttp etc. (for example -we need another connector in case of collision between versions of inside jars dependencies).
In order to change the connector we need to
- Change the openstack4j entry to openstack4j-core
- Add the new connector entry
But by doing it- we will experience other issues like lack of console printing, since Jersey2 is the only connector that prints ALL the traffic of the requests and response from Horizon (in case we added the flag enableHttpLoggingFilter(true) in the OSFactory authorization class, which is parallel to the data we gets when adding '—debug' in the CLI command)
Example for changing the openstack4j connector in Maven and Gradle:
(more info about changing the connector can be found here)
2. NFV emphasizes the topic of automation, and in case the VNF needs to be configured at boot time – we can use scripts like bin/bash as a parameter from the CLI, or to use cloud-init which is a piece of software created to help with initializing virtual machines on multiple different cloud platforms.
Example of adding a cloud-init script to the Instance creation:
In Openstack4j there is no option to add a script to the Instance creation, and we need to take the content (bash script or cloud-init) and to convert it to Base64 (encoding schemes that encode binary data by treating it numerically and translating it into a base 64 representation) in order to add it to the API, which add hassle and makes the parameter unreadable and undebuggable (great word which means- cannot be debugged).
Base64 converter can be found on the net, or in the linux environment.
Example of an online converter for script content:
3. SR-IOV (Single Root I/O Virtualization) is a specification that allows a PCIe device to appear to be multiple separate physical PCIe devices by introducing the idea of physical functions (PFs) and virtual functions (VFs).
In order to support this feature – The new VNF (openstack instance) must be connected to PORTs directly, and not through the openstack networks.
In openstack NOVA service – we can define the PORT with SR-IOV support by adding the binding flag to the PORT while creating it, for example:
--"binding:vnic_type": "direct"
Openstack4J doesn't support this option, so we need to create PORTs by working directly with the Openstack NEUTRON service (port 9696), and to send the request with a token and with the binding parameters.
(more info about SR-IOV passthrough for Openstack networking can be found here)
4. Another example - In a couple of places I noticed that openstack4j doesn't support LISTs of objects which are default on openstack API.
For example: while creating new Instance in the Horizon dashboard we can select the list of networks we want to connect to (same for the CLI command):
openstack4j API support only one network at a time (see the API below) , so we need to maintain loops in order to add all the networks we want.
My conclusion – Openstack4j has a great API and good library to work with, but only for basic projects. If you are looking for more powerful and mature API for Deeper and complicated issues to work with Openstack – try working directly with the OpenStack Horizon or the CLI, 3rd party libraries Will not be enough.
Thanks for reading,
Shmulik Willinger
SVP Engineering, Chief Architect at DraftKings Inc.
9 年I like your posts, usually it's a nice summary, very clear and neat... good job.
Technical Product Manager
9 年Great summary Shmulik Willinger.