Upgrading Contrail Command using Backup Restore Procedure
You cannot use the SQL data with the new version of Contrail Command container if the database schema changes while upgrading the Contrail Command container.
You can resolve the issue by:
- Back up SQL database in
yaml format db dump
.Run the following docker exec contrail_command command on the Contrail Command node to backup the DB.
Contrail Networking Release 2005 or later:
docker exec contrail_command commandutil convert --intype rdbms --outtype yaml --out /etc/contrail/db.yml -c /etc/contrail/command-app-server.yml; mkdir ~/backups; mv /etc/contrail/db.yml ~/backups/
Contrail Networking Release 2003 or earlier:
docker exec contrail_command contrailutil convert --intype rdbms --outtype yaml --out /etc/contrail/db.yml -c /etc/contrail/contrail.yml; mkdir ~/backups; mv /etc/contrail/db.yml ~/backups/
- Upgrade the Contrail Command container.
Specify the desired version of Contrail Command container (container_tag) in the deployer input file (
command_servers.yml
) and deploy playbook.You must use PostgreSQL in the
command_servers.yml
file.The step depends on how you have deployed the Contrail Command.
Contrail Command is deployed using docker installation:
docker run -td --net host -v <ABSOLUTE_PATH_OF_COMMAND_SERVERS_FILE>:/command_servers.yml --privileged --name contrail_command_deployer_<contrail_container_tag> hub.juniper.net/contrail/contrail-command-deployer:<<contrail_container_tag>
Contrail Command is deployed through juju-charms:
juju config contrail-command image-tag=<contrail_container_tag>
The contrail_container_tag for any Contrail Release 20 software can be obtained from README Access to Contrail Networking Registry 20xx
- This
step depends on your Contrail Networking release.
Contrail Networking Release 2005 or later:
Migrate the
yaml formatted db dump
to the new database schema:docker exec contrail_command mkdir /root/backups docker cp /root/backups/db.yml contrail_command:/root/backups/ docker exec contrail_command commandutil migrate --in /root/backups/db.yml --out /root/backups/db_migrated.yml
Contrail Networking Release 2003 or earlier:
Modify the yaml-formatted db dump by adding or removing the fields per the new database schema.
- Restore
the modified
yaml formatted db dump
to the SQL database.Contrail Networking Release 2005 or later:
docker exec contrail_command commandutil convert --intype yaml --in /root/backups/db_migrated.yml --outtype rdbms -c /etc/contrail/command-app-server.yml
Contrail Networking Release 2003 or earlier:
docker exec contrail_command mkdir /root/backups docker cp /root/backups/db.yml contrail_command:/root/backups/ docker exec contrail_command contrailutil convert --intype yaml --in ~/backups/db.yml --outtype rdbms -c /etc/contrail/contrail.yml
If the restore procedure fails because of schema mismatch, repeat Step 3 and Step 4 with incremental db dump changes.