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>
After entering this command, enter the juju config contrail-command image-tag command to ensure the Contrail Command container is associated with the new image tag.
If the command output displays the old image tag, wait several minutes then retry the juju config contrail-command image-tag command.
If the command output displays the new image tag, proceed to the next step. If the command output continues to display the old image tag, re-enter the juju config contrail-command image-tag=contrail_container_tag to upgrade the container.
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