Bug 2037277

Summary: Premature backup stop executed during the 'INITIALIZING' backup phase is ignored
Product: [oVirt] ovirt-engine Reporter: Pavel Bar <pbar>
Component: Backup-Restore.VMsAssignee: Pavel Bar <pbar>
Status: CLOSED DUPLICATE QA Contact: Evelina Shames <eshames>
Severity: medium Docs Contact: bugs <bugs>
Priority: unspecified    
Version: 4.4.10CC: ahadas, bugs
Target Milestone: ---Flags: pm-rhel: ovirt-4.5?
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-05-24 15:14:33 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Storage RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Pavel Bar 2022-01-05 11:14:04 UTC
Description of problem:
Premature 'backup stop' during the "INITIALIZING" backup phase is ignored in certain scenarios (race).

Version-Release number of selected component (if applicable):
4.4.10 (actually could happen at the previous versions as well).

How reproducible:
Run full backup and at the same time (at the most beginning of the full backup, while the backup phase is in "INITIALIZING" phase) execute 'backup stop' command.
Note: in order to execute the 'backup stop' you will need a backup UUID. To get the UUID either (1) test in a loop the "vm_backups" DB table for the new backup entry and when a new entry is added retrieve the "backup_id" or (2) probably easier to provide the backup ID manually.

Steps to Reproduce:
1. Run full backup.
2. Immediately execute 'backup stop' using the backup UUID of the above full backup.
3. The "FINALIZING_FAILURE" phase that was updated by the 'backup stop' is ignored - overridden by the full backup with either "CREATING_SCRATCH_DISKS" (live backup) or "ADDING_BITMAPS" (cold backup).

Actual results:
The backup flow will continue to run as if the 'backup stop' never happened.

The event log will contain the following:
ERROR   Backup 3d396dd1-2398-4eee-8730-fb6f5548b482 for VM VM1 failed to finalize (User: admin@internal-authz).
NORMAL  Backup 3d396dd1-2398-4eee-8730-fb6f5548b482 for VM VM1 started (User: admin@internal-authz).
NORMAL  Backup 3d396dd1-2398-4eee-8730-fb6f5548b482 for VM VM1 finalized (User: admin@internal-authz).
NORMAL  Backup 3d396dd1-2398-4eee-8730-fb6f5548b482 for VM VM1 completed successfully (User: admin@internal-authz).

The log will also contain the premature log message.
2022-01-05 13:07:08,899+02 WARN  [org.ovirt.engine.core.bll.storage.backup.StopVmBackupCommand] (default task-30) [4110928c-5260-423c-a262-b357589fa6c6] Backup '3d396dd1-2398-4eee-8730-fb6f5548b482' is in 'INITIALIZING' phase, premature backup stop was initiated.

The 'backup stop' command will end with the following error:
ovirtsdk4.Error: Fault reason is "Operation Failed". Fault detail is "[backup '3d396dd1-2398-4eee-8730-fb6f5548b482' is in 'initializing' phase, premature backup stop was initiated.]". HTTP response code is 400.

Expected results:
The backup should terminate prematurely due to the explicit 'backup stop' command.

Comment 2 Arik 2022-05-24 15:14:33 UTC
We rewrite the stop-backup flow as part of bz 1900552

*** This bug has been marked as a duplicate of bug 1900552 ***