You cannot use the SQL data with the new version
of Contrail Command container if the database schema changes while
upgrading Contrail Command container.
You can resolve the issue by:
- Back up SQL database in yaml format db
dump.
Run the following command on the Contrail Command node to backup
the DB.
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.
docker run -td --net host -v
<ABSOLUTE_PATH_OF_COMMAND_SERVERS_FILE>:/command_servers.yml
--privileged --name contrail_command_deployer_<BUILD_NO>
hub.juniper.net/contrail/contrail-command-deployer:<BUILD_NO>
- Modify
the yaml formatted db dump by adding
or removing the fields as per the new database schema.
- Restore
the modified yaml formatted db dump to the SQL database.
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
Note: If the restore procedure fails because of schema mismatch,
repeat Step 3 and Step 4 with incremental db dump changes.