[Users] adding scripts
Vojtech Szocs
vszocs at redhat.com
Fri Mar 21 15:24:00 UTC 2014
----- Original Message -----
> From: "R P Herrold" <herrold at owlriver.com>
> To: "oVirt Users ML" <users at ovirt.org>
> Cc: "aditya mamidwar" <aditya.mamidwar at gmail.com>
> Sent: Friday, March 21, 2014 3:43:27 PM
> Subject: [Users] adding scripts
>
>
> the threading is not clear to me, and I hope I have the
> attributions correct
>
> On Fri, 21 Mar 2014, Greg Sheremeta wrote:
>
> >> From: "aditya mamidwar" <aditya.mamidwar at gmail.com>
>
> >> To: awels at redhat.com, engine-devel at ovirt.org, users at ovirt.org
> >> Sent: Friday, March 21, 2014 6:14:01 AM
> >> Subject: Re: [Users] [Engine-devel] adding scripts
>
> >> am thus facing following difficulties:
>
> >> 1 : i wrote the required code using in bash scripting,
> >> which i wish to invoke after a click of button in the
> >> ovirt-portal. (which does not seem to be possible). can you
> >> help on that? which programming language should i use, and
> >> how that file should be invoked.
>
> [I think Greg said:]
>
> > This needs to be done in Java. You'll need to read up on
> > oVirt's UI Plugin infrastructure, which Einav and others
> > mentioned below. No, you cannot write a bash script and have
> > a button click in oVirt invoke that.
>
> Reading this:
> http://www.ovirt.org/VDSM-Hooks
> it states as a pull quote:
>
> The hooks reside on every host in
> /usr/libexec/vdsm/hooks/ A hook can be any executable
> (bash/python/perl/binary/etc).
>
> and then at:
> http://www.ovirt.org/Features/UIPlugins
>
> UI plugins integrate with WebAdmin directly on the
> client (web browser) using JavaScript programming language.
> Plugin invocation is driven by WebAdmin and happens right
> within the context of browser's JavaScript runtime, using
> JavaScript language as the lowest common denominator between
> WebAdmin (GWT) and individual plugins. UI plugins can take
> full advantage of JavaScript language and its rich ecosystem
> of libraries. There are no specific rules on how to implement
> UI plugins, plugin API is designed to be simple and not to get
> in developer's way, regardless of how a developer chooses to
> write the plugin
>
> ============
>
> I thought I understood the model, but have gotten confused.
> Iam left with two questions:
>
> 1. is the plugin to be Java or JavaScript? (I think the answer
> is the latter)
Right, UI plugins are written in JavaScript as their code is dynamically loaded during WebAdmin startup.
Your UI plugin is technically a web application on its own, except that plugin host page [1] is rendered inside invisible <iframe> element.
[1] plugin host page = HTML page responsible for loading actual UI plugin code (no markup, just logic)
UI plugin code can make HTTP requests just like any other web application. This is how you would invoke operations on remote servers.
The easiest way (I think) is to add custom CGI/Bash script into Apache which sits in front of Engine (JBoss AS) server in a typicall oVirt deployment. Your UI plugin would simply hit URL mapped to custom CGI/Bash script, which would execute whatever command is necessary.
Alternatively, you could deploy custom Java web application (*.war) inside Engine Java deployment (engine.ear) so that it co-exists with existing Engine web applications (REST API, WebAdmin, UserPortal, etc).
Finally, a totally custom alternative, run your own HTTP server, enable CORS [2] for requests from Engine origin, and have your UI plugin talk to this custom server.
[2] http://en.wikipedia.org/wiki/Cross-origin_resource_sharing
>
> 2. is there a constraint as to implementation language, or
> not. I think a JS wrapper can call whatever it wishes, but
> this is not clear to me
Correct, UI plugin itself is JavaScript, it makes no assumptions of server-side technology.
It is up to UI plugin developer to decide if/how the plugin should communicate with remote servers (Engine REST API, call Apache CGI, call custom server, etc).
>
> Thank you
>
> -- Russ herrold
> _______________________________________________
> Users mailing list
> Users at ovirt.org
> http://lists.ovirt.org/mailman/listinfo/users
>
More information about the Users
mailing list