[ovirt-devel] Subject: Looking for advice regarding user portal development.

Alexander Wels awels at redhat.com
Fri Dec 11 22:07:43 UTC 2015


On Friday, December 11, 2015 09:38:16 PM Thomas Shaw wrote:
> Evening all,
> 
> I'm a student from the UK, currently studying Bsc (Hons) Computer Forensics
> & Security, looking for a bit of advice regarding front-end development for
> the oVirt user portal. For my final year project I’m going to be extending
> the current user portal to produce a user interface that fits the needs of
> Computer Security education.
> 
> I want to create an interface that supports the workflow of a tutor
> configuring one to many virtual machines / networks for a scenario based
> lab session. The project will involve developing two different interfaces
> depending on whether a student or tutor is logged in.
> 
> The project is going to be based on a paper that was presented in the UK at
> the first Cybersecurity Education and Training conference as part of the
> Vibrant Workshop, and is available in full here:
> http://z.cliffe.schreuders.org/publications/VibrantWorkshop2015%20-%20An%20o
> pen%20cloud-based%20virtual%20lab%20environment%20for%20computer%20security%
> 20education:%20%20A%20pilot%20study%20evaluation%20of%20oVirt.pdf
> 
> The tutor portal will have an avenue for tutors to upload images and a way
> to group templates of virtual machines for students to clone. The student
> portal will have one webpage with a list of their owned VMs on the left,
> like the current user portal, and all lab VM templates on the right
> organised/grouped by lab. Students will be able to clone a VM or group of
> VM's from the right with a couple of clicks at most.
> 
> I'm planning on forking the user-portal code and making changes here. I
> want a different interface to appear for the students and the tutors.
> Initial thoughts were to do this based on the 'Role' concept within oVirt -
> I plan on creating 2 new user group’s with predefined roles, Student and
> Tutor, and having the tutor-only functionality appear on an additional tab
> which only appears if the logged in user has the Tutor role.
> 
> We have a powerful development server at university which is currently
> running oVirt 3.6 with 3 nodes. As of right now I've set up the engine
> development environment on Fedora 23. I'm still getting familiar with the
> code and build process and have not yet deployed a build to the server.
> 
> It is my hope and intention that any work I produce will be of value to the
> greater community and will open source all work.  I would really appreciate
> any input / advice in developing for the user portal and hope to produce
> something make my code changes more likely to be accepted upstream.
> 
> Thanks for reading,
> Thomas Shaw

Thomas,

Welcome to oVirt. Here is some background and options in regards to the User 
Portal. The User Portal is written in GWT which is a Java to Javascript 
compiler that takes Java code and turns it into Javascript. It also abstracts 
away a bunch of browser specific issues so you don't have to deal with them. It 
provides a bunch of widgets so you can build applications in swing like 
fashion. So its easy to pick up if you have some experience with swing.

On the other hand there is some cost to this, and one of the main problems 
with GWT is that the compiler takes a long time to do the translation from 
Java to Javascript. In fact it creates permutations for each browser locale 
combination, which can add up really quick. For instance if you support 5 
browsers (ie8, ie9, ie10+, safari(chrome), FF) and 6 locales, that creates 30 
permutations to compile. This can take a huge amount of time.

The current User Portal itself is not that big, so each permutation is 
relatively quick compared to the web admin which is a huge application. I know 
of a few other people that where not satisfied with the functionality of the 
User Portal and wrote their own. Either there was too much stuff or not enough 
for whatever they wanted to do.

Every single one of them decided to write a new User Portal from scratch using 
some standard Javascript framework (angular/ember/whatever). Using the 
available REST api. The engine provides an api that allows one to do basically 
anything that the User Portal and Web Admin can do. There are also several 
SDKs available for working with the REST api in an easy fashion 
(Java/Python/Javascript [1]). 

Seeing the above you have some options to implement what you want:

1. If you want to make changes to the User Portal that is possible, but in the 
end if your code doesn't end up in the product, it will be a maintenance 
nightmare keeping up with the changes. Seeing as the User portal is fairly 
generic and you are solving a specific problem it is not very likely to be 
merged into the product.

2. Make a new web frontend portal using Javascript and use the Javascript SDK 
to call the REST api to do whatever you need it to do. Note as far as I know 
there is currently no way to upload templates with either the User Portal or 
the REST api. So you will have to find some other mechanism to get them into 
the system. And when I say templates I mean VM templates in the oVirt sense. 
You will be communicating with a stable interface (REST api). 

3. Build your own web application, and have your backend use either the Python 
or Java SDK to make calls to the oVirt REST api. Then you can have your 
backend application be completely independent of oVirt and only interface 
using a stable API. Again you will have to find some mechanism of getting your 
templates into oVirt.

TL;DR
Don't extend the User Portal use the REST api to do what you need to do and 
determine which SDK works the best for your needs.

Alexander

[1] Not yet merged but very usable https://gerrit.ovirt.org/#/c/49466/




More information about the Devel mailing list