Bug 773338

Summary: [RFE] Use Operating system field to decide where to migrate/start the VM on.
Product: [oVirt] ovirt-engine Reporter: Jaroslav Henner <jhenner>
Component: RFEsAssignee: Doron Fediuck <dfediuck>
Status: CLOSED DEFERRED QA Contact: Artyom <alukiano>
Severity: medium Docs Contact:
Priority: medium    
Version: ---CC: bsettle, bugs, dfediuck, jhenner, lpeer, mavital, mgoldboi, rbalakri
Target Milestone: ---Keywords: FutureFeature, Reopened
Target Release: ---Flags: ykaul: ovirt-4.2?
ylavi: planning_ack?
ylavi: devel_ack?
ylavi: testing_ack?
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: ovirt-3.4.0-alpha1 Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-06-08 16:08:31 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: SLA RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Jaroslav Henner 2012-01-11 15:05:26 UTC
Description of problem:
Effort should be taken to leave VMs with same OS on same host. This would lead the KSM to be more happy. We have Operating System specifier there, so let's use it.

It is inconvenient if the VMs are distributed like:

Win7 Win8 WinXP RHEL6 RHEL5 on host1
Win7 Win8 WinXP RHEL6 RHEL5 on host2

much better is 
Win7 Win7 Win8 Win8 WinXP WinXP on host1, 
RHEL5 RHEL5 RHEL6 RHEL6 on host2

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

Comment 4 Itamar Heim 2012-12-17 07:29:16 UTC
Closing old bugs. If this issue is still relevant/important in current version, please re-open the bug.

Comment 9 Doron Fediuck 2013-07-25 07:37:53 UTC
Since we now have the new scheduler[1] this can be handled in 2 ways;

1. Write a filter that will make sure we use /only/ same-OS scheduling.
Possible results may be that a VM will not be able to run if current hosts
are running VMs with a different OS.

2. Write a weights module that will prefer hosts with a majority of the given OS.
This is an optimization which will not prevent running a VM with a different OS,
but most likely to end up with same-OS hosts in many of the hosts.

When opening this issue, were you looking for a hard constraint which will be
resolved by the first way, or optimization which will be handled by the alternative way? 

[1] http://www.ovirt.org/Features/oVirtScheduler

Comment 10 Jaroslav Henner 2013-07-30 11:52:03 UTC
(In reply to Doron Fediuck from comment #9)
> Since we now have the new scheduler[1] this can be handled in 2 ways;
> 
> 1. Write a filter that will make sure we use /only/ same-OS scheduling.
> Possible results may be that a VM will not be able to run if current hosts
> are running VMs with a different OS.
> 
> 2. Write a weights module that will prefer hosts with a majority of the
> given OS.
> This is an optimization which will not prevent running a VM with a different
> OS,
> but most likely to end up with same-OS hosts in many of the hosts.
> 
> When opening this issue, were you looking for a hard constraint which will be
> resolved by the first way, or optimization which will be handled by the
> alternative way? 

Well, I don't work on RHEVM any more, but it was the second one.

> 
> [1] http://www.ovirt.org/Features/oVirtScheduler

Comment 11 Sandro Bonazzola 2014-01-13 13:57:13 UTC
oVirt 3.4.0 alpha has been released including the fix for this issue.

Comment 12 Artyom 2014-02-13 09:43:50 UTC
Still no weight or filter module for OS?
Checked on ovirt-engine-3.4.0-0.5.beta1.el6.noarch

Comment 13 Artyom 2014-02-13 09:46:24 UTC
Also if it new feature for 3.4 I need feature page in ovirt for this(this will help to write correct tcms plan)
Thanks

Comment 14 Artyom 2014-02-13 15:09:21 UTC
After conversation with Doron revealed that created just sample of weight module under /usr/share/doc/ovirt-scheduler-proxy-0.1.3/plugins/examples ksm_same_os_score.py, you still can use this module with ovirt-scheduler-proxy as external module.

Comment 15 Artyom 2014-02-20 09:20:23 UTC
Verified on ovirt-engine-3.4.0-0.11.beta3.el6.noarch
Script appear under /usr/share/doc/ovirt-scheduler-proxy-0.1.3/plugins/examples and also work fine if you add this script via ovirt-scheduler-proxy

Comment 16 Artyom 2014-02-24 14:42:59 UTC
Correction,
vm choose not correct host, because from view of scheduler best host, it host with minimal score, so you need to change:

score = some_max_weight
host_vms = self._get_vms(host.name, connection)
if not host_vms:
    return (host.id, some_max_weight)
for host_vm in host_vms:
    if(vm.get_os().get_type() == host_vm.get_os().get_type()):
         if(vm.get_os().get_version() == host_vm.get_os().get_version()):
              score -= 100
         else:
             score -= 20
#not sure about this one, if you want that factor of same os will less in case #that host have many vms, you can do score + host_vms * some_factor 
return (host.id, score / len(host_vms))

Checked on ovirt-engine-3.4.0-0.11.beta3.el6.noarch

Comment 17 Doron Fediuck 2014-06-13 08:36:08 UTC
Pushing to 3.6.0 so we'll be able to properly incorporate it into
the built-in policies.

Comment 18 Red Hat Bugzilla Rules Engine 2015-10-19 11:02:43 UTC
Target release should be placed once a package build is known to fix a issue. Since this bug is not modified, the target version has been reset. Please use target milestone to plan a fix for a oVirt release.

Comment 19 Yaniv Lavi 2016-12-14 16:16:46 UTC
This bug had requires_doc_text flag, yet no documentation text was provided. Please add the documentation text and only then set this flag.

Comment 21 Doron Fediuck 2017-06-08 16:08:31 UTC
For now we're not looking into this, so closing.
If you wish to contribute- patches are welcome!