This site best when viewed with a modern standards-compliant browser. We recommend Firefox Get Firefox!.

Linux-HA project logo
Providing Open Source High-Availability Software for Linux and other OSes since 1999.

USA Flag UK Flag

Japanese Flag

Homepage

About Us

Contact Us

Legal Info

How To Contribute

Security Issues

7th - 10th September 2009 Linux-Kongress in Hamburg will have several sessions on Linux-HA - see you there!

18 August 2008 Heartbeat release 2.1.4 is now out Download it

11 October 2007 NEW educational HA/DR Blog hosted by Alan Robertson

9 April 2007 Check out the Cool Heartbeat Screencasts: Installation, Intro to the GUI Part of the Heartbeat Education project

Last site update:
2008-09-07 06:51:18

This is my thoughts on a detailed algorithm for the PolicyEngineComputation.

NOTE: The current algorithm places the importance of running of all resources over the running of a resource on a given node.

Required Objects

node { 
 char *id;
 int weight;
};

color {
 int id;
 node *candidate_nodes;
 node chosen_node;
};

placement_constraint {
 resource res_lh;
 resource res_rh;
 node     node_rh;
 enum contype operation;
};

resource {
 char *id;
 xmlNodePtr xml;
 int priority;
 int *candidate_colors;
 int color;
 gboolean provisional;
 node *allowed_nodes;
 placement_constraint *positive;
 placement_constraint *negative;
};

Phase 1 : Unpack

  1. Unpack Nodes into a GSList
  2. Sort GSList by node.id
  3. Unpack Resources into GSList
    1. Filter inactive nodes out of resource.candiate_nodes
    2. Sort Resources by resource.priority
  4. Unpack Constraints
    1. Process Constraints
      1. Duplicate and invert binary constraints (A != B --> A != B, B != A)

      2. Anything else?
    2. Attach constraints to resource.positive or resource.negative depending on type
    3. Further filter resource.allowed_nodes based on any resource_to_node type constraints

Phase 2 : Color

  1. Set initial color
  2. Set color.candidate_nodes = all active nodes
  3. Set resource.color = color (all resources)
  4. Set resource.provisional = TRUE (all resources)
  5. Take (next) highest resource
    1. if resource.provisional == FALSE, repeat
  6. For resource.negative,
    1. if resource.negative.res_rh.provisional == FALSE
      Remove resource.negative.res_rh.color from resource.candiate_colors

  7. Choose a color (this may need modification pending further napkin drawings)
    1. For resource.candidate_colors
      1. If resource.candidate_color.candidate_nodes & resource.allowed_nodes != NULL

        1. resource.candidate_color.candidate_nodes &= resource.allowed_nodes

        2. merge node weights
        3. resource.color = resource.candidate_color
        4. resource.provisional = FALSE
    2. If resource.provisional = TRUE
      1. Create new color
      2. color.candidate_nodes = resource.allowed_nodes
      3. resource.color = color
      4. resource.provisional = FALSE
  8. For resource.positive,
    1. resource.positive.res_rh.color = resource.color
    2. resource.positive.res_rh.provisional = FALSE
  9. For resources,
    1. If resource.provisional = FALSE
      Add current color to resource.candidate_colors

  10. For resource.negative,
    1. if resource.negative.res_rh.provisional == FALSE
      Remove resource.color from resource.negative.res_rh.candidate_colors

  11. Goto step 5

Phase 3 : Choose Nodes

For colors,

  1. If color(n) ^ color(n+1) == NULL
    1. Sort color.candidate_nodes by weight
    2. color.chosen_node = highest wieghted node
  2. Else if color(n) & !color(n+1) != NULL

    1. Sort (color(n) & !color(n+1)) by weight

    2. color.chosen_node = highest wieghted node
  3. Else
    1. Sort (color(n+1) & !color(n)) by weight

    2. color.chosen_node = highest wieghted node

Phase 4 : Create Transition Graph

Phase 5 : Profit