core: database restore fixes
core: database restore fixes

This patch enables restoring the database from a old backup and will
perform all necessary data and schema updates using the upgrade.sh
script that is executed after the restore is completed.
The upgrade step also forces truncation of the async_tasks and
business_entity_snapshot tables since those tables contain data that is
relevant for asynchronous tasks and might lead to exceptions if
restored.
You can omit the execution of the upgrade step with the -o flag.

The recommended way for restoring your database is.
1) backup current with backup.sh
2) run restore.sh and give other database instance name as the target
3) edit JBOSS standalone.xml to run the new restored database instance
4) verify that all tasks in the application are completed
5) restart JBOSS

Change-Id: Ib2fc6b61e8e679db40acf2a074fc4737873d5707
Signed-off-by: Eli Mesika <dc8a2a200abf66067593de2e51fee9376f06ea0f@redhat.com>

yapengsong/ovirt-engine,walteryang47/ovirt-engine,OpenUniversity/ovirt-engine,zerodengxinchao/ovirt-engine,OpenUniversity/ovirt-engine,zerodengxinchao/ovirt-engine,halober/ovirt-engine,yingyun001/ovirt-engine,eayun/ovirt-engine,eayun/ovirt-engine,yapengsong/ovirt-engine,yingyun001/ovirt-engine,halober/ovirt-engine,yapengsong/ovirt-engine,yingyun001/ovirt-engine,yingyun001/ovirt-engine,OpenUniversity/ovirt-engine,OpenUniversity/ovirt-engine,eayun/ovirt-engine,walteryang47/ovirt-engine,zerodengxinchao/ovirt-engine,halober/ovirt-engine,zerodengxinchao/ovirt-engine,eayun/ovirt-engine,yingyun001/ovirt-engine,yapengsong/ovirt-engine,yapengsong/ovirt-engine,zerodengxinchao/ovirt-engine,walteryang47/ovirt-engine,walteryang47/ovirt-engine,walteryang47/ovirt-engine,OpenUniversity/ovirt-engine,halober/ovirt-engine,eayun/ovirt-engine