On 6/20/25 16:31, Daniel Kral wrote:
+=head3 get_colocated_services($rules, $sid)
+
+Returns a list of two hash sets, where the first hash set contains the
+positively colocated services for C<$sid>, while the second hash set contains
+the negatively colocated services for C<$sid> according to the colocation rules
+in C<$rules>.
+
+For example, if a service is in a negative colocation with C<'vm:101'> and in a
+positive colocation with C<'ct:200'> and C<'ct:201'>, the returned value will 
be:
+
+    {
+        together => {
+            'vm:101' => 1
+        },
+        separate => {
+            'ct:200' => 1,
+            'ct:201' => 1
+        }
+    }
+
+=cut
+

I'd tend to introduce another colocation rules canonicalize helper in v3 to also make any negatively colocated services of the positively colocated services of a service $sid also negatively colocated with that service $sid. This could also be done in get_colocated_services(...) and get_colocation_preference(...) individually, but introducing these inferred extra rules ends up in less code.

An example could help here to understand the above better:

Services A, B, and C must be kept together
Services A and Z must be kept separate

Therefore, services B and Z must be kept separate and services C and Z must be kept separate too.

I hope this is still intuitive enough for users (came across it while implementing showing the comigrated services / blocking services in the web interface) and must prevent invalid migrations as a migration of service B would currently allow "comigrating" service A (!) and C to the node of service Z.


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to