| 2812 | } |
| 2813 | |
| 2814 | static void |
| 2815 | MigrateRsc(resource_t * rsc, action_t *stop, action_t *start, pe_working_set_t * data_set, gboolean partial) |
| 2816 | { |
| 2817 | action_t *to = NULL; |
| 2818 | action_t *from = NULL; |
| 2819 | action_t *then = NULL; |
| 2820 | action_t *other = NULL; |
| 2821 | action_t *done = get_pseudo_op(STONITH_DONE, data_set); |
| 2822 | |
| 2823 | GListPtr gIter = NULL; |
| 2824 | const char *value = g_hash_table_lookup(rsc->meta, XML_OP_ATTR_ALLOW_MIGRATE); |
| 2825 | |
| 2826 | if (crm_is_true(value) == FALSE) { |
| 2827 | return; |
| 2828 | } |
| 2829 | |
| 2830 | if (rsc->next_role > RSC_ROLE_SLAVE) { |
| 2831 | pe_rsc_trace(rsc, "%s: resource role: role=%s", rsc->id, role2text(rsc->next_role)); |
| 2832 | return; |
| 2833 | } |
| 2834 | |
| 2835 | if(start == NULL || stop == NULL) { |
| 2836 | pe_rsc_trace(rsc, "%s: not exists %p -> %p", rsc->id, stop, start); |
| 2837 | return; |
| 2838 | |
| 2839 | } else if (start->node == NULL || stop->node == NULL) { |
| 2840 | pe_rsc_trace(rsc, "%s: no node %p -> %p", rsc->id, stop->node, start->node); |
| 2841 | return; |
| 2842 | |
| 2843 | } else if(is_set(stop->flags, pe_action_optional)) { |
| 2844 | pe_rsc_trace(rsc, "%s: stop action", rsc->id); |
| 2845 | return; |
| 2846 | |
| 2847 | } else if(is_set(start->flags, pe_action_optional)) { |
| 2848 | pe_rsc_trace(rsc, "%s: start action", rsc->id); |
| 2849 | return; |
| 2850 | |
| 2851 | } else if (stop->node->details == start->node->details) { |
| 2852 | pe_rsc_trace(rsc, "%s: not moving %p -> %p", rsc->id, stop->node, start->node); |
| 2853 | return; |
| 2854 | |
| 2855 | } else if (at_stack_bottom(rsc) == FALSE) { |
| 2856 | pe_rsc_trace(rsc, "%s: not at stack bottom", rsc->id); |
| 2857 | return; |
| 2858 | } |
| 2859 | |
| 2860 | pe_rsc_trace(rsc, "%s %s -> %s", rsc->id, stop->node->details->uname, start->node->details->uname); |
| 2861 | |
| 2862 | if (partial) { |
| 2863 | pe_rsc_info(rsc, "Completing partial migration of %s from %s to %s", rsc->id, |
| 2864 | stop->node ? stop->node->details->uname : "unknown", |
| 2865 | start->node ? start->node->details->uname : "unknown"); |
| 2866 | } else { |
| 2867 | pe_rsc_info(rsc, "Migrating %s from %s to %s", rsc->id, |
| 2868 | stop->node ? stop->node->details->uname : "unknown", |
| 2869 | start->node ? start->node->details->uname : "unknown"); |
| 2870 | } |
| 2871 |
no test coverage detected