OVirt

Background
oVirt project is a complete open sourced virtualization management platform working with kvm. More can be found here:

Additional information (including presentations) from a Workshop held early this November is available here:

The Project is made of an Engine core, which is the backend server. Every hypervisor should have a VDSM agent installed, which is the agent the core will use to manage that host. Additionally there's a client side UI (GWT based) and/or RESTful API.

Description
This article will try to explain how to install oVirt on Gentoo system using instructions from ovirt.org on how to build oVirt from source.

Important
This manual is what I did on my Gentoo server. If you have different install, which you probably do, you might not strictly do copy/paste and some additional steps might be necessary. I will specify every error I encountered and a solution to it at the end of the document. Feel free to add any problem not noted.

Setting default locale
If you didn't already, specify default locale for your server (as root):
 * Check /etc/locale.gen

Output (may be different) en_US ISO-8859-1 en_US.UTF-8 UTF-8 sr_RS UTF-8 sr_RS@latin UTF-8
 * Create /etc/env.d/02locale


 * Update environment for current shell (and every new shell you open) or simply reboot

Install vdsm

 * Install dev-python/pyflakes as it is needed by vdsm


 * Obtain VDSM source RPM


 * Convert rpm package to tgz


 * Unpack the archive


 * Enter the directory and do the configure-make-make install magic (Recommended to use –prefix when compiling from source so you can have all files under one directory per package)

Install Java runtime
Ovirt manual is suggesting installing openJDK. My server has sun-jdk already set so I will point you to Gentoo Java guide for setting java environment. Make sure you are setting jdk version 1.6!!!

Install Java application server – JBoss
This step describes installing upstream server binaries.
 * Download binaries archive


 * Unzip the archive


 * Move the directory to a suitable location. JBoss folder should be owned by the unprivileged user, so you'll be able to deploy build products into JBoss.


 * Test that JBoss is working by	starting the server (-b 0.0.0.0 option makes server bind to all IP addresses)

Troubleshooting JBoss
If you're being attacked by exceptions, follow this list: 127.0.0.1 localhost engine-dev
 * Verify jboss folder owner and permissions.
 * For external connections, make sure your firewall allows incoming traffic on 8080 port.
 * If your machine has and selinux policy installed, make sure it will not block JBoss.
 * Used TCP ports: 8080/8443/8083/1090/4457
 * These ports may be used by other applications. Either close other application or change JBoss configuration (/usr/local/jboss-5.1.0.GA/server/default/deploy/jbossweb.sar/server.xml)
 * Since JBoss binds to the hostname, your hostname should be resolvable, or you may add it to /etc/hosts for local resolution.

Installing build tools

 * Install dev-vcs/git


 * Install dev-java/maven-bin. It is a must to build version 2 of maven. Version 3 is not supported!!! As of time of writing, stable version in portage is 2.2.1 so it is safe to just emerge it:


 * If unsure, emerge strict version:


 * Set up the needed repositories for Maven. To create default repository directory, run maven as non-privileged user. DO NOT use root user.


 * This command will create .m2 directory in your unprivileged user's HOME directory.
 * Copy paste the content of the file below into user's ~/.m2/settings.xml file. See the [Maven personal settings] on the oVirt wiki.


 * Modify jbossHome and JAVA_1_6_HOME tags as needed. If these parameters are incorrect, compiling using maven will fail!

Installing database
Ovirt Engine works with postgresql 8.4.x or 9.1.x
 * Emerge Postgresql server. Make sure uuid useflag is enabled!


 * Make sure the jdbc installed is 9.1_XXX (you may need to unmask it).
 * Once emerged, verify the config files in /etc/postgresql-9.1 	and /etc/conf.d directory. Use Gentoo Postgresql Guide as a reference for configuration.
 * Make sure pg_hba.conf file has access rules set to trust
 * Add your unprivileged user to postgres group


 * Run the relevant emerge --config … command.

Fetch ovirt-engine codebase

 * As unprivileged user, choose a directory where you want to keep oVirt sources and 'cd' to it. This directory will be referenced as $OVIRT_HOME.

Modify build environment
export MAVEN_OPTS="-Xmx2048M -XX:MaxPermSize=2048M" by adding the lines:
 * Increase some maximum values by default. Add the following to $HOME/.mavenrc:
 * Values for mx and MaxPermSize may be different!
 * Build GWT to work with a specific browser. Modify
 * $OVIRT_HOME/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/webadmin/WebAdmin.gwt.xml
 * $OVIRT_HOME/frontend/webadmin/modules/userportal/src/main/java/org/ovirt/engine/ui/userportal/UserPortal.gwt.xml



Building ovirt-engine and REST api

 * As unprivileged user

Compile web-admin and user-portal

 * As unprivileged user

Application deployment

 * The first deployment of the application to JBoss AS container should use the setup profile:


 * There is a issue with the dep and setup_postgres profiles getting in the way of each other. The setup_postgres profile will prevent the deployment of the quartz jar to the JBoss server. So after this step completes, run:


 * From this point on, since postgres is already set up, every time you deploy you can simply run:

Testing

 * Start JBoss application server

http://localhost:8080/
 * Test JBoss by accessing from browser
 * Use username admin@internal and password letmein!	for testing access.
 * Accessing the RESTful API:

http:// : /api http:// : /webadmin http:// : /UserPortal
 * From the browser
 * Accessing the web-admin:
 * Accessing the user-portal

How to contribute

 * oVirt project is working with Gerrit code review for code contribution.
 * In order to register and login to oVirt's Gerrit, you'll need an OpenID account.
 * You can use a Google OpenID, or register to some other provider and use it,
 * All other details can be found here: http://www.ovirt.org/wiki/Working_with_oVirt_Gerrit

Errors & Solutions
Error: When compiling projects, getting errors about unmappable characters. Solution: My install is UTF8, but default locale was not set. So default locale by Maven/JBoss (not sure which one) was US_ASCII. Set default locale and errors are history. Error: Compile process dies with PermGenSpace error. Solution: This error means that no more memory is available to java compiler. This is fixed by setting MAVEN_OPTS with higher values for mx and MaxPermSize parameters. Another trick that helped was choosing only one browser to compile GWT for by modifying above mentioned files. Error: Compile process dies with error code 137. Solution: This one I'm not quite sure about. The only info I could google out was a suggestion to try change the java compiler (oVirt wiki uses openJDK, me sun-jdk). The solution for me was to add -e -DskipTests=true options to maven. Again, I'm not sure how this is relevant as I don't know what error 137 means or how it is caused.
 * Theese are the errors and solutions as I was going through the process of installing oVirt. Feel free to add your own :)

oVirt Node integration

 * By default development setup works with hosts based on base distro's installations.
 * In order to be able to work with oVirt Node (which is a sub-set of the base OS), you'll need to setup a Public Key environment.
 * More details on Engine and oVirt Node integration can be found here: http://www.ovirt.org/wiki/Engine_Node_Integration.
 * Note that by default Gentoo does not have /etc/pki folder, and you'll need to create it (or write an eBuild which will do that).