Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1791255

Summary: [RFE] There are no available hosts capable of running the engine VM. Why?
Product: [oVirt] ovirt-engine Reporter: Yedidyah Bar David <didi>
Component: BLL.VirtAssignee: Andrej Krejcir <akrejcir>
Status: CLOSED CURRENTRELEASE QA Contact: Nikolai Sednev <nsednev>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 4.3.6.7CC: akrejcir, bugs, michal.skrivanek, rbarry
Target Milestone: ovirt-4.4.0Keywords: FutureFeature, Triaged
Target Release: ---Flags: pm-rhel: ovirt-4.4?
pm-rhel: planning_ack?
pm-rhel: devel_ack+
pm-rhel: testing_ack+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: rhv-4.4.0-29 Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-05-20 20:02:50 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:

Description Yedidyah Bar David 2020-01-15 10:59:21 UTC
Description of problem:

When trying to move a host to maintenance, if the hosted-engine VM can't be migrated to another host, engine.log has:


2020-01-15 02:12:57,859-05 ERROR [org.ovirt.engine.api.restapi.resource.AbstractBackendResource] (default task-7) [] Operation Failed: [Cannot switch the Host(s) to Maintenance mode.
There are no available hosts capable of running the engine VM.]

It's hard to understand why there were no other capable hosts. Above error is taken from CI [1][2]. AFAICT the engine vm was up on host-0, then we (successfully) migrated it to host-1, then tried to move host-0 to maintenance, which failed.

[1] https://jenkins.ovirt.org/job/ovirt-system-tests_standard-check-patch/7591/
[2] https://jenkins.ovirt.org/job/ovirt-system-tests_standard-check-patch/7591/artifact/check-patch.he-basic_suite_4.3.el7.x86_64/test_logs/he-basic-suite-4.3/post-012_local_maintenance_sdk.py/lago-he-basic-suite-4-3-engine/_var_log/ovirt-engine/engine.log

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

Above is on 4.3

How reproducible:
I think always

Steps to Reproduce:
1. deploy hosted-engine on two hosts
2. Make the other host (one not running engine vm) too loaded
3. Try moving the host running engine VM to maintenance

Actual results:
Fails, with error message as above

Expected results:
Fails, with a more detailed error message

Additional info:

Comment 1 Ryan Barry 2020-01-16 00:28:20 UTC
This is obviously not a great title for an RFE. And, if it were 100% reproducible in a production release, we'd have seen it before (with tickets)

Scheduler weights for hyperthreaded CPUs were changed, and this may be affecting an environment as limited as CI. Andrej, any ideas from the log?

Comment 2 Michal Skrivanek 2020-01-16 03:46:15 UTC
It shouldn’t be an error in engine.log, it’s just a “normal” scheduling condition, and should be reported the same way as when this happen with regular VMs when they can’t move

Comment 3 Yedidyah Bar David 2020-01-16 06:48:25 UTC
(In reply to Michal Skrivanek from comment #2)
> It shouldn’t be an error in engine.log, it’s just a “normal” scheduling
> condition, and should be reported the same way as when this happen with
> regular VMs when they can’t move

Fine. Ss there a way to get this reporting via the SDK, so that we can add it to CI? I am not claiming that the log is the only way, but there should be some automation-friendly way to get this info, IMO. Feel free to move the bug to API/SDK if more suitable.

Comment 4 Andrej Krejcir 2020-01-16 12:37:42 UTC
This error is not because the HE VM failed to schedule. 
The command that puts the host to maintenance 'MaintenanceNumberOfVdssCommand' does a basic check if there is another host in the cluster to run HE VM.

For each host it checks:
1. If it is in Up status
2. If it is not being put to maintenance
3. If it is a HE host and the ha-agent and ha-broker are active
4. If it is not in local maintenance mode
5. If its HE score is > 0

This error is shown if there is no host that satisfies all conditions.


I will look to the logs to see why this happens.

Comment 5 Andrej Krejcir 2020-01-20 12:40:11 UTC
I think I found the issue. The core problem is that ha-agent does not recognize that the HE VM failed to start locally because it is already running elsewhere and the sanlock could not be not acquired.

When a VM fails to start, the he-agent compares the error message with a hard-coded strings to detect if the failure is because of sanlock. In a new version of qemu, the error message has changed.

The error from the vdsm.log is:


2020-01-15 02:03:05,652-0500 ERROR (vm/7fe45704) [virt.vm] (vmId='7fe45704-ef24-40e9-bbf4-07ee97e27fd8') The vm start process failed (vm:933)
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/vdsm/virt/vm.py", line 867, in _startUnderlyingVm
    self._run()
  File "/usr/lib/python2.7/site-packages/vdsm/virt/vm.py", line 2891, in _run
    dom.createWithFlags(flags)
  File "/usr/lib/python2.7/site-packages/vdsm/common/libvirtconnection.py", line 131, in wrapper
    ret = f(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/vdsm/common/function.py", line 94, in wrapper
    return func(inst, *args, **kwargs)
  File "/usr/lib64/python2.7/site-packages/libvirt.py", line 1110, in createWithFlags
    if ret == -1: raise libvirtError ('virDomainCreateWithFlags() failed', dom=self)
libvirtError: internal error: qemu unexpectedly closed the monitor: 2020-01-15T07:03:01.973092Z qemu-kvm: warning: All CPU(s) up to maxcpus should be described in NUMA config, ability to start up with partial NU
MA mappings is obsoleted and will be removed in future
2020-01-15T07:03:02.108044Z qemu-kvm: -device virtio-blk-pci,iothread=iothread1,scsi=off,bus=pci.0,addr=0x7,drive=drive-ua-f1a839b6-74ca-41f2-bd58-463f3e9a1c75,id=ua-f1a839b6-74ca-41f2-bd58-463f3e9a1c75,bootinde
x=1,write-cache=on: Failed to get shared "write" lock
Is another process using the image [/var/run/vdsm/storage/4e23d2a7-de42-48f6-b68e-ca2409411889/f1a839b6-74ca-41f2-bd58-463f3e9a1c75/4ba0300c-df8d-43e9-857f-f0e2bc62572d]?



The ha-agent expects the error message to end with on of:
- 'Failed to acquire lock: error -243',
- 'Failed to acquire lock: Lease is held by another host',
- 'Is another process using the image?'


The ha-agent sets the state to 'EngineUnexpectedlyDown' and sets the score to 0. Which is the reason why the HE VM cannot be migrated back to Host 0.

Comment 6 Yedidyah Bar David 2020-01-21 11:24:41 UTC
(In reply to Andrej Krejcir from comment #5)
> I think I found the issue. The core problem is that ha-agent does not
> recognize that the HE VM failed to start locally because it is already
> running elsewhere and the sanlock could not be not acquired.
> 
> When a VM fails to start, the he-agent compares the error message with a
> hard-coded strings to detect if the failure is because of sanlock. In a new
> version of qemu, the error message has changed.

Very nice catch, but can you please open another bug for it? I still think that
a better answer to 'Why?', as I asked originally, is useful. In current case,
can be something like 'host-0 has score 0, ...'. Thanks!

Comment 7 Andrej Krejcir 2020-01-22 16:01:09 UTC
Ok, I have opened another bug: Bug 1794089.

Comment 9 Nikolai Sednev 2020-05-11 10:26:03 UTC
alma03 ~]# top
top - 13:21:43 up 19 days, 23:55,  2 users,  load average: 101.79, 52.84, 21.25
Tasks: 282 total, 105 running, 177 sleeping,   0 stopped,   0 zombie
%Cpu(s): 51.0 us, 48.6 sy,  0.0 ni,  0.0 id,  0.0 wa,  0.3 hi,  0.1 si,  0.0 st
MiB Mem :  32017.3 total,  14986.7 free,  13989.6 used,   3041.0 buff/cache
MiB Swap:   2048.0 total,   2048.0 free,      0.0 used.  17501.1 avail Mem 

Set to maintenance alma04 which was running HE-VM. Engine got migrated to loaded alma03.
No error observed.


Migration completed (VM: HostedEngine, Source: alma04.qa.lab.tlv.redhat.com, Destination: alma03.qa.lab.tlv.redhat.com, Duration: 1 minute 55 seconds, Total: 2 minutes 6 seconds, Actual downtime: (N/A))
5/11/201:21:36 PM

Storage Pool Manager runs on Host alma03.qa.lab.tlv.redhat.com (Address: alma03.qa.lab.tlv.redhat.com), Data Center Default.
5/11/201:19:37 PM

Invalid status on Data Center Default. Setting status to Non Responsive.
5/11/201:19:36 PM

Host alma04.qa.lab.tlv.redhat.com was switched to Maintenance mode by admin@internal-authz.
5/11/201:19:31 PM

Migration initiated by system (VM: HostedEngine, Source: alma04.qa.lab.tlv.redhat.com, Destination: alma03.qa.lab.tlv.redhat.com, Reason: ).
5/11/201:19:31 PM

Used CPU of host alma03.qa.lab.tlv.redhat.com [99%] exceeded defined threshold [95%].
5/11/201:18:55 PM


Tested on:
rhvm-4.4.0-0.33.master.el8ev.noarch
ovirt-hosted-engine-ha-2.4.2-1.el8ev.noarch
ovirt-hosted-engine-setup-2.4.4-1.el8ev.noarch
Linux 4.18.0-193.el8.x86_64 #1 SMP Fri Mar 27 14:35:58 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
Red Hat Enterprise Linux release 8.2 (Ootpa)

Comment 10 Nikolai Sednev 2020-05-11 10:38:44 UTC
alma04 ~]# hosted-engine --vm-status


--== Host alma04.qa.lab.tlv.redhat.com (id: 1) status ==--

Host ID                            : 1
Host timestamp                     : 1733070
Score                              : 0
Engine status                      : {"vm": "down", "health": "bad", "detail": "unknown", "reason": "vm not running on this host"}
Hostname                           : alma04.qa.lab.tlv.redhat.com
Local maintenance                  : True
stopped                            : False
crc32                              : 127da8bc
conf_on_shared_storage             : True
local_conf_timestamp               : 1733070
Status up-to-date                  : True
Extra metadata (valid at timestamp):
        metadata_parse_version=1
        metadata_feature_version=1
        timestamp=1733070 (Mon May 11 13:26:16 2020)
        host-id=1
        score=0
        vm_conf_refresh_time=1733070 (Mon May 11 13:26:16 2020)
        conf_on_shared_storage=True
        maintenance=True
        state=LocalMaintenance
        stopped=False


--== Host alma03.qa.lab.tlv.redhat.com (id: 2) status ==--

Host ID                            : 2
Host timestamp                     : 1727996
Score                              : 3249
Engine status                      : {"vm": "up", "health": "good", "detail": "Up"}
Hostname                           : alma03.qa.lab.tlv.redhat.com
Local maintenance                  : False
stopped                            : False
crc32                              : c4ffb90a
conf_on_shared_storage             : True
local_conf_timestamp               : 1727996
Status up-to-date                  : True
Extra metadata (valid at timestamp):
        metadata_parse_version=1
        metadata_feature_version=1
        timestamp=1727996 (Mon May 11 13:26:13 2020)
        host-id=2
        score=3249
        vm_conf_refresh_time=1727996 (Mon May 11 13:26:14 2020)
        conf_on_shared_storage=True
        maintenance=False
        state=EngineUp
        stopped=False


Score on loaded alma03 went down from 3400 points to 2400 points, while being decreased by 22 penalty points, as long as host's CPU remained loaded.

Comment 11 Sandro Bonazzola 2020-05-20 20:02:50 UTC
This bugzilla is included in oVirt 4.4.0 release, published on May 20th 2020.

Since the problem described in this bug report should be
resolved in oVirt 4.4.0 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.