Bug 1258960

Summary: MigrateToServer can fail with destination host unknown (the underlying issue is deeper though).
Product: [oVirt] ovirt-engine Reporter: Martin Sivák <msivak>
Component: GeneralAssignee: Martin Sivák <msivak>
Status: CLOSED CURRENTRELEASE QA Contact: Petr Matyáš <pmatyas>
Severity: high Docs Contact:
Priority: medium    
Version: 3.5.0CC: bugs, dfediuck, gklein, lsurette, mavital, mgoldboi, msivak, pmatyas, rbalakri, sbonazzo, tnisan, yeylon
Target Milestone: ovirt-3.6.3Flags: rule-engine: ovirt-3.6.z+
mgoldboi: exception+
mgoldboi: planning_ack+
rule-engine: devel_ack+
mavital: testing_ack+
Target Release: 3.6.3.1   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Cause: A bug in and internal code inheritance. Consequence: When migrate to specific server was attempted with destination that was not available, the user did not get nice message. There was a confusing error instead. Fix: Bug fixed. Result: The user sees a nice error message with explanation when migration to explicit server is attempted and the destination is not available.
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-02-18 11:06:03 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: SLA RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Martin Sivák 2015-09-01 15:30:09 UTC
Description of problem:

The code contains a bug that reads all the candidate hosts back if they were filtered out because of none of the selected hosts passed the filtering stage.

The if block around org.ovirt.engine.core.bll.scheduling.SchedulingManager line 391 is the culprit here.


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

3.6 snapshot as of today + master branch

Reproducer:

1) Install three hosts
2) Create VMs A and B.
3) Create an affinity group containing A and B and set it to negative, enforcing
4) Start both VMs
5) Select VM A, Click Migrate and select the host where B is running as the target

Actual results:

The migration fails with destination host UNKNOWN.

Expected results:

Dialog telling me I cannot do the migration, because the host I selected has a VM from conflicting affinity group.


Other info:

- This does not happen when Run Once is used because Run Once uses the whitelist (org.ovirt.engine.core.bll.RunVmOnceCommand#getVdsWhiteList) together with destHostIdList.

- MigrateToServer also uses the whitelist, but only for the inherited run method from MigrateVmCommand (which uses getVdsWhitelist to get it).

- MigrateToServer's canDoAction is also inherited from MigrateVmCommand but uses getInitialHosts to fill the whitelist field of canSchedule... and the initialHosts argument is never used by anyone.

- So the bad line in selectBestHost is actually causing harm only in the MigrateToServer case as all other cases never pass any hosts to SchedulingManager#selectBestHost that would not be also in the destHostIdList. Which renders the referenced if line ineffective (when the list is empty, add all elements from empty list back to the list..).

Comment 1 Doron Fediuck 2016-01-24 08:46:19 UTC
Martin,
IIRC this was resolved as a part of pin to multiple hosts.
Can you please verify?

Comment 2 Martin Sivák 2016-01-25 09:59:40 UTC
Actually, it is still a bug. I submitted a patch for it now - https://gerrit.ovirt.org/52676

Comment 3 Petr Matyáš 2016-02-11 10:16:58 UTC
Verified on 3.6.3-2