Important The normal patches doesn’t need databases upgrade, but someones does. Check the patches reference table to know when it will be necessary.

Patches reference table

Current version Target version Database changes Available to

3.5.x

3.5.x

No

Community

4.0.x

4.0.x

No

Community

4.1.0

4.1.1

No

Self-support & Enterprise subscriptions

4.1.0-4.1.1

4.1.2

Yes

Self-support & Enterprise subscriptions

Note It is possible to apply not consecutive patches as long as database changes are made, if were necessary
Note This manual is an example of how to patch 4.1.0 to 4.1.1. Replace those versions to specific ones of the current installation and the patch that you need to apply.

1. 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

2. Upgrade packages

After that, upgrade to QVD 4.1.1:

Important If the patch version is not availabe to community, go to Commercial packages section to upgrade. Check the Patches reference table if you don’t know the type of patch that you want to apply.

2.1. Community patches

For community patches, please, use the following commands:

2.1.1. Ubuntu

echo "deb http://theqvd.com/packages/ubuntu-xenial QVD-4.1.1 main" > /etc/apt/sources.list.d/qvd4.1_repo.list
apt-get update -o Dir::Etc::sourcelist=sources.list.d/qvd4.1_repo.list -o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0"
apt-get upgrade -o Dir::Etc::sourcelist=sources.list.d/qvd4.1_repo.list -o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0"

2.1.2. SLES

zypper rr QVD
zypper ar http://theqvd.com/packages/sles/12SP1/QVD-4.1.1 QVD
zypper ref
sudo zypper update --repo QVD

2.1.3. Centos

yum-config-manager --add-repo http://theqvd.com/packages/centos/7.2/QVD-4.1.1/
yum --disablerepo=”*” --enablerepo=”theqvd.com/packages/centos/7.2/QVD-4.1.1/” update

2.2. Commercial patches

For commercial patches, please, use the following commands:

2.2.1. Ubuntu

echo "deb http://$USER:$PASSWORD@theqvd.com/commercial-packages/ubuntu/xenial QVD-4.1.1 main" > /etc/apt/sources.list.d/qvd4.1_repo.list
apt-get update -o Dir::Etc::sourcelist=sources.list.d/qvd4.1_repo.list -o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0"
apt-get upgrade -o Dir::Etc::sourcelist=sources.list.d/qvd4.1_repo.list -o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0"

2.2.2. SLES

zypper rr QVD
zypper ar http://theqvd.com/commercial-packages/sles/12SP1/QVD-4.1.1 QVD
zypper ref
 User Name: $USER
 Password: $PASSWORD
sudo zypper update --repo QVD

2.2.3. Centos

echo "[QVD-4.1.1]" > /etc/yum.repos.d/QVD-4.1.1.repo
echo "name=QVD-4.1.1" >> /etc/yum.repos.d/QVD-4.1.1.repo
echo "baseurl=http://$USER:$PASSWORD@theqvd.com/commercial-packages/centos/7.2/QVD-4.1.1/" | sed 's/@\(.*@\)/%40\1/' >> /etc/yum.repos.d/QVD-4.1.1.repo
echo "enabled=1" >> /etc/yum.repos.d/QVD-4.1.1.repo
yum --disablerepo=”*” --enablerepo=”QVD-4.1.1” update
Note $USER and $PASSWORD are the credentials received when the suscription is purchased.
Important If database changes are not necessary, upgrade is concluded. Otherwise, please, keep on reading.

3. 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/qvddb4.1.0.backup
exit
Note Replace qvd from pg_dump command by your QVD database name if necessary

4. Upgrade database

Finally update the database with 4.1.1 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 4.1 --file /usr/lib/qvd/bin/qvd-init-data.dat
Note Replace qvd from psql commands by your QVD database name if necessary
Note Replace 4.1 by the QVD major version affected by the patch (I.E.: 4.2, 4.3, 5.0…)

5. Database rollback

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

cat /tmp/qvddb4.1.0.backup | psql dbname