[Users] [Engine-devel] adding scripts

Vojtech Szocs vszocs at redhat.com
Fri Mar 21 15:43:35 UTC 2014



----- Original Message -----
> From: "Alexander Wels" <awels at redhat.com>
> To: "aditya mamidwar" <aditya.mamidwar at gmail.com>
> Cc: engine-devel at ovirt.org, users at ovirt.org
> Sent: Friday, March 21, 2014 1:49:22 PM
> Subject: Re: [Users] [Engine-devel]  adding scripts
> 
> On Friday, March 21, 2014 03:44:01 PM aditya mamidwar wrote:
> > Hey,
> > my team is working on adding AoE protocol support to ovirt.
> > 
> > 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.
> 
> When you say ovirt portal I am assuming you mean the web admin as giving
> users
> access to low level stuff like that in the user portal would probably be a
> bad
> thing.
> 
> As said in a couple of other responses the best way to do that in webadmin is
> probably writing a UI plugin. A full explanation of what you can do with a UI
> plugin is available here: http://www.ovirt.org/Features/UIPlugins
> 
> In short a UI plugin is a mini application written in Javascript that hooks
> into the main web admin UI. The UI infrastructure makes certain element of
> the
> UI available to the plugin. One of the things it can do is to allow you to
> add
> buttons to the UI. When those buttons are clicked whatever javascript handler
> you assigned to it will execute.
> 
> This gives you a couple of options:
> 1. Write your own web application that can take commands from buttons inside
> the web admin interface. Since the ovirt engine runs on JBOSS I would suggest
> you write your own web application in Java that executes the appropriate bash
> commands based on which button is pressed using the UI plugin.
> 2. Write a minimal plugin that makes use of the REST API and add code to call
> your bash scripts from the REST api.

Some more options (already mentioned on users list):

3. UI plugin requesting URL mapped to Apache CGI/Bash script (assuming WebAdmin is accessed through Apache which forwards request to Engine JBoss server)

4. run your own HTTP server, enable Cross-Origin Resource Sharing for requests coming from Engine origin, have UI plugin call this custom server via HTTP

It is entirely up to UI plugin developers if/how the plugin should communicate with servers.

> 
> > 
> > 2. for ISOs to be available, i need to enable hosts configured in clusters
> > and storage domains of ATA type. (currently NFS, iSCSI and FC are done).
> > which files should i focus on changing for above functionality.
> > 
> 
> Honestly I don't know enough about the storage infrastructure to give you a
> good answer to that. Maybe someone else can fill this in.
> 
> > 3. How do i change the custom layout of the engine? (like adding a few
> > extra buttons.) please specify the files responsible.
> > 
> 
> Look at the UI plugins, the page linked above explains their usage in great
> detail as well as give a bunch of examples on how to achieve this.
> 
> > 4. the above questions stress that am facing difficulty in identifying
> > files responsible for a particular module. is there a better way to do that
> > instead of digging up the entire source code. ( a documentation if
> > available.)
> > 
> 
> This gives a nice overview of the architecture of oVirt:
> http://www.ovirt.org/Architecture
> 
> The source code associated with that is basically split out into two GIT
> repositories.
> 1. For the frontend and the engine, which is all java code.
> 2. For VDSM which is all python.
> 
> The user portal and web admin communicate with the engine using GWT-RPC and
> soon the REST api. Then the engine communicates with VDSM using XML-RPC.

Right, REST API in UI is coming soon. We're planning to provide JavaScript SDK to work with Engine REST API, so UI plugins (or any other web applications) can integrate easily with oVirt Engine.

> 
> The engine runs on one machine (either dedicated or as its own VM on one of
> your hosts). Then VDSM runs on the hosts. The hosts are the ones that
> communicate with the storage. So I am guessing your bash code will run on a
> host?
> 
> So in short, I think this is what you want?
> 1. Write UI plugin to add the buttons/etc to the webadmin.
> 2. Write your own web app, or hook into the REST API and add the commands to
> execute whatever it is you are doing.
> 3. (Maybe?) Modify VDSM to accept the commands from the REST API or your web
> application, and execute your scripts using VDSM based on the commands.
> 
> Alexander
> 
> > On Mon, Mar 17, 2014 at 5:52 PM, Alexander Wels <awels at redhat.com> wrote:
> > > Aditya,
> > > 
> > > That is because that file doesn't exist. We map that name to a servlet in
> > > web.xml. If you want to modify the GWT host page take a look at
> > > GwtDynamicHostPageServlet.java and its sub classes (for user portal and
> > > webadmin). As well as GwtHostPage.jsp. You will find there is almost
> > > nothing in
> > > that page as all the HTML is being generated at runtime using GWT.
> > > 
> > > Since you are not really explaining what you are trying to do we can't
> > > help
> > > you better on the best strategy to achieve what you want.
> > > 
> > > Alexander
> > > 
> > > On Saturday, March 15, 2014 06:00:21 PM Aditya Mamidwar wrote:
> > > > Hey thanks on the previous issue.
> > > > Also is there a way i can access WebAdmin.Html to add custom buttons
> > > > and
> > > > make few tweaks for personal use? I just cant find that file after
> > > > using
> > > > git.
> > > > 
> > > > Aditya Mamidwar
> > > > 
> > > > -----Original Message-----
> > > > From: "Einav Cohen" <ecohen at redhat.com>
> > > > Sent: 14-03-2014 01:21
> > > > To: "aditya mamidwar" <aditya.mamidwar at gmail.com>; "Vojtech Szocs"
> > > > <vszocs at redhat.com> Cc: "users at ovirt.org" <users at ovirt.org>;
> > > > "engine-devel at ovirt.org" <engine-devel at ovirt.org> Subject: Re: [Users]
> > > > adding scripts
> > > > 
> > > > if you are trying to hook into UI-specific events, it sounds
> > > > like you will need to write an oVirt UI Plugin [1] in order to
> > > > do that. However, I believe that the oVirt UI Plugins
> > > > infrastructure doesn't support hooking to events such as "tab
> > > > x was selected" and/or "button b was clicked".
> > > > It does allow you to add new (custom) tabs/sub-tabs/buttons of
> > > > your own, and there is a chance that it allows you to hook
> > > > into events such as 'row x was selected in the grid'.
> > > > 
> > > > @Vojtech will know better. Vojtech?
> > > > 
> > > > if you are trying to hook into engine events (e.g. you want to
> > > > run a script every time a VM is started in oVirt, no matter if
> > > > the user started it by clicking the 'run' button in the oVirt-
> > > > engine webadmin, or invoked a REST API request, or an SDK
> > > > command), then it will require some sort of an "engine-plugin"
> > > > infrastructure that we don't have at the moment AFAIK.
> > > > there is a chance that for some of the events you will be able
> > > > to utilize the VDSM hooks (at the Host level) [2].
> > > > 
> > > > ----
> > > > Thanks,
> > > > Einav
> > > > 
> > > > [1] http://www.ovirt.org/Features/UIPlugins
> > > > 
> > > > [2] http://www.ovirt.org/VDSM-Hooks
> > > > 
> > > > 
> > > > ----- Original Message -----
> > > > 
> > > > > From: "aditya mamidwar" <aditya.mamidwar at gmail.com>
> > > > > To: users at ovirt.org, engine-devel at ovirt.org
> > > > > Sent: Thursday, March 13, 2014 11:23:35 AM
> > > > > Subject: [Users] adding scripts
> > > > > 
> > > > > 
> > > > > I want to commit changes to the engine by adding some bash scripts.
> > > > > the scripts should be invoked once a button or tab is selected in the
> > > > > webadmin portal by the user.
> > > > > 
> > > > > can someone guide on achieving this.
> > > > > 
> > > > > --
> > > > > -Aditya Mamidwar
> > > > > 
> > > > > _______________________________________________
> > > > > Users mailing list
> > > > > Users at ovirt.org
> > > > > http://lists.ovirt.org/mailman/listinfo/users
> 
> _______________________________________________
> Users mailing list
> Users at ovirt.org
> http://lists.ovirt.org/mailman/listinfo/users
> 



More information about the Users mailing list