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.
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
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.
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.
Created attachment 1348140 [details] failed to migrate vm
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>
(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.
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.]
RUN: https://polarion.engineering.redhat.com/polarion/#/project/RHEVM3/testrun?id=Run-1&tab=records&result=passed
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
BZ<2>Jira Resync