Bug 1522669

Summary: Log uncleared async tasks when failing to stop the SPM
Product: [oVirt] ovirt-engine Reporter: Ala Hino <ahino>
Component: BLL.StorageAssignee: Ala Hino <ahino>
Status: CLOSED CURRENTRELEASE QA Contact: Natalie Gavrielov <ngavrilo>
Severity: low Docs Contact:
Priority: unspecified    
Version: 4.1.2CC: ahino, bugs, ylavi
Target Milestone: ovirt-4.2.1Flags: rule-engine: ovirt-4.2+
ylavi: exception+
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: 2018-02-12 11:49:17 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 Ala Hino 2017-12-06 08:50:09 UTC
Description of problem:
When failing to stop the SPM because there are uncleared tasks, log the details (guid and type) of the tasks that are uncleared yet

Steps to Reproduce:
1. Stop the SPM while there running async tasks

Actual results:
A log message explaining that stopping the SPM failed because there are uncleared tasks:

2017-11-30 16:35:51,637+02 INFO  [org.ovirt.engine.core.vdsbroker.vdsbroker.SpmStopVDSCommand] (default task-20) [hosts_syncAction_32e8cdc8-2f8f-45d0] SpmStopVDSCommand::Not stopping SPM on vds 'host_mixed_2', pool id '4eabbc3f-aae9-404f-bde3-262d505fa6d0' as there are uncleared tasks


Expected results:
Add uncleared tasks details to the log message

Comment 1 Raz Tamir 2018-01-14 11:23:23 UTC
Ala,

I see the message that says there are uncleared tasks when trying to maintenance SPM when there are async tasks but I don't see the details of the task:

"Expected results:
Add uncleared tasks details to the log message"

Comment 2 Ala Hino 2018-01-14 12:00:12 UTC
You should look messages similar to the following:

2018-01-09 22:08:12,981+02 ERROR [org.ovirt.engine.core.vdsbroker.vdsbroker.SpmStopVDSCommand] (default task-16) [ac8687c9-6792-4759-a632-b4d1fd6ffcb8] SpmStopVDSCommand::Not stopping SPM on vds 'rich-el73-host04', pool id '7ea6d0c9-8563-4909-a406-183cd18ebd35' as there are uncleared tasks 'Task '8424a48a-814d-4650-9b48-539d5107863a', status 'running''

Didn't you see such?

Comment 3 Natalie Gavrielov 2018-02-04 13:04:52 UTC
Ala,

I tried the following:
1. Create VM with disk.
2. Put SPM to maintenance while the VM is being created.

Also tried:
1. Create template from VM.
2. Put SPM to maintenance while the VM is being created.

For both tests I get:
UI:
"Error while executing action: Cannot switch Host to Maintenance mode. Host has asynchronous running tasks,
wait for operation to complete and retry."


and there are the following messages in engine.log:

2018-02-04 14:45:25,521+02 WARN  [org.ovirt.engine.core.bll.MaintenanceNumberOfVdssCommand] (default task-8) [9b0e3418-20ad-46b9-85d6-b8807cbc2244] There are running tasks on the SPM: 'AsyncTask:{commandId='3037ebed-7fab-4539-94b1-78b46525874a', rootCommandId='0dbe00e8-80cd-476d-9d9b-1a41686ef7d4', storagePoolId='85059f91-4b8e-443f-980f-89046833f505', taskId='6540a2c1-5d93-400e-a3a6-a0eeabb6aaac', vdsmTaskId='27df0cf0-3974-4f22-a154-642ec730f1ec', stepId='1c3a283b-fb1a-4162-a348-78492ab54c3d', taskType='copyImage', status='running'}'
2018-02-04 14:45:25,521+02 WARN  [org.ovirt.engine.core.bll.MaintenanceNumberOfVdssCommand] (default task-8) [9b0e3418-20ad-46b9-85d6-b8807cbc2244] Validation of action 'MaintenanceNumberOfVdss' failed for user admin@internal-authz. Reasons: VAR__TYPE__HOST,VAR__ACTION__MAINTENANCE,VDS_CANNOT_MAINTENANCE_SPM_WITH_RUNNING_TASKS
 
It's not very similar to the message in comment 2, but it does explain why maintenance operation failed.
Is this log message OK?

Comment 4 Ala Hino 2018-02-04 13:54:16 UTC
Yes, this is the correct message.

Comment 5 Natalie Gavrielov 2018-02-04 14:13:49 UTC
Verified, using builds:
rhvm-4.2.1.4-0.1.el7.noarch
vdsm-4.20.17-1.el7ev.x86_64

Comment 6 Sandro Bonazzola 2018-02-12 11:49:17 UTC
This bugzilla is included in oVirt 4.2.1 release, published on Feb 12th 2018.

Since the problem described in this bug report should be
resolved in oVirt 4.2.1 release, it has been closed with a resolution of CURRENT RELEASE.

If the solution does not work for you, please open a new bug report.