| 2116 | } |
| 2117 | |
| 2118 | gboolean |
| 2119 | DeleteRsc(resource_t * rsc, node_t * node, gboolean optional, pe_working_set_t * data_set) |
| 2120 | { |
| 2121 | action_t *delete = NULL; |
| 2122 | |
| 2123 | #if DELETE_THEN_REFRESH |
| 2124 | action_t *refresh = NULL; |
| 2125 | #endif |
| 2126 | if (is_set(rsc->flags, pe_rsc_failed)) { |
| 2127 | pe_rsc_trace(rsc, "Resource %s not deleted from %s: failed", rsc->id, node->details->uname); |
| 2128 | return FALSE; |
| 2129 | |
| 2130 | } else if (node == NULL) { |
| 2131 | pe_rsc_trace(rsc, "Resource %s not deleted: NULL node", rsc->id); |
| 2132 | return FALSE; |
| 2133 | |
| 2134 | } else if (node->details->unclean || node->details->online == FALSE) { |
| 2135 | pe_rsc_trace(rsc, "Resource %s not deleted from %s: unrunnable", rsc->id, node->details->uname); |
| 2136 | return FALSE; |
| 2137 | } |
| 2138 | |
| 2139 | crm_notice("Removing %s from %s", rsc->id, node->details->uname); |
| 2140 | |
| 2141 | delete = delete_action(rsc, node, optional); |
| 2142 | |
| 2143 | new_rsc_order(rsc, RSC_STOP, rsc, RSC_DELETE, |
| 2144 | optional ? pe_order_implies_then : pe_order_optional, data_set); |
| 2145 | |
| 2146 | new_rsc_order(rsc, RSC_DELETE, rsc, RSC_START, |
| 2147 | optional ? pe_order_implies_then : pe_order_optional, data_set); |
| 2148 | |
| 2149 | #if DELETE_THEN_REFRESH |
| 2150 | refresh = custom_action(NULL, strdup(CRM_OP_LRM_REFRESH), CRM_OP_LRM_REFRESH, |
| 2151 | node, FALSE, TRUE, data_set); |
| 2152 | |
| 2153 | add_hash_param(refresh->meta, XML_ATTR_TE_NOWAIT, XML_BOOLEAN_TRUE); |
| 2154 | |
| 2155 | order_actions(delete, refresh, pe_order_optional); |
| 2156 | #endif |
| 2157 | |
| 2158 | return TRUE; |
| 2159 | } |
| 2160 | |
| 2161 | #include <../lib/pengine/unpack.h> |
| 2162 | #define set_char(x) last_rsc_id[lpc] = x; complete = TRUE; |
no test coverage detected