1 /* 2 * Copyright 2023 the Pacemaker project contributors 3 * 4 * The version control history for this file may have further details. 5 * 6 * This source code is licensed under the GNU Lesser General Public License 7 * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. 8 */ 9 10 #ifndef PCMK__CRM_COMMON_ACTION_RELATION_INTERNAL__H 11 # define PCMK__CRM_COMMON_ACTION_RELATION_INTERNAL__H 12 13 /*! 14 * Flags to indicate the relationship between two actions 15 * 16 * @COMPAT The values and semantics of these flags should not be changed until 17 * the deprecated enum pe_ordering is dropped from the public API. 18 */ 19 enum pcmk__action_relation_flags { 20 //! No relation (compare with equality rather than bit set) 21 pcmk__ar_none = 0U, 22 23 //! Actions are ordered (optionally, if no other flags are set) 24 pcmk__ar_ordered = (1U << 0), 25 26 //! Relation applies only if 'first' cannot be part of a live migration 27 pcmk__ar_if_first_unmigratable = (1U << 1), 28 29 /*! 30 * If 'then' is required, 'first' becomes required (and becomes unmigratable 31 * if 'then' is); also, if 'first' is a stop of a blocked resource, 'then' 32 * becomes unrunnable 33 */ 34 pcmk__ar_then_implies_first = (1U << 4), 35 36 /*! 37 * If 'first' is required, 'then' becomes required; if 'first' is a stop of 38 * a blocked resource, 'then' becomes unrunnable 39 */ 40 pcmk__ar_first_implies_then = (1U << 5), 41 42 /*! 43 * If 'then' is required and for a promoted instance, 'first' becomes 44 * required (and becomes unmigratable if 'then' is) 45 */ 46 pcmk__ar_promoted_then_implies_first = (1U << 6), 47 48 /*! 49 * 'first' is runnable only if 'then' is both runnable and migratable, 50 * and 'first' becomes required if 'then' is 51 */ 52 pcmk__ar_unmigratable_then_blocks = (1U << 7), 53 54 //! 'then' is runnable (and migratable) only if 'first' is runnable 55 pcmk__ar_unrunnable_first_blocks = (1U << 8), 56 57 //! If 'first' is unrunnable, 'then' becomes a real, unmigratable action 58 pcmk__ar_first_else_then = (1U << 9), 59 60 //! If 'first' is required, 'then' action for instance on same node is 61 pcmk__ar_first_implies_same_node_then = (1U << 10), 62 63 /*! 64 * Disable relation if 'first' is unrunnable and for an active resource, 65 * otherwise order actions and make 'then' unrunnable if 'first' is. 66 * 67 * This is used to order a bundle replica's start of its container before a 68 * probe of its remote connection resource, in case the connection uses the 69 * REMOTE_CONTAINER_HACK to replace the connection address with where the 70 * container is running. 71 */ 72 pcmk__ar_nested_remote_probe = (1U << 11), 73 74 /*! 75 * If 'first' is for a blocked resource, make 'then' unrunnable. 76 * 77 * If 'then' is required, make 'first' required, make 'first' unmigratable 78 * if 'then' is unmigratable, and make 'then' unrunnable if 'first' is 79 * unrunnable. 80 * 81 * If 'then' is unrunnable and for the same resource as 'first', make 82 * 'first' required if it is runnable, and make 'first' unmigratable if 83 * 'then' is unmigratable. 84 * 85 * This is used for "stop then start primitive" (restarts) and 86 * "stop group member then stop previous member". 87 */ 88 pcmk__ar_intermediate_stop = (1U << 12), 89 90 /*! 91 * The actions must be serialized if in the same transition but can be in 92 * either order. (In practice, we always arrange them as 'first' then 93 * 'then', so they end up being essentially the same as optional orderings.) 94 * 95 * @TODO Handle more intelligently -- for example, we could schedule the 96 * action with the fewest inputs first, so we're more likely to execute at 97 * least one if there is a failure during the transition. Or, we could 98 * prefer certain action types over others, or base it on resource priority. 99 */ 100 pcmk__ar_serialize = (1U << 14), 101 102 //! Relation applies only if actions are on same node 103 pcmk__ar_if_on_same_node = (1U << 15), 104 105 //! If 'then' is required, 'first' must be added to the transition graph 106 pcmk__ar_then_implies_first_graphed = (1U << 16), 107 108 //! If 'first' is required and runnable, 'then' must be in graph 109 pcmk__ar_first_implies_then_graphed = (1U << 17), 110 111 //! User-configured asymmetric ordering 112 pcmk__ar_asymmetric = (1U << 20), 113 114 //! Actions are ordered if on same node (or migration target for migrate_to) 115 pcmk__ar_if_on_same_node_or_target = (1U << 21), 116 117 //! 'then' action is runnable if certain number of 'first' instances are 118 pcmk__ar_min_runnable = (1U << 22), 119 120 //! Ordering applies only if 'first' is required and on same node as 'then' 121 pcmk__ar_if_required_on_same_node = (1U << 23), 122 123 //! Ordering applies even if 'first' runs on guest node created by 'then' 124 pcmk__ar_guest_allowed = (1U << 24), 125 126 //! If 'then' action becomes required, 'first' becomes optional 127 pcmk__ar_then_cancels_first = (1U << 25), 128 }; 129 130 typedef struct pe_action_wrapper_s pcmk__related_action_t; 131 132 #endif // PCMK__CRM_COMMON_ACTION_RELATION_INTERNAL__H