Note Due to possible incompatibilities with 3.X and 4.0, the re-installation of the packages as a part of the upgrading process between major versions is highly recommended.

1. Backup

Upgrade the database schema keeping all the data and configuration is simple, but before doing the procedure is highly recommended to generate a backup in case something goes wrong. In order to generate the backup execute the following commands:

sudo su postgres
pg_dump qvd > /tmp/qvddb3.X.backup
exit
Note Replace qvd from pg_dump command by your QVD database name if necessary

2. Stop services

First of all, we need to stop all qvd running virtual machines and services

qa4 vm stop
service qvd-hkd stop
service qvd-api stop

3. Delete current packages

sudo su
apt-get remove -y *qvd*
apt-get autoremove

4. Packages installation

After that, install QVD 4.0 packages:

4.1. Community version

For community packages, please, use the following commands:

4.1.1. Ubuntu

echo "deb http://theqvd.com/packages/ubuntu-xenial QVD-4.0.4 main" > /etc/apt/sources.list.d/qvd4.0_repo.list
apt-get update -o Dir::Etc::sourcelist=sources.list.d/qvd4.0_repo.list -o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0"
apt-get install perl-qvd-hkd perl-qvd-api perl-qvd-admin perl-qvd-admin4 qvd-wat

4.1.2. SLES

zypper rr QVD
zypper ar http://theqvd.com/packages/sles/12SP1/QVD-4.0.4 QVD
zypper ref
sudo zypper install perl-QVD-HKD perl-QVD-API perl-QVD-Admin perl-QVD-Admin4 qvd-wat

4.1.3. Centos

yum-config-manager --add-repo http://theqvd.com/packages/centos/7.2/QVD-4.0.4/
sudo yum install perl-QVD-HKD perl-QVD-API perl-QVD-Admin perl-QVD-Admin4 qvd-wat

4.2. Commercial version

For commercial packages, please, use the following commands:

4.2.1. Ubuntu

echo "deb http://$USER:$PASSWORD@theqvd.com/commercial-packages/ubuntu/xenial QVD-4.0.4 main" > /etc/apt/sources.list.d/qvd4.0_repo.list
apt-get update -o Dir::Etc::sourcelist=sources.list.d/qvd4.0_repo.list -o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0"
apt-get install perl-qvd-hkd perl-qvd-api perl-qvd-admin perl-qvd-admin4 qvd-wat

4.2.2. SLES

zypper rr QVD
zypper ar http://theqvd.com/commercial-packages/sles/12SP1/QVD-4.0.4 QVD
zypper ref
 User Name: $USER
 Password: $PASSWORD
sudo zypper install perl-QVD-HKD perl-QVD-API perl-QVD-Admin perl-QVD-Admin4 qvd-wat

4.2.3. Centos

echo "[QVD-4.0.4]" > /etc/yum.repos.d/QVD-4.0.4.repo
echo "name=QVD-4.0.4" >> /etc/yum.repos.d/QVD-4.0.4.repo
echo "baseurl=http://$USER:$PASSWORD@theqvd.com/commercial-packages/centos/7.2/QVD-4.0.4/" | sed 's/@\(.*@\)/%40\1/' >> /etc/yum.repos.d/QVD-4.0.4.repo
echo "enabled=1" >> /etc/yum.repos.d/QVD-4.0.4.repo
sudo yum install perl-QVD-HKD perl-QVD-API perl-QVD-Admin perl-QVD-Admin4 qvd-wat
Note $USER and $PASSWORD are the credentials received when the suscription is purchased.

5. Upgrade database

Finally update the database with 4.0.4 schema:

sudo su postgres
psql -d qvd -c "DELETE FROM versions WHERE component='schema'"
psql -d qvd -c "DELETE FROM session"
exit
/usr/lib/qvd/bin/perl /usr/lib/qvd/bin/qvd-deploy-db.pl --update-schema --update-from 3.6 --file /usr/lib/qvd/bin/qvd-init-data.dat
Note Replace qvd from psql commands by your QVD database name if necessary

6. Database rollback

If during the upgrade something went wrong, just reinstall QVD 3.X, and if the database achieved an invalid state you can recover it by executing:

cat /tmp/qvddb3.X.backup | psql dbname