Bug 1416466 - Restore HE backup will fail if the HE host has running non-HE VM's
Summary: Restore HE backup will fail if the HE host has running non-HE VM's
Alias: None
Product: ovirt-engine
Classification: oVirt
Component: Backup-Restore.Engine
Version: 4.1.0
Hardware: x86_64
OS: Linux
Target Milestone: ovirt-4.1.1
Assignee: Simone Tiraboschi
QA Contact: Artyom
Whiteboard: integration
Depends On:
Blocks: 1235200 1425890
TreeView+ depends on / blocked
Reported: 2017-01-25 15:05 UTC by Artyom
Modified: 2017-04-21 09:47 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Restoring HE backup was failing if the HE host has running non-HE VM; fixing it.
Clone Of:
: 1425890 (view as bug list)
Last Closed: 2017-04-21 09:47:16 UTC
oVirt Team: Integration
rule-engine: ovirt-4.1+
ylavi: exception+
nsednev: testing_plan_complete?

Attachments (Terms of Use)
restore log (15.87 KB, text/plain)
2017-01-25 15:05 UTC, Artyom
no flags Details

System ID Private Priority Status Summary Last Updated
oVirt gerrit 71729 0 master MERGED he_restore: updating foreign key removing HE hosts 2017-02-22 17:02:53 UTC
oVirt gerrit 72802 0 ovirt-engine-4.1 MERGED he_restore: updating foreign key removing HE hosts 2017-02-23 09:24:16 UTC
oVirt gerrit 72805 0 ovirt-engine-4.0 POST he_restore: updating fk removing HE hosts 2017-02-21 17:03:21 UTC
oVirt gerrit 72919 0 ovirt-engine-4.1.1.z MERGED he_restore: updating foreign key removing HE hosts 2017-02-23 09:29:43 UTC

Description Artyom 2017-01-25 15:05:05 UTC
Created attachment 1244276 [details]
restore log

Description of problem:
Restore HE backup will fail if the HE host has running non-HE VM's 

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. Deploy HE environment
2. Add the storage domain to the engine(to start auto-import process)
3. Wait until the engine will have HE VM
4. Add non-HE VM and run it on HE hosts
5. Set global maintenance
6. Backup the engine: # engine-backup --mode=backup --file=engine.backup --log=engine-backup.log
7. Copy the backup file from the HE VM to the host
8. Clean host from HE deploy(reprovisioning)
9. Run the HE deployment again
10. Answer No on the question "Automatically execute engine-setup on the engine appliance on first boot (Yes, No)[Yes]? "
11. Enter to the HE VM and copy the backup file from the host to the HE VM
12. Run restore command: # engine-backup --mode=restore --scope=all --file=engine.backup --log=engine-restore.log  --he-remove-storage-vm --he-remove-hosts --restore-permissions --provision-all-databases

Actual results:
SELECT DeleteHostedEngineHosts();
ERROR:  update or delete on table "vds_static" violates foreign key constraint "vds_static_vm_dynamic_r" on table "vm_dynamic"
DETAIL:  Key (vds_id)=(b0cd1b54-5bf5-475a-b247-778c82eca27a) is still referenced from table "vm_dynamic".
        FROM vds_static
        WHERE vds_id = v_vds_id"
PL/pgSQL function deletevds(uuid) line 19 at SQL statement
SQL statement "SELECT deletevds(vds_id)
        FROM (
            SELECT vds_id
                FROM vds_statistics
                WHERE ha_score IS NOT NULL AND ha_configured
        ) t"
PL/pgSQL function deletehostedenginehosts() line 3 at PERFORM
FATAL: Cannot execute sql command: --command=SELECT DeleteHostedEngineHosts();
2017-01-25 09:32:37 11559: FATAL: Failed cleaning hosted-engine

Expected results:
Restore operation succeeds. I believe we need to remove all references on this host from the database as well(I assume that the restore operation will fail also in the case when we have non-HE VM that does not run on the host but pinned to it, also affinity labels with this host can be a problem)

Additional info:

Comment 2 Artyom 2017-03-26 07:17:21 UTC
Verified on rhevm-

Note You need to log in before you can comment on or make changes to this bug.