Upgrading from Previous Versions 4.0

This guide describes the installation procedure for systems that are already running a 2.x or 3.x OpenNebula. The upgrade will preserve all current users, hosts, resources and configurations; for both Sqlite and MySQL backends.

Read the Compatibility Guide and Relase Notes to know what is new in OpenNebula 4.0.

inlinetoc

Preparation

Before proceeding, make sure you don't have any VMs in a transient state (prolog, migr, epil, save). Wait until these VMs get to a final state (runn, suspended, stopped, done). Check the Managing Virtual Machines guide for more information on the VM life-cycle.

Stop OpenNebula and any other related services you may have running: EC2, OCCI, and Sunstone.

<xterm> $ sunstone-server stop $ econe-server stop $ occi-server stop $ oneacctd stop $ one stop </xterm>

Backup

Backup the configuration files located in /etc/one. You don't need to do a manual backup of your database, the onedb command will perform one automatically.

Installation

Follow the Installation guide, taking into account that you will already have configured the passwordless ssh access for oneadmin.

It is highly recommended not to keep your current oned.conf, and update the oned.conf file shipped with OpenNebula 4.0 to your setup. If for any reason you plan to preserve your current oned.conf file, read the Compatibility Guide and the complete oned.conf reference for 3.8 and 4.0 versions.

:!: If you are upgrading from a version prior to 3.8, read the 3.4 upgrade guide, 3.6 upgrade guide and 3.8 upgrade guide for specific notes.

Driver Changes

Xen Drivers

Xen vmm drivers are now split in version 3 an version 4. The code of the drivers are the same but some configuration options are set for each of the drivers so they are compatible. By default both drivers are commented and have the same name (xen). To enable them just uncomment the version you want. Some parameters like the default image prefix can be changed in both /etc/one/vmm_exec/vmm_exec_xen* and /var/lib/one/remotes/vmm/xen*/xenrc.

Database Upgrade

The database schema and contents are incompatible between versions. The OpenNebula daemon checks the existing DB version, and will fail to start if the version found is not the one expected, with the message 'Database version mismatch'.

You can upgrade the existing DB with the 'onedb' command. You can specify any Sqlite or MySQL database. Check the onedb reference for more information.

After you install the latest OpenNebula, and fix any possible conflicts in oned.conf, you can issue the 'onedb upgrade -v' command. The connection parameters have to be supplied with the command line options, see the onedb manpage for more information. Some examples:

<xterm> $ onedb upgrade -v –sqlite /var/lib/one/one.db </xterm>

<xterm> $ onedb upgrade -v -S localhost -u oneadmin -p oneadmin -d opennebula </xterm>

If everything goes well, you should get an output similar to this one:

<xterm> $ onedb upgrade -v -u oneadmin -d opennebula MySQL Password: Version read: 3.8.3 : Database migrated from 3.8.0 to 3.8.3 (OpenNebula 3.8.3) by onedb command. MySQL dump stored in /var/lib/one/mysql_localhost_opennebula.sql Use 'onedb restore' or restore the DB using the mysql command: mysql -u user -h server -P port db_name < backup_file > Running migrator /usr/lib/one/ruby/onedb/3.8.3_to_3.8.4.rb > Done > Running migrator /usr/lib/one/ruby/onedb/3.8.4_to_3.9.80.rb ATTENTION: manual intervention required Virtual Machine deployment files have been moved from /var/lib/one to /var/lib/one/vms. You need to move these files manually: $ mv /var/lib/one/[0-9]* /var/lib/one/vms > Done > Running migrator /usr/lib/one/ruby/onedb/3.9.80_to_3.9.90.rb ATTENTION: manual intervention required IM and VM MADS have been renamed in oned.conf. To keep your existing hosts working, you need to duplicate the drivers with the old names. For example, for kvm you will have IM_MAD "kvm" and VM_MAD "kvm", so you need to add IM_MAD "im_kvm" and VM_MAD "vmm_kvm" IM_MAD = [ name = "kvm", executable = "one_im_ssh", arguments = "-r 0 -t 15 kvm" ] IM_MAD = [ name = "im_kvm", executable = "one_im_ssh", arguments = "-r 0 -t 15 kvm" ] VM_MAD = [ name = "kvm", executable = "one_vmm_exec", arguments = "-t 15 -r 0 kvm", default = "vmm_exec/vmm_exec_kvm.conf", type = "kvm" ] VM_MAD = [ name = "vmm_kvm", executable = "one_vmm_exec", arguments = "-t 15 -r 0 kvm", default = "vmm_exec/vmm_exec_kvm.conf", type = "kvm" ] > Done Database migrated from 3.8.1 to 3.9.90 (OpenNebula 3.9.90) by onedb command. </xterm>

:!: Make sure you keep the backup file. If you face any issues, the onedb command can restore this backup, but it won't downgrade databases to previous versions.

Virtual Machine Directories

If you are upgrading from a version lower than 3.8.3, you need to move the Virtual Machine deployment files from '/var/lib/one' to '/var/lib/one/vms':

<xterm> $ mv /var/lib/one/[0-9]* /var/lib/one/vms </xterm>

Driver Names

OpenNebula default driver names have changed in the configuration file. Now the names of the vmm and im drivers are not prepended by the type of driver:

  • vmm_kvmkvm
  • vmm_xenxen
  • vmm_vmwarevmware
  • vmm_ec2ec2
  • vmm_dummydummy
  • im_kvmkvm
  • im_xenxen
  • im_vmwarevmware
  • im_ec2ec2
  • im_gangliaganglia
  • im_dummydummy

To keep your existing hosts working, you need to duplicate the drivers with the old names.

For example, for kvm you will have IM_MAD “kvm” and VM_MAD “kvm”, so you need to add IM_MAD “im_kvm” and VM_MAD “vmm_kvm”

IM_MAD = [
      name       = "kvm",
      executable = "one_im_ssh",
      arguments  = "-r 0 -t 15 kvm" ]
 
 
IM_MAD = [
      name       = "im_kvm",
      executable = "one_im_ssh",
      arguments  = "-r 0 -t 15 kvm" ]
 
VM_MAD = [
    name       = "kvm",
    executable = "one_vmm_exec",
    arguments  = "-t 15 -r 0 kvm",
    default    = "vmm_exec/vmm_exec_kvm.conf",
    type       = "kvm" ]
 
VM_MAD = [
    name       = "vmm_kvm",
    executable = "one_vmm_exec",
    arguments  = "-t 15 -r 0 kvm",
    default    = "vmm_exec/vmm_exec_kvm.conf",
    type       = "kvm" ]

Check DB consistency

After the upgrade is completed, you should run the command onedb fsck.

First, move the 3.8 backup file created by the upgrade command to a save place.

<xterm> $ mv /var/lib/one/mysql_localhost_opennebula.sql /path/for/one-backups/ </xterm>

Then execute the following command:

<xterm> $ onedb fsck -S localhost -u oneadmin -p oneadmin -d opennebula MySQL dump stored in /var/lib/one/mysql_localhost_opennebula.sql Use 'onedb restore' or restore the DB using the mysql command: mysql -u user -h server -P port db_name < backup_file

Total errors found: 0 </xterm>

Testing

You should be able now to start OpenNebula as usual, running 'one start' as oneadmin. OpenNebula will continue the monitoring and management of your previous Hosts and VMs.

As a measure of caution, look for any error messages in oned.log, and check that all drivers are loaded successfully. After that, keep an eye on oned.log while you issue the onevm, onevnet, oneimage, oneuser, onehost list commands. Try also using the show subcommand for some resources.

Restoring the Previous Version

If for any reason you need to restore your previous OpenNebula, follow these steps:

  • With OpenNebula 4.0 still installed, restore the DB backup using 'onedb restore -f'
  • Uninstall OpenNebula 4.0, and install again your previous version.
  • Copy back the backup of /etc/one you did to restore your configuration.

Known Issues

If the MySQL database password contains specials characters, such as @ or #, the onedb command will fail to connect to it.

The workaround is to temporarily change the oneadmin's password to an ASCII string. The set password statement can be used for this:

<xterm> $ mysql -u oneadmin -p

mysql> SET PASSWORD = PASSWORD('newpass'); </xterm>