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

Bug 1594810

Summary: [RFE] improve affinity group/label handling
Product: Red Hat Enterprise Virtualization Manager Reporter: Steffen Froemer <sfroemer>
Component: ovirt-engineAssignee: Nobody <nobody>
Status: CLOSED DUPLICATE QA Contact: Polina <pagranat>
Severity: unspecified Docs Contact:
Priority: medium    
Version: 4.2.0CC: ahadas, akrejcir, lsurette, lwright, mavital, michal.skrivanek, pelauter, sfroemer, srevivo
Target Milestone: ---Keywords: FutureFeature
Target Release: ---Flags: mavital: testing_plan_complete?
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-02-08 21:49:48 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:
Attachments:
Description Flags
Example playbook with an affinity group based on queries none

Description Steffen Froemer 2018-06-25 12:51:54 UTC
1. Proposed title of this feature request
Provide an easier to manage Affinity Group Interface.


3. What is the nature and description of the request?
Currently there is the mechanism "affinity groups" where it is possible to configure a list of VMs and/or a list of HVs with rules if they should run together or not.
Also there is the mechanism "affinity labels" where on specific use case (enforced affinity VM to HV) can be configured.
As of my knowledge both mechanisms are implemented via the same techniques in RHV.


4. Why does the customer need this? (List the business requirements here)
Using affinity groups in current Cluster environment is really required in their environment to achieve business use-case. But the current method is difficult to maintain and could create contradictions, which are very difficult to debug.

5. How would the customer like to achieve this? (List the functional requirements here)
The use of affinity labels should not be restricted to one use case. The interface should offer the following:
* Rule creation with an optional custom name for the rule.
* Rules can contain affinities or anti-affinities, either enforced or not enforced
* Rules only contain tag names/group names
* It should be possible to deactivate rules
* Hosts and VMs are assigned to one or multiple tag names/group names
* Rules can have a priority
* Contradictions should be detected and marked
 * Those marks should have two stages: 
 * Stage1: contradiction already resolved by priority (see above)
 * Stage2: contradiction is not resolvable


6. For each functional requirement listed, specify how Red Hat and the customer can test to confirm the requirement is successfully implemented.
Affinity group: 1
Group name: Run VMs in Datacenter 1
Affinity: Not enforced run together
Tagnames: DC1-VMS, DC1-HOSTS
Assign the tag "DC1-VMS" to all VMs I would like to run in Datacenter 1
Assign the tag "DC1-HOSTS" to all VMs I would like to run in Datacenter 1
Result: VMs tagged with "DC1-VMS" should run on Hosts with tag "DC1-HOSTS"

Affinity group: 2
Prio: 0
Group name: Run nvidia VMs on capable hosts
Affinity: Enforced run together
Tagnames: NV-VMS, NV-HOSTS
Assign the tag "NV-VMS" to all VMs that are running calculations that need nvidia compute cards
Assign the tag "NV-HOSTS" to all Hosts that containt nvidia compute cards
Result: VMs tagged with "NV-VMS" can only be started on Hosts with tag "NV-HOSTS"

Affinity group: 3
Prio: 2
Group name: Ensure loadbalancing for application 1
Affinity: Not enforced run separate
Tagnames: APP1-VMS
Assign the tag "APP1-VMS" to all VMs that run application 1
Result: VMs tagged with "APP1-VMS" should not run on the same host, but could due to other restraints (resources, other affinity groups)

Affinity group: 4
Group name: Ensure redundance for application 2
Affinity: Enforced run separate
Tagnames: APP2-VMS
Assign the tag "APP2-VMS" to all VMs that run application 2
Result: VMs tagged with "APP2-VMS" will never run on the same host

Affinity group: 5
Prio: 5
Group name: Enable high interconnect for application 3
Affinity: Not enforced run together
Tagnames: APP3-VMS
Assign the tag "APP3-VMS" to all VMs that run application 3
Result: Result: VMs tagged with "APP3-VMS" should not run on the same host, but could due to other restraints (resources, other affinity groups)

If there are VMs tagged with both APP3-VMS and APP1-VMS then the affinity group 3 will take precedence over affinity group 5.



7. Is there already an existing RFE upstream or in Red Hat Bugzilla?
no that I'm aware of


8. Does the customer have any specific timeline dependencies and which release would they like to target (i.e. RHEL5, RHEL6)?
asap


9. Is the sales team involved in this request and do they have any additional input?
no


10. List any affected packages or components.
ovirt-engine?


11. Would the customer be able to assist in testing this functionality if implemented?
yes

Comment 2 Michal Skrivanek 2018-06-26 06:59:44 UTC
*** Bug 1594809 has been marked as a duplicate of this bug. ***

Comment 3 Martin Sivák 2018-06-26 14:36:41 UTC
There are quite a lot of separate RFEs contained in this report:

0) Basic functionality of creating rules, giving them name, disabling affinity and so on..

All of this should already be available in the current releases of RHV (4.2).

1) The ability to use labels in affinity groups instead of listing all VMs explicitly

This was in the original plan, but we haven't implemented it and prefer an automated tool to manage the affinity groups using Ansible or REST/SDK.

2) The ability to report affinity group conflicts

We already warn the user about conflicts we can detect at creation time. However there are conflicts that only happen when a VM that appears in multiple groups is started and we do report that conflict to the log.

3) The ability to handle "conflicts" automatically using priorities

I am open to an RFE that would give different relative weight to different soft affinity rule violations. The scheduler then tries to minimize the weight of the violations in the system (+ other constraints are taken into account too).

Hard constraints must always apply in a whole. There was probably a reason a hard constraint was created in the first place.

4) Using affinity labels/groups for hardware checks (Example Affinity Group 2)

This is one of the exact use cases we created the simple affinity labels for. Just create the label "NVIDIA" and attach it both to all VMs that require such card and to all hosts that provide such card. Already works today and does what you want.


TLDR:

All the requested features except labels in affinity groups and priorities are already implemented today to some extent. Soft affinity priorities would have to be designed and implemented.

As for connecting label/affinity group management:

Would for example an ansible based solution [1] or REST api based solution [2][3] to label / affinity group management be a better alternative? It does allow integrating with inventory management or other tools the customer might already be using. Manual management of rules with the described complexity does not sound too user friendly and would quickly turn tedious even in a small cluster.

Should labels / groups be somehow synchronized across multiple RHV instances managed by CloudForms? If yes, then this might also be something we should use the REST interface for (via SDK, Ansible or other means) and handle it in CloudForms.

The visualization part would have to be also greatly improved to make the complex rules obvious.


[1] https://docs.ansible.com/ansible/2.3/ovirt_affinity_groups_module.html and https://docs.ansible.com/ansible/2.3/ovirt_affinity_labels_module.html
[2] http://ovirt.github.io/ovirt-engine-sdk/master/services.m.html#ovirtsdk4.services.AffinityGroupsService and http://ovirt.github.io/ovirt-engine-sdk/master/services.m.html#ovirtsdk4.services.AffinityLabelsService
[3] http://ovirt.github.io/ovirt-engine-api-model/4.2/#services/affinity_groups and http://ovirt.github.io/ovirt-engine-api-model/4.2/#services/affinity_labels

Comment 4 Steffen Froemer 2018-07-11 07:23:25 UTC
(In reply to Martin Sivák from comment #3)
> 
> As for connecting label/affinity group management:
> 
> Would for example an ansible based solution [1] or REST api based solution
> [2][3] to label / affinity group management be a better alternative? It does
> allow integrating with inventory management or other tools the customer
> might already be using. Manual management of rules with the described
> complexity does not sound too user friendly and would quickly turn tedious
> even in a small cluster.
I guess this would be a good approach, but it should be somehow pre-prepared. So if the requested behavior will be covered by some ansible module, this would be sufficient. If the whole behavior is required to be written by customer himself, this would not be acceptable.


> 
> Should labels / groups be somehow synchronized across multiple RHV instances
> managed by CloudForms? If yes, then this might also be something we should
> use the REST interface for (via SDK, Ansible or other means) and handle it
> in CloudForms.
> 
> The visualization part would have to be also greatly improved to make the
> complex rules obvious.
Is this something CloudFormas already doing today? If this will be included into CFME, it will be somehow an opportunity to combine both systems a bit more.

Comment 5 Martin Sivák 2018-07-11 08:28:17 UTC
Created attachment 1458013 [details]
Example playbook with an affinity group based on queries

> if the requested behavior will be covered by some ansible module,
> this would be sufficient

Well there are couple that could be used.

The following two let you search for VMs and hosts according to whatever criteria the query mechanism supports (see the examples):

https://docs.ansible.com/ansible/2.5/modules/ovirt_vms_facts_module.html
https://docs.ansible.com/ansible/2.5/modules/ovirt_hosts_facts_module.html

The already mentioned module https://docs.ansible.com/ansible/2.5/modules/ovirt_affinity_group_module.html then lets you create/update an affinity group and you can use the results of those queries.

See the example playbook in the attachment.

Comment 8 Andrej Krejcir 2019-02-19 12:13:42 UTC
As I understand it, this RFE can be split into 3 separate RFEs:
1. Implementing priorities for soft affinity groups.
2. Allowing to use labels in affinity groups.
3. Improving the UI, so it is easier to work with affinities.

Is there anything else? If not, we can create these RFEs.

Comment 9 Steffen Froemer 2019-02-25 08:29:32 UTC
Hi, I've create the three separate RFE

* bz#01680498 - [RFE] Implement priorities for soft affinity groups
* bz#01680499 - [RFE] Allowing use of labels in affinity groups
* bz#01680503 - [RFE] Improve UI for Affinity Groups / Affinity Labels

Comment 10 Laura Wright 2019-03-28 16:00:48 UTC
Hi everyone! I would be happy to help out with the design of the UX/UI for this bug. @Ryan Would we be able to set up sometime to talk so I can learn more about the requirements for this?

Comment 11 Michal Skrivanek 2020-03-10 12:25:44 UTC
change SLA team to virt, we're not tracking SLA separately anymore

Comment 12 Arik 2021-02-08 21:49:48 UTC
This bz was split to bz 01680498, bz 01680499 and bz 01680503.
I see no need for this one anymore.

*** This bug has been marked as a duplicate of bug 1680503 ***