Bug 1341177

Summary: [RFE] Log "Cannot migrate VM" and "Cannot run VM" failures to "Events" tab (audit_log)
Product: Red Hat Enterprise Virtualization Manager Reporter: Julio Entrena Perez <jentrena>
Component: ovirt-engineAssignee: Arik <ahadas>
Status: CLOSED ERRATA QA Contact: Israel Pinto <ipinto>
Severity: medium Docs Contact:
Priority: high    
Version: 3.6.5CC: ahadas, jentrena, juan.hernandez, lbopf, lsurette, mavital, mgoldboi, michal.skrivanek, mkalinin, mtessun, pstehlik, rbalakri, Rhev-m-bugs, srevivo, tjelinek, tmichett, vanhoof, ykaul
Target Milestone: ovirt-4.2.2Keywords: FutureFeature
Target Release: ---Flags: mavital: testing_plan_complete+
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: No Doc Update
Doc Text:
undefined
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-05-15 17:38:32 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Virt RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1425219, 1523346    
Attachments:
Description Flags
failed to migrate vm none

Description Julio Entrena Perez 2016-05-31 12:14:50 UTC
Currently failures to start or live migrate a VM due to lack of resources in the cluster are logged to engine.log file and reported to the requester (via web ui, API) but those failures are not logged into audit_log (Events tab).

When using automation (e.g. CloudForms) against RHEV-M, logging these failures to Events tab (audit_log) would be useful for other teams (that might not have access to engine.log file in RHEV-M) to be able to see the reason for the failure.

Comment 2 Michal Skrivanek 2016-06-01 10:27:08 UTC
The error is returned during the REST API call. E.g.:
<action>
    <fault>
        <detail>[Cannot run VM. There is no host that satisfies current scheduling constraints. See below for details:, The host rhel7-host did not satisfy internal filter CPU because it does not have enough cores to run the VM.]</detail>
        <reason>Operation Failed</reason>
    </fault>
    <status>failed</status>
</action>

I believe that is the proper and best way. Suggested behavior would mean worse experience for RHEV portal users.
I'm suggesting WONTFIX in RHEV, it should be solved at CloudForms level to show the error message

Comment 27 Tomas Jelinek 2017-09-29 08:15:53 UTC
We are logging this two events into audit log. The reason you did not see them was this BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1432127

Setting it to MODIFIED so it will eventually reach on_qa and receive an independent verification.

Comment 33 Israel Pinto 2017-11-05 13:34:40 UTC
Failed QE:
Both cases are not written to audit log (Event log).
The migration case:
Migration Case: 
Migrate VM with 1 Host in cluster via REST
https://polarion.engineering.redhat.com/polarion/redirect/project/RHEVM3/workitem?id=RHEVM-23932
Results: See attached screenshot
The REST Returns: 
There are no hosts in ....
And you can see the error in Tasks tab only.

Run VM case:
Create VM in cluster with no host and Run VM
https://polarion.engineering.redhat.com/polarion/redirect/project/RHEVM3/workitem?id=RHEVM-23934
Vm Failed to run, operation failed with message, 
"There are no hosts to use. Check that the cluster contains at least one host in Up state."

In both cases nothing is written to event tab.

Comment 34 Israel Pinto 2017-11-05 14:08:38 UTC
Created attachment 1348140 [details]
failed to migrate vm

Comment 37 Israel Pinto 2018-02-21 12:11:41 UTC
Checked with:
Engine Version:4.2.2-0.1.el7

Cases:
1. Migration VM with 1 host in cluster via REST API:
2. Start VM with no host in cluster

Results:
Case 1: Failed wrong error message. 
Migration failed but the error message is not correct, response:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<action>
<async>false</async>
<fault>
<detail>[There are no hosts to use. Check that the cluster contains at least one host in Up state.]</detail>
<reason>Operation Failed</reason>
</fault>
<grace_period>
<expiry>10</expiry>
</grace_period>
<status>failed</status>
</action>

Case 2: Start VM with no host in cluster:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<action>
<async>false</async>
<fault>
<detail>[There are no hosts to use. Check that the cluster contains at least one host in Up state.]</detail>
<reason>Operation Failed</reason>
</fault>
<grace_period>
<expiry>10</expiry>
</grace_period>
<status>failed</status>
</action>

Comment 38 Arik 2018-02-21 13:22:18 UTC
(In reply to Israel Pinto from comment #37)
Note that the response has not changed - you need to see that an audit log is produced in those cases.

Comment 39 Israel Pinto 2018-02-26 09:13:13 UTC
Checked with:
Engine Version:4.2.2-0.1.el7

Cases:
1. Migration VM with 1 host in cluster via REST API:
2. Start VM with no host in cluster

Case 1:
2018-02-25 17:25:40,789+02 INFO  [org.ovirt.engine.core.sso.utils.AuthenticationUtils] (default task-23) [] User admin@internal successfully logged in with scopes: ovirt-app-api ovirt-ext=token-info:authz-search ovirt-ext=token-info:public-authz-search ovirt-ext=token-info:validate ovirt-ext=token:password-access
2018-02-25 17:25:40,838+02 INFO  [org.ovirt.engine.core.bll.aaa.CreateUserSessionCommand] (default task-26) [67e1400] Running command: CreateUserSessionCommand internal: false.
2018-02-25 17:25:40,854+02 INFO  [org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector] (default task-26) [67e1400] EVENT_ID: USER_VDC_LOGIN(30), User admin@internal-authz connecting from '10.35.4.108' using session 'RKzD4VbvDYmd0rr+PxoSb9lLEvH11pXsVXtdveyc6bQVLpf2qRY8VZ2R10dXU18GX63w2LZgV3s6lGXgTO2mIg==' logged in.
2018-02-25 17:25:40,926+02 INFO  [org.ovirt.engine.core.bll.MigrateVmCommand] (default task-26) [96b2c52a-1b0d-4818-a263-56cd144a2ef1] Lock Acquired to object 'EngineLock:{exclusiveLocks='[6e3b374e-4799-4081-9d1e-00efe9e1c6d2=VM]', sharedLocks=''}'
2018-02-25 17:25:41,065+02 ERROR [org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector] (default task-26) [96b2c52a-1b0d-4818-a263-56cd144a2ef1] EVENT_ID: VM_MIGRATION_FAILED(65), Migration failed due to a failed validation: [There are no hosts to use. Check that the cluster contains at least one host in Up state.] (VM: golden_env_mixed_virtio_0, Source: host_mixed_1).
2018-02-25 17:25:41,065+02 WARN  [org.ovirt.engine.core.bll.MigrateVmCommand] (default task-26) [96b2c52a-1b0d-4818-a263-56cd144a2ef1] Validation of action 'MigrateVm' failed for user admin@internal-authz. Reasons: VAR__ACTION__MIGRATE,VAR__TYPE__VM,SCHEDULING_NO_HOSTS
2018-02-25 17:25:41,067+02 INFO  [org.ovirt.engine.core.bll.MigrateVmCommand] (default task-26) [96b2c52a-1b0d-4818-a263-56cd144a2ef1] Lock freed to object 'EngineLock:{exclusiveLocks='[6e3b374e-4799-4081-9d1e-00efe9e1c6d2=VM]', sharedLocks=''}'
2018-02-25 17:25:41,078+02 ERROR [org.ovirt.engine.api.restapi.resource.AbstractBackendResource] (default task-26) [] Operation Failed: [There are no hosts to use. Check that the cluster contains at least one host in Up state.]

Case 2:
engine.log:2018-02-25 17:19:11,717+02 ERROR [org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector] (default task-21) [c3bd851b-753c-4565-bc75-f3a78ebc9c5e] EVENT_ID: USER_FAILED_RUN_VM(54), Failed to run VM golden_env_mixed_virtio_0 due to a failed validation: [There are no hosts to use. Check that the cluster contains at least one host in Up state.] (User: admin@internal-authz).
engine.log-2018-02-25 17:19:11,717+02 WARN  [org.ovirt.engine.core.bll.RunVmCommand] (default task-21) [c3bd851b-753c-4565-bc75-f3a78ebc9c5e] Validation of action 'RunVm' failed for user admin@internal-authz. Reasons: VAR__ACTION__RUN,VAR__TYPE__VM,SCHEDULING_NO_HOSTS
engine.log-2018-02-25 17:19:11,718+02 INFO  [org.ovirt.engine.core.bll.RunVmCommand] (default task-21) [c3bd851b-753c-4565-bc75-f3a78ebc9c5e] Lock freed to object 'EngineLock:{exclusiveLocks='[6e3b374e-4799-4081-9d1e-00efe9e1c6d2=VM]', sharedLocks=''}'
engine.log:2018-02-25 17:19:11,727+02 ERROR [org.ovirt.engine.api.restapi.resource.AbstractBackendResource] (default task-21) [] Operation Failed: [There are no hosts to use. Check that the cluster contains at least one host in Up state.]

Comment 43 errata-xmlrpc 2018-05-15 17:38:32 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

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

https://access.redhat.com/errata/RHEA-2018:1488

Comment 44 Franta Kust 2019-05-16 13:04:48 UTC
BZ<2>Jira Resync